ocaml / flexdll

a dlopen-like API for Windows
Other
100 stars 30 forks source link

mingw64 (and presumably mingw) fails on French-language Windows 10 #42

Open damiendoligez opened 7 years ago

damiendoligez commented 7 years ago

This is the output of x86_64-w64-mingw32-gcc -print-search-dirs on a French-configured windows 10:

installés: /usr/lib/gcc/x86_64-w64-mingw32/5.4.0/
programmes : =/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/
libraries : =/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/../lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/x86_64-w64-mingw32/5.4.0/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/

flexlink fails to parse it because of the space between libraries and :

I don't know who had the bright idea of localizing this part of gcc but it looks like you'll need to adapt.

dra27 commented 7 years ago

When did that change?! While adapting to the space will fix French, we're only succeeding because the French and English word happen to be the same...

alainfrisch commented 7 years ago

libraries is not a French word, so they managed to screw up the translation. German translator did a better job:

$ LANG=fr_FR  x86_64-w64-mingw32-gcc -print-search-dirs | grep sys-root
libraries : =/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/../lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/x86_64-w64-mingw32/5.4.0/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/

~
$ LANG=de_DE  x86_64-w64-mingw32-gcc -print-search-dirs | grep sys-root
Bibliotheken: =/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/../lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/x86_64-w64-mingw32/5.4.0/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/

@damiendoligez @dra27 Do you believe that setting LANG before calling gcc -print-search-dirs would be a good approach? Or to hard-code parsing the third line of result (after '=')?

damiendoligez commented 7 years ago

I think setting LC_ALL would be best. Hard-coding the line seems really brittle.

damiendoligez commented 7 years ago

BTW I just tested again on an updated Windows and now I get this:

bibliothèques: =/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/...

With LC_ALL=C I get the expected message (in English).

dra27 commented 7 years ago

Definitely the LC_ALL solution - unless gcc has a more reliable way of getting the exact answer we're after?