openssl: Build on Windows fails if cloned with git
There is a repeatable problem with building of openssl cloned with GIT on Windows. When source comes from official distribution all line endings are preserved and remain normal unix style endings. But when git clones repository it may convert these into windows style endings. MinGW comes bundled with pretty outdated Perl (5.8.8 if memory serves…) which could get confused by these different styles and produce unexpected behavior. This is what happening during execution of Configure script. When ignored ciphers are determined this code is executed:
if ($sdirs) {
my $dir;
foreach $dir (@skip) {
s/(\s)$dir /$1/;
s/\s$dir$//;
}
}
$sdirs = 0 unless /\\$/;
In code $sdirs = 0 unless /$/; under normal circumstances pattern /$/ returns 1 if it is still processing these directories but if line ending is not normal unix style it will return nothing and allow $sdirs = 0. So only the first line of *SDIRS= * gets processed and the rest … objects \ md2 md4 md5 sha mdc2 hmac ripemd whrlpool \ … is skipped.
Result of this error is a Makefile which is trying to process ALL ciphers disregarding no-cipher attributes and will produce this error:
gcc -I.. -I../.. -I../asn1 -I../evp -I../../include -DOPENSSL_THREADS
-DDSO_WIN32 -mno-cygwin -DL_ENDIAN -DOPENSSL_NO_CAPIENG
-fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_WORDS
-DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM
-DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -c -o
md2_dgst.o md2_dgst.c
In file included from md2_dgst.c:62:
../../include/openssl/md2.h:64:2: #error MD2 is disabled.
make[2]: *** [md2_dgst.o] Error 1
make[2]: Leaving directory
Unfortunately I am not that good with Perl and could not provide constructive solution for the problem. The best would be to fix Perl itself but I do not think that will fly. So the next best thing would be the different means of checking if end of the list is reached.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 18 (8 by maintainers)
Commits related to this issue
- Merge pull request #174 from mpeylo/asn1-fixes Fix CMP ASN.1 definitions — committed to raja-ashok/openssl by Akretsch 5 years ago
- Resolve issue #173 (#174) — committed to mamckee/openssl by baentsch 4 years ago
Found a workaround (disable crlf for openssl repository):
git config core.autocrlf falsegit rm --cached -r .git reset --hardNow all files are without crlf line endings.
I have a per-repository setting on my Windows system which seems to work fine. From the checked out openssl repo:
git config --local core.autocrlf false git config --local core.eol lf
You probably need to refresh your files after doing that (make sure you don’t have any local uncommitted changes before doing this):
git rm --cached -r . git reset --hard
I also have my windows text editor (notepad++) set to only use lf not crlf.