I have just run into a problem when building Cargo that looks like as follows:
- Cargo relies on a number of libraries from the MinGW installation, so when it downloads a Rust snapshot compiler we delete the
gcc.exe in the distribution.
- On Windows, we build libcurl from source using a checked in configure script. This configure script runs against the system gcc.
- The libcurl configure script detects that
strtok_r is available on the local system in the libmingwex.a library in the /mingw64/x86_64-w64-mingw32/lib directory. The configure script detects this by running the system gcc against a test file.
- When Cargo itself is linked together it uses the system gcc again, but this time it has a
-L flag to the directory where all the Rust bundled gcc libraries are.
- It turns out that Rust ships a
libmingwex.a, and this used instead of the /mingw64 one. It also turns out that this libmingwex.a that we ship does not contain strtok_r.
- The linking step for Cargo fails because libcurl expected to find
strtok_r in libmingwex.a, but the wrong libmingwex.a was linked in so the symbol was ultimately undefined.
I think we may want an installation option for Rust which opts out of installing the bundled gcc compiler (but we still do it by default) to solve this. cc @vadimcn, @brson.
I have just run into a problem when building Cargo that looks like as follows:
gcc.exein the distribution.strtok_ris available on the local system in thelibmingwex.alibrary in the/mingw64/x86_64-w64-mingw32/libdirectory. The configure script detects this by running the system gcc against a test file.-Lflag to the directory where all the Rust bundled gcc libraries are.libmingwex.a, and this used instead of the/mingw64one. It also turns out that thislibmingwex.athat we ship does not containstrtok_r.strtok_rinlibmingwex.a, but the wronglibmingwex.awas linked in so the symbol was ultimately undefined.I think we may want an installation option for Rust which opts out of installing the bundled gcc compiler (but we still do it by default) to solve this. cc @vadimcn, @brson.