Open
Description
In 737ef08, the default value of static-libstdcpp
was changed from false
to true
. When statically linking libc++
on linux, this has a rather unfortunate cascade of effects:
- If
static-libstdcpp
is set to true, thenbootstrap/compile.rs
will askclang++
wherelibstdc++.a
is located. - For pure-LLVM toolchains, only
libc++.a
is provided andclang++
will unhelpfully return "libstdc++.a
".compile.rs
stores this inLLVM_STATIC_STDCPP
. rustc_llvm
's build script checks whetherLLVM_STATIC_STDCPP
is set. Seeing that it is, it addscargo:rustc-link-search=native=<PARENT_DIR>
to the command line where<PARENT_DIR>
is the directory containingLLVM_STATIC_STDCPP
.- Because there is no parent directory, this winds up adding
-L native=
, which triggers the error "empty search path given via-L
" inrustc_session/src/search_paths.rs
.
To get the behavior that we actually want, we need to fall into the case where LLVM_STATIC_STDCPP
is not defined, and instead add -stdlib=libc++
to cxxflags
. To do so, we have to set static-libstdcpp = false
in config.toml
. This is unintuitive behavior as it appears that we're disabling static linking entirely, but in reality we're just statically linking against libc++
instead of libstdc++
.