Skip to content
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

glibc version not new enough to compile crates that use error-chain crate as a dependency #39

Open
shaunmulligan opened this issue Jan 5, 2017 · 4 comments

Comments

@shaunmulligan
Copy link

commented Jan 5, 2017

I'm trying to use error-chain in one of my project with cross, but it seems that the version of glibc in the ubuntu 12.04 base images is not sufficient for one of the error-chain dependencies called backtrace. Is there a specific reason for the Dockerfiles to base off of ubuntu 12.04 or can they be upgraded to 14.04 or 16.04?

This is the error I currently get:

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `backtrace v0.3.0`
process didn't exit successfully: `/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build` (exit code: 1)
--- stderr
/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.17' not found (required by /target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build)
/target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.18' not found (required by /target/debug/build/backtrace-4d922e79d0b3f0f4/build-script-build)
@shaunmulligan

This comment has been minimized.

Copy link
Author

commented Jan 5, 2017

upgrading the docker base to ubuntu:14.04 and setting all the curl calls to use --insecure (I know its a bad idea 😄 ) seems to have done the trick and I can now use error-chain 👍

@japaric

This comment has been minimized.

Copy link
Member

commented Jan 5, 2017

Actually, I think this is not a problem specific to the error-chain crate but with any crate that involves build scripts. The problem is that Cargo caches and shares the build scripts (the executables) across the different cross compilation target directories, which is actually a good thing but causes problems when combined with several cross environments.

To illustrate:

$ cargo new --bin foo && cd $_
$ cargo add error-chain
$ cross build --target x86_64-unknown-linux-gnu
$ cross build --target mips-unknown-linux-gnu

Here the build script was compiled within the x86_64 environment and was linked to glibc-2.15. Then the second cross build reuses that build script. No problem because the mips environment contains glibc-2.23. However, if you swap the commands

$ cargo clean
$ cross build --target mips-unknown-linux-gnu
$ cross build --target x86_64-unknown-linux-gnu

Here the build script was compiled on the mips environment and it's linked to glibc-2.23. Then the second cross build reuses that build script but it runs it inside an environment that only has glibc-2.15. That's what causes problems with undefined symbols.

@japaric

This comment has been minimized.

Copy link
Member

commented Jan 5, 2017

The workaround is to cargo clean if you are going to use several cross environment in a single Cargo project. rm **/build-script-build may do the trick as well. That or order your cross build commands to build the build scripts against the environment with the oldest glibc.

@gnunicorn

This comment has been minimized.

Copy link

commented Feb 21, 2017

Ran into the same issue running trust (see link above). Adding cargo clean before running cross build appears to fix it.

gnunicorn added a commit to gnunicorn/trust that referenced this issue Feb 21, 2017
Run `cargo clean` before building for target
Using cross with build scripts breaks sometimes, see rust-embedded/cross#39 . By cleaning first, we ensure we don't fail because of reusing build-scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.