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

build-std feature build failed #10074

Closed
kolapapa opened this issue Nov 12, 2021 · 0 comments
Closed

build-std feature build failed #10074

kolapapa opened this issue Nov 12, 2021 · 0 comments
Labels
C-bug Category: bug

Comments

@kolapapa
Copy link

kolapapa commented Nov 12, 2021

Problem

Since Xargo is already under maintenance(japaric/xargo#193). I decided to use build-std feature of cargo to build mipsel-unknown-linux-uclibc target program.

But i got error adding symbols: File in wrong format error msg.

Steps

cargo new foo
cd foo
cargo +nightly run -Z build-std --target mipsel-unknown-linux-uclibc

Possible Solution(s)

No response

Notes

compile output:

$ cargo +nightly run -Z build-std --target mipsel-unknown-linux-uclibc

   Compiling compiler_builtins v0.1.49
   Compiling core v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.106
   Compiling cc v1.0.69
   Compiling memchr v2.4.1
   Compiling std v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling unwind v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.21
   Compiling rustc-std-workspace-alloc v1.99.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_unwind v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
   Compiling panic_abort v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling gimli v0.25.0
   Compiling std_detect v0.1.5 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling hashbrown v0.11.0
   Compiling object v0.26.2
   Compiling miniz_oxide v0.4.0
   Compiling addr2line v0.16.0
   Compiling proc_macro v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro)
   Compiling foo v0.1.0 (/data/rust_workspace/foo)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.1a4hzan68bep9j92.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.2wcqay994q6xs3pq.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.3c677fcjta18q4ji.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.3d7hpln6qz775wpx.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.41sy0j120dzq9mrs.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.oapiy4nro57lkxf.rcgu.o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.18i2tksk3sd0rbsn.rcgu.o" "-Wl,--as-needed" "-L" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps" "-L" "/data/rust_workspace/foo/target/debug/deps" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-uclibc/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libstd-80a9fa208615b079.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libpanic_unwind-a9529d069cfa8430.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libminiz_oxide-9110ed23ba82c8fb.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libadler-8b7c36eb314e1b14.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libobject-9cd82b4fef58947c.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libmemchr-2671be62cd28f2fb.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libaddr2line-2d376d430ceb1c77.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libgimli-a84b39347109dd0c.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libstd_detect-e6f3db2a819e293f.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/librustc_demangle-c09406e0402c70cc.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libhashbrown-ea33ec131448e881.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/librustc_std_workspace_alloc-227c25845399da55.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libunwind-a764a10c23167268.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libcfg_if-0cfe39d307a3356e.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/liblibc-4a2528752784f319.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/liballoc-c7d0dbbb21c1979a.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/librustc_std_workspace_core-6a374250bd5fc1d2.rlib" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libcore-1b6c7bfc8ca21d19.rlib" "-Wl,--end-group" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/libcompiler_builtins-a9323456d8f48396.rlib" "-Wl,-Bdynamic" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-lutil" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mipsel-unknown-linux-uclibc/lib" "-o" "/data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
  = note: /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /bin/ld: /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: Relocations in generic ELF (EM: 8)
          /data/rust_workspace/foo/target/mipsel-unknown-linux-uclibc/debug/deps/foo-0cba61ed1ec24885.114eeh9gtatzmrcl.rcgu.o: error adding symbols: File in wrong format
          collect2: error: ld returned 1 exit status


error: could not compile `foo` due to previous error

Version

# cargo version -v
cargo 1.58.0-nightly (2e2a16e98 2021-11-08)
release: 1.58.0
commit-hash: 2e2a16e983f597da62bc132eb191bc3276d4b1bb
commit-date: 2021-11-08
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.50+curl-7.79.1 vendored ssl:OpenSSL/1.1.1l)
os: CentOS 7.0.0 [64-bit]

Some env:
```shell
$ bat ~/.bashrc -pp

export STAGING_DIR=/data/openwrt/staging_dir
export PATH=$PATH:$STAGING_DIR/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/
export AR_mipsel_unknown_linux_uclibc=mipsel-openwrt-linux-uclibc-ar
export CC_mipsel_unknown_linux_uclibc=mipsel-openwrt-linux-uclibc-gcc
@kolapapa kolapapa added the C-bug Category: bug label Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant