Skip to content

Wrong loader path for HOST and TARGET as same architecture #56

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

Closed
otavio opened this issue Aug 9, 2019 · 8 comments · Fixed by #58
Closed

Wrong loader path for HOST and TARGET as same architecture #56

otavio opened this issue Aug 9, 2019 · 8 comments · Fixed by #58

Comments

@otavio
Copy link
Contributor

otavio commented Aug 9, 2019

When building for an x86-64 using an x86-64 host, our binary ends with:

        linux-vdso.so.1 (0x00007ffd4007c000)
        libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f0146de9000)
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f0146b2c000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f0146b27000)
        librt.so.1 => /lib/librt.so.1 (0x00007f0146b1c000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f0146afc000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f0146ae1000)
        libc.so.6 => /lib/libc.so.6 (0x00007f0146929000)
        libm.so.6 => /lib/libm.so.6 (0x00007f01467e6000)
        .../tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f0147338000)

So when running the binary it fails to find the loader and dies badly.

@nastevens
Copy link
Member

To double-check - this was resolved by your PR #55 correct?

@otavio
Copy link
Contributor Author

otavio commented Aug 10, 2019

In fact, no.

It still links wrong. Any idea where to look at?

@nastevens
Copy link
Member

My guess is that this is caused by the native wrapper script being used for both native and target compilation. I believe native compilation gets some different options so that it links to Yocto-local copies of libraries.

Do you get the same thing if the linker-wrapper.sh (versus the linker-wrapper-native.sh) script is used for native and target compilation if the host and target are the same? This would sort of be reversing what's being done here. This would potentially mess up native compiling (i.e. build.rs files in dependency crates) but would probably fix the libraries.

If it doesn't work using the target wrapper script his could be a much deeper issue. As far as I know there's not an existing way to specify "use this linker for build scripts" and "use this linker for the final binary" in cargo.

@nicolaiunrein
Copy link

Fighting with meta-rust for a while I found your layer and absolutely prefer it over meta-rust. The only problem is that I am running into the same linker issue. I also tried @OtavioS fork but it seems to be the same. Have you found any workarounds yet?

@otavio
Copy link
Contributor Author

otavio commented Dec 19, 2019

Did this not work for you?

@nicolaiunrein
Copy link

I just realized your commit is not in your master branch. Stupid question: how do I get to it?

@allsey87
Copy link

allsey87 commented Mar 9, 2021

@otavio and @nicolaiunrein, could you give a bit more detail on your final work around/solution to this problem?

@nastevens
Copy link
Member

For anyone coming to this - see #97. This is currently blocked by changes to the Rust compiler itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants