-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Cannot link Rust (1.60+, ARM64) generated static-object with Go #97117
Comments
This looks very similar to #95926 which happened due to switching the linking default from |
2 similar comments
This looks very similar to #95926 which happened due to switching the linking default from |
This looks very similar to #95926 which happened due to switching the linking default from |
You could say that 3 times! |
The important things to say 3 times. |
I just tried reproducing this from the Dockerfile in the linked fork of |
Hello @wolffcm @petrochenkov @Titaniumtown @wllenyj, My apologies for the radio silence on this issue. I found that the root cause was musl-cross-make. musl still requires a patch to enable "static-pie". However, when I cross-compile musl (+patch) for x86_64 and aarch64, I can build and link a "static-pie" executable. I believe this can be closed as #95926 summaries the original issue. If anyone comes across this issue, follow the original build instructions, but on this branch for a demo of the fix. |
Hello!
I am working on a project that uses Rust's CFFI to expose functions/symbols to Go. It uses musl to compile for AMD64 and musl-cross-make for ARM64. I've enabled static-linkage for both Rust and Go; and I've enabled PIE for Go. Everything works when I build with the Rust 1.58 toolchain. However, when I build with 1.60/nightly, the linker generates this error:
This might not be an issue with Rust. I've tried several combinations of
RUSTFLAGS
to fix this, but I am unable to find the right combination. Since the issue isn't present in 1.58, however, I suspect it might be a compiler issue.Unfortunately, this is difficult to replicate without a project. I've forked rust-plus-golang which is a minimal example of Rust CFFI + Go. My fork includes a
docker
subdirectory. The Dockerfile can build the exact environment to replicate the issue. It should also be fairly trivial to switch between 1.58 and 1.60 by modifying that Dockerfile.To build the environment (from the root of the repository):
To build the executables (also from the root of the repository):
Please, let me know if there is anything else that I can provide/change!
Thanks!
Edit:
My apologies, I forgot to mention, that AMD64 builds on both 1.58 and 1.60. It's just ARM64 that is impacted.
The text was updated successfully, but these errors were encountered: