-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Statically linking libc++
requires disabling static-libstdcpp
#94983
Comments
+1, was affected by the "empty search path" bug when trying to build stage1 from a clean centos8. Was overwhelmingly unclear that I needed to install |
Huh, yeah, that definitely does seem weird. I wonder where the right place to fix this is though. It does feel like |
This has become more visible now that 1.61.0 has been released. 1.61.0 no longer builds on pure LLVM systems with libc++, even if
My initial thought is the opposite. The name |
I'm not able to build 1.61.0 on Solaris now. There is no libstdc++.a bundled with Solaris GCC. And there is also no libc++. Any suggestion? |
My issue was already reported here: #97260 (including working patch file). |
@jonhoo do you have time to follow-up on this? It seems like a reasonable fix but I'm not familiar with the difference between |
I probably won't have a chance to get to this for a week or two unfortunately. I think I agree with the more recent discussion now though in that we should just fix step 3 from OP's post so that if the parent directory is empty we don't add it to |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Given my recent change of jobs, I probably won't have a chance to pick this up again. Sorry about that! I still think the proposed fix is the way to go though! |
In 737ef08, the default value of
static-libstdcpp
was changed fromfalse
totrue
. When statically linkinglibc++
on linux, this has a rather unfortunate cascade of effects:static-libstdcpp
is set to true, thenbootstrap/compile.rs
will askclang++
wherelibstdc++.a
is located.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
.-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++
tocxxflags
. To do so, we have to setstatic-libstdcpp = false
inconfig.toml
. This is unintuitive behavior as it appears that we're disabling static linking entirely, but in reality we're just statically linking againstlibc++
instead oflibstdc++
.The text was updated successfully, but these errors were encountered: