-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustArea: Makes things more difficult for new or seasoned contributors to RustA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesP-mediumMedium priorityMedium priorityT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
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-libstdcppis set to true, thenbootstrap/compile.rswill askclang++wherelibstdc++.ais located. - For pure-LLVM toolchains, only
libc++.ais provided andclang++will unhelpfully return "libstdc++.a".compile.rsstores this inLLVM_STATIC_STDCPP. rustc_llvm's build script checks whetherLLVM_STATIC_STDCPPis 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++.
mati865, jonhoo, jmaargh, GeorgeAverkin and RinCat
Metadata
Metadata
Assignees
Labels
A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustArea: Makes things more difficult for new or seasoned contributors to RustA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesP-mediumMedium priorityMedium priorityT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.