-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Regression: meson 0.53.0 cross compilation "Unable to determine dynamic linker" #6431
Comments
This check is bogus https://github.com/mesonbuild/meson/blob/master/mesonbuild/environment.py#L820
Which is not valid for gcc, setting This is what should run for such a test
|
Seconded. This broke a musl cross-compile on a glibc-based OS and I couldn't find a suitable workaround. Things I tried:
I would assume LD in the environment would override the linker guessing logic, but it doesn't appear to do so. This is somewhat ironic as I was actually attempting to compile C code to a static binary. Another assumption would be that Meson figured that I was using a cross-compiler as "native" and warned such, but still couldn't resolve a dynamic linker. None of this was workable on x86_64 -> x86_64 cross with musl compilers on CentOS 7. For giggles, I tried on ARM 32- and 64-bit glibc dists with musl compilers as well with the same results. Native (glibc or musl) compiles seem to work fine, or at least better, for a quick set of tests. Reverted to 0.52.1 as well until this is baked. |
@ryanwoodsmall thanks for the pointer, I thought I did not export LD in environment when cross compiling with meson,
Ok, lets see what meson does by adding a simple This is with `ld = 'x86_64-asusb450eg-linux-gnu-ld' in toolchain file, LD unexported:
This is with without
And it builds! So the key for cross compilation is to make sure LD is NOT exported and And AFAIK the fact that you can't have CC/CXX/LD variables exported while cross compiling with meson is not documented (if someone points me to the sentence where this is documented I'll happily stfu :) ) |
Seconded to this as well. Have something working now, but feel this is still somewhat underdocumented. Furthermore, precedence seems underspecified, i.e., environment vs. cross/native file vs command line vs... Tables at https://mesonbuild.com/Reference-tables.html#linker-ids mention ld.bfd but that didn't work for either
Working cross file looks like this:
Thanks for working through this and for pointers. Looks like I can now build ksh93 (from https://github.com/att/ast) with compilers built from musl-cross-make (https://github.com/richfelker/musl-cross-make) w/Meson 0.53.0. |
Yep I had to unexport everything too:
Quote from https://mesonbuild.com/Overview.html
Yep, totally |
See if #6436 fixes this. |
I experienced the same problem when updating to Meson 0.53.0 and I agree that documentation for this can be better. In my project I cross compile for ARM where I have the following linker binaries on my Linux machine:
Setting any of these binaries in my cross file resulted in the "Unable to determine dynamic linker" error. Eventually it was by trial and error that I found the correct setting should be To me it would make sense that I can explicitly set the linker binary e.g.
|
@jameshilliard that will work around the issue, but it does seem like we might also want a way to set the To clarify, right now I use |
@jmesmon Yeah, might be a good idea to do that as well(I'll let someone else figure that out if it's important for them), the |
0.53.0 crashes with 'Unable to determine dynamic linker'
Closing in favor of #6442, which is mean to find a solution to all of the linker stuff. |
|
Seems mesonbuild/meson#6431 has some berin as it fixed the configure failing.
Describe the bug
I get "Unable to determine dynamic linker" when trying to cross compile for example dav1d.
To Reproduce
Try cross compiling dav1d https://code.videolan.org/videolan/dav1d/blob/master/meson.build
Expected behavior
The build succeeds as it it did with 0.52.x
Adding ld = 'ld-binary" did not help
Disregard that this is x86_64 to x86_64 cross compilation, toolchain is different and cross is needed to keep host and target environments apart.
system parameters
Edit:
Same happens when building systemd or any other project using meson.
Reverted to 0.52.1.
Suggest reverting ld nonsense and test cross compilation more thoroughly.
The text was updated successfully, but these errors were encountered: