-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
rust: Fix linking with C libraries in subdir #12485
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
Conversation
2b23c3d to
f469bd4
Compare
|
This fixes the Mesa build with Meson 1.3.0rc2. |
251ef35 to
b427ef9
Compare
55c1352 to
b3aae77
Compare
5244308 to
c254af1
Compare
CustomTarget and CustomTargetIndex often have to be special cased because they are not subclass of BuildTarget. It's easier to introduce a dummy base class. This fix recursive functions over link targets that might encouters libraries built as CustomTarget.
2ba6dc4 to
5170ef3
Compare
Pass link arguments directly down to linker by using `-C link-args=` instead of letting rustc/linker resolve `-l` arguments. This solves problems with e.g. +verbatim not being portable. Note that we also pass `-l` args as `-Clink-args=-l` because rustc would otherwise reorder arguments and put `-lstdc++` before `-Clink-args=libfoo++.a`. However, when building a rlib/staticlib we should still use `-l` arguments because that allows rustc to bundle static libraries we link-whole. In that case, since there is no platform specific dynamic linker, +verbatim works. This also fix installed staticlib that now bundle uninstalled static libraries it links to (recursively). This is done by putting them all into self.link_whole_targets instead of putting their objects into self.objects, and let rustc do the bundling. This has the extra advantage that rustc can bundle static libries built with CustomTarget. Disable bundling in all other cases, otherwise we could end up with duplicated objects in static libraries, in diamond dependency graph case. Fixes: mesonbuild#12484
CompilerArgs would otherwise dedup and reorder them.
714d782 to
bd99f0b
Compare
|
It this now ready for merging? |
|
Yes |
|
Fails when building under Debian Sid pbuilder: One of the error messages: |
|
That looks like the rust linker is not correctly handling system linking the way the system linker does, and neglects to load e.g. |
|
@jpakkane It's weird, none of the flag |
|
Presumably https://packages.debian.org/source/sid/rustc |
|
I tried running |
|
I tried that also now, but in this case test 13 fails. Rerunning the full packaging test. |
|
BTW this is on 32 bit x86, not x64. |
-l static=expects a filename and not a relative path, rustc already has-Lflags to find the library. Weirdly passing a path to-l dylib=works fine, but better never do it.Fixes: #12484