openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
4k stars 3.48k forks source link

lang/rust/host/compile failed to build for aarch64+glibc target on aarch64 host #23519

Open njhsi opened 8 months ago

njhsi commented 8 months ago

@ jefferyto openwrt sources: master branch, latest commit build host: MacBook Air m1(arm64), debian-slim of docker container in a vm, gcc 12.2.0 with libstdc++.so.6.30 target: mvebu/cortexa72, aarch64. glibc 2.38, gcc-13.2.0

Using musl as libc has no problem for all lang/rust packages. Changing to glibc as libc, failed. Seems it used HOSTCC(12.2.0/glibcxx 30) as linker but trying to linking TARGET's libstdc++.so.32. As host and target are both aarch64, so the rust build scripts trying to build ['aarch64-unknown-linux-gnu','aarch64-unknown-linux-gnu' ] the two are the same named. would it make any conflicts on choosing CC and LINKER and libs such as libstdc++.so?

make[2]: Entering directory '/build/feeds/packages/lang/rust'
CARGO_HOME=/build/dl/cargo TARGET_CFLAGS="-O2 -pipe -mcpu=cortex-a72+crypto -mtune=cortex-a72 -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/build/build_dir/target-aarch64_cortex-a72_glibc/rust-1.75.0=rust-1.75.0 -flto=auto -fno-fat-lto-objects -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,relro" OPENWRT_RUSTC_BOOTSTRAP_CACHE=/build/dl/rustc python3 /build/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/x.py --build-dir /build/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/build --config /build/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/config.toml dist build-manifest cargo llvm-tools rustc rust-std rust-src
Building bootstrap
    Finished dev [unoptimized] target(s) in 0.08s
Building stage0 library artifacts (aarch64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.18s
Building compiler artifacts (stage0 -> stage1, aarch64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.29s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts (aarch64-unknown-linux-gnu)
error: process didn't exit successfully: `/b/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/build/bootstrap/debug/rustc -vV` (exit status: 1)
--- stderr
/build/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/build/aarch64-unknown-linux-gnu/stage1/bin/rustc: /lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /b/build_dir/target-aarch64_cortex-a72_glibc/host/rustc-1.75.0-src/build/aarch64-unknown-linux-gnu/stage1/bin/../lib/librustc_driver-08d1e429f0d4d73a.so)
brada4 commented 8 months ago

Any libpath overrides in env?