meta-rust-bin icon indicating copy to clipboard operation
meta-rust-bin copied to clipboard

Build error when linking against an older glibc

Open otavio opened this issue 3 years ago • 6 comments

The PR #82 solved the linking error I had (issue #70) but using this layer on master has raised another issue:

| /home/otavio/src/updatehub/yocto/build/tmp/work/core2-64-oel-linux/updatehub/1.1.90-r0/target/release/build/proc-macro2-378cfb6b48440bd3/build-script-build: /usr/lib/libc.so.6: version `GLIBC_2.32' not found (required by /home/otavio/src/updatehub/yocto/build/tmp/work/core2-64-oel-linux/updatehub/1.1.90-r0/target/release/build/proc-macro2-378cfb6b48440bd3/build-script-build)

So, looking at the logs that seem to happen is that OE-Core has glibc 2.32 and my Arch Linux has the 2.31. I am out of ideas on how to address this.

It is important to mention that this happens with and without #82 applied. So this is not a regression.

otavio avatar Aug 21 '20 14:08 otavio

cargo build granularity only goes down to the arch tuple, thats the root cause

the build.rs is run by the host, but as per https://github.com/rust-embedded/meta-rust-bin/pull/82, the build.rs is now always linked for the target with the definition found in${CARGO_HOME}/config.

it looks like you want to compile this project : https://github.com/UpdateHub/updatehub/blob/master/updatehub/build.rs#L8 , if so: you could remove those rustc-env from the build script and have them passed on to the cargo class with an export

SRCREV="sha1"
S = "${WORKDIR}/git"

do_compile(){
 export RUST_TEST_THREADS=1
 export VERSION=${SRCREV}
 cargo fetch --manifest-path ${S}/Cargo.toml
 cargo_do_compile
}

this way you should be able to use https://github.com/rust-embedded/meta-rust-bin/pull/82 , with project that don't contains any build.rs

treymarc avatar Aug 22 '20 01:08 treymarc

Yes. In fact it fails if the host has older version. Upgrading the host "fixed" it.

otavio avatar Aug 24 '20 16:08 otavio

The fix is available as of rust 1.54.0 stable, you can enable it like this.

jameshilliard avatar Aug 18 '21 07:08 jameshilliard

@jameshilliard Am I missing something or doesn't this still require a nightly version of cargo? I understand it works with stable rustc, but it's still a problem to include nightly versions of cargo in meta-rust-bin.

nastevens avatar Aug 23 '21 20:08 nastevens

doesn't this still require a nightly version of cargo

Nope, works with stable cargo.

jameshilliard avatar Aug 23 '21 20:08 jameshilliard

Simpler way to use this on stable, just set this in your env when building:

__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly"
CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST="true"
CARGO_TARGET_APPLIES_TO_HOST="false"

jameshilliard avatar Jan 09 '22 09:01 jameshilliard