mono / CppSharp

Tools and libraries to glue C/C++ APIs to high-level languages
MIT License
3.15k stars 518 forks source link

GetUnixCompilerInfo fails on LANG=de_DE.UTF8 #1856

Open matthiasbeyer opened 4 months ago

matthiasbeyer commented 4 months ago

https://github.com/mono/CppSharp/blob/b658ff32f126ecde6fb56d36558d42af7a518c04/src/Parser/ParserOptions.cs#L193-L235

This function fails to find the GCC compiler on my system with my normal LANG=de_DE.UTF8, but succeeds if I export LANG=C before running the relevant code.

Unfortunately the Code running this is proprietary, so I cannot share more about it, but it is literally:

$ ./myCode # fails
$ export LANG=C
$ ./myCode # succeeds
matthiasbeyer commented 4 months ago

I found the actual issue.

You re-used your error message in the function, so I assumed that the first exception is thrown, when it is actually the second one.

And the regex just does not match, because with german locale, "version" is written "Version" in the compiler output of gcc -v.