cross: x86_64-unknown-linux-gnu target generates GLIBC 2.18 symbols
Although GLIBC 2.15 is mentioned in the table the compiled binary contains multiple symbols from higher version:
GLIBC_2.18 __cxa_thread_atexit_impl GLIBC_2.17 secure_getenv
The command used is: cross build --target=x86_64-unknown-linux-gnu --release
I have tried earlier docker images as well: 0.1.15, 0.1.16, 0.2.0.
When I build the project directly under a Linux VM with an earlier GLIBC version it produces a correct binary.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 15 (7 by maintainers)
I hit the same or similar problem just now, I’m trying to cross-compile to raspbian stretch (raspberry pi).
My binary has C dependencies statically linked in using the cmake crate.
What I did was, take
Dockerfile.arm-unknown-linux-gnueabihf
and change the FROM line todebian:stretch
, thinking that would do it.ldd --version
shows GLIBC 2.24.The build works fine, but the binary it produces links to GLIBC 2.28 (which is installed on the host, debian buster).
Weirdly, I got the same problem by running rustup inside the container (the project is in a bind mount at
/project
) and then running cargo manually in the container. I don’t understand where it’s picking up the newer GLIBC from. Could docker somehow inject the wrong version for compatibility with the host?Dockerfile:
edit: removed
libc6-dev git
from the apt install command, as I tested and they are not needed. Same issue without them.Still seeing this after #501 when trying to build for RHEL 7 from MacOS – even with the alternative approach provided by @otavio:
Does this require a nightly toolchain and
xargo
? If so, that’s not working, either, for some reason I’ve been unable to diagnose:😞
We can prepare a PR for sure, assuming upstream wishes it.
If you look at the diff in commit https://github.com/OSSystems/rust-cross-images/commit/e665cee0c244cc1b6a23a8ae8d4f3c99f60dc7ff you’ll notice it is a little convoluted as we have to do some workarounds to allow the use with this old base system.
So to do the PR, we’d need to receive some direction on how it’d be better to approach this so we work in a way it’s likely to be accepted.
@Hoverbear in meantime you could use those images and get the builds going 😉
We finished it up and created two images, based on Debian 6.
You can use the
target.{{TARGET}}.image
field inCross.toml
to use our custom Docker images for a specific target:Refer to the table below for the
TARGET
andTAG
available combinations:test
i686-unknown-linux-gnu
i686-linux-compat-0.2.1
x86_64-unknown-linux-gnu
x86_64-linux-compat-0.2.1
aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-libarchive-0.2.1
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabihf-libarchive-0.2.1
Please see our README at https://github.com/OSSystems/rust-cross-images for more details and please feel free to provide fixes there if need.