Closed
Description
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 thelibmingwex.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 thislibmingwex.a
that we ship does not containstrtok_r
. - The linking step for Cargo fails because libcurl expected to find
strtok_r
inlibmingwex.a
, but the wronglibmingwex.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.