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

Unable to -Zbuild-std for mips-unknown-linux-musl #1416

Open
4 of 11 tasks
wcampbell0x2a opened this issue Jan 14, 2024 · 20 comments
Open
4 of 11 tasks

Unable to -Zbuild-std for mips-unknown-linux-musl #1416

wcampbell0x2a opened this issue Jan 14, 2024 · 20 comments
Labels
A-mips Area: MIPS targets A-musl Area: musl libc targets

Comments

@wcampbell0x2a
Copy link

Checklist

Describe your issue

The following MR adds statically included libc for several architectures. However, mips-unknown-linux-musl fails. https://github.com/wcampbell0x2a/mempeek/actions/runs/7520357008/job/20469941084?pr=2

Since mips-unknown-linux-musl is target tier 3 now, I need to build-std.

Version:
cross v0.2.5

Command:
cross build --bin mempeek --locked --release --target mips-unknown-linux-musl -Zbuild-std

error: linking with `mips-linux-muslsf-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/rust/bin" VSLANG="1033" "mips-linux-muslsf-gcc" "crt1.o" "crti.o" "crtbegin.o" "/tmp/rustcORb1Yb/symbols.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.00.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.01.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.02.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.03.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.04.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.05.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.06.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.07.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.08.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.09.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.10.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.mempeek.cb0fcbdab1503788-cgu.11.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520.22p001b4eltzaxks.rcgu.o" "-Wl,--as-needed" "-L" "/target/mips-unknown-linux-musl/release/deps" "-L" "/target/release/deps" "-L" "/rust/lib/rustlib/mips-unknown-linux-musl/lib" "-Wl,-Bstatic" "/target/mips-unknown-linux-musl/release/deps/libquoted_strings-d0f7468ea21ee5e8.rlib" "/target/mips-unknown-linux-musl/release/deps/librustyline-8d5ec96c0c5a11b9.rlib" "/target/mips-unknown-linux-musl/release/deps/libutf8parse-116927d326bc5750.rlib" "/target/mips-unknown-linux-musl/release/deps/libnix-b11796db79f37076.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemoffset-b593169c600c71e2.rlib" "/target/mips-unknown-linux-musl/release/deps/libfd_lock-e02faa0ecf1b0bc6.rlib" "/target/mips-unknown-linux-musl/release/deps/librustix-c4d423c9bdd8bf47.rlib" "/target/mips-unknown-linux-musl/release/deps/libbitflags-967a321434d6edf1.rlib" "/target/mips-unknown-linux-musl/release/deps/liberrno-387d32a6920e45a1.rlib" "/target/mips-unknown-linux-musl/release/deps/libio_lifetimes-dd07bdae668d8529.rlib" "/target/mips-unknown-linux-musl/release/deps/libunicode_width-c11476c577bbe7d3.rlib" "/target/mips-unknown-linux-musl/release/deps/libunicode_segmentation-0c0b9d7ad08d7166.rlib" "/target/mips-unknown-linux-musl/release/deps/liblog-8a6ceab12c90a0cf.rlib" "/target/mips-unknown-linux-musl/release/deps/libdirs_next-c3b4127a1234641a.rlib" "/target/mips-unknown-linux-musl/release/deps/libdirs_sys_next-a34ae8bc8b7a5176.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibc-1c580d9222d5ced3.rlib" "/target/mips-unknown-linux-musl/release/deps/libcfg_if-9e496e9a88cd5040.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemchr-373fc5b133a94e81.rlib" "/target/mips-unknown-linux-musl/release/deps/libradix_trie-f9f4c5420bf758e6.rlib" "/target/mips-unknown-linux-musl/release/deps/libnibble_vec-81cb618471c07e05.rlib" "/target/mips-unknown-linux-musl/release/deps/libsmallvec-f01018e62d2d9fcc.rlib" "/target/mips-unknown-linux-musl/release/deps/libendian_type-c0a46cee52b1194a.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibprocmem-91c2ece298acb062.rlib" "/target/mips-unknown-linux-musl/release/deps/libstd-9e3dd2996d76e236.rlib" "/target/mips-unknown-linux-musl/release/deps/libpanic_unwind-05fd62e2e5190058.rlib" "/target/mips-unknown-linux-musl/release/deps/libobject-8391a6a9760f69cd.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemchr-9e8b26be85743ca9.rlib" "/target/mips-unknown-linux-musl/release/deps/libaddr2line-9fc891e3078cdc2a.rlib" "/target/mips-unknown-linux-musl/release/deps/libgimli-7c8c86c3c6a9ff9c.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_demangle-b4741a36dad37b6e.rlib" "/target/mips-unknown-linux-musl/release/deps/libstd_detect-898216c412661c60.rlib" "/target/mips-unknown-linux-musl/release/deps/libhashbrown-3b1455342d317d65.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_alloc-efdeaa4e8a01e067.rlib" "/target/mips-unknown-linux-musl/release/deps/libminiz_oxide-372077df760e62cf.rlib" "/target/mips-unknown-linux-musl/release/deps/libadler-e4f425e32ffb9ae3.rlib" "/target/mips-unknown-linux-musl/release/deps/libunwind-48cdaf50d0a1124e.rlib" "-lunwind" "/target/mips-unknown-linux-musl/release/deps/libcfg_if-8fe4a3fea3e9034a.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibc-658ba3268e14df43.rlib" "-lc" "/target/mips-unknown-linux-musl/release/deps/liballoc-d70651e200e8d582.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_core-d53f8587ae739f1d.rlib" "/target/mips-unknown-linux-musl/release/deps/libcore-eb1dd64dfba6dbf7.rlib" "/target/mips-unknown-linux-musl/release/deps/libcompiler_builtins-9edbe9ff1b935c24.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/rust/lib/rustlib/mips-unknown-linux-musl/lib" "-L" "/rust/lib/rustlib/mips-unknown-linux-musl/lib/self-contained" "-o" "/target/mips-unknown-linux-musl/release/deps/mempeek-557b2e1c2d7bb520" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "crtend.o" "crtn.o"
  = note: mips-linux-muslsf-gcc: error: crt1.o: No such file or directory
          mips-linux-muslsf-gcc: error: crti.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtbegin.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtend.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtn.o: No such file or directory

What target(s) are you cross-compiling for?

mips-unknown-linux-musl

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross v0.2.5`

Example

No response

Additional information / notes

No response

@Emilgardis Emilgardis added the A-mips Area: MIPS targets label Jan 14, 2024
@Emilgardis
Copy link
Member

Can you try using a new image for mips? Either update cross to the lastest version on main cargo install cross --git https://github.com/cross-rs/cross or set in Cross.toml

[target.mips-unknown-linux-musl]
image = "ghcr.io/cross-rs/mips-unknown-linux-musl:main"

I know though there's still problems with this target, see
https://github.com/cross-rs/cross/actions/runs/7471174056/job/20331075105#step:12:1937

@Emilgardis Emilgardis added the A-musl Area: musl libc targets label Jan 14, 2024
@wcampbell0x2a
Copy link
Author

I tried both of those solutions, same results of failure.

@Emilgardis
Copy link
Member

Same result as in mips-linux-muslsf-gcc: error: crt1.o: No such file or directory or same error as in ci?

= note: /usr/local/bin/../lib/gcc/mips-linux-muslsf/9.2.0/../../../../mips-linux-muslsf/bin/ld: /target/mips-unknown-linux-musl/debug/deps/libcompiler_builtins-5984e36b897ba13b.rlib(compiler_builtins-5984e36b897ba13b.compiler_builtins.e5ba7d578a050404-cgu.1.rcgu.o): in function `__eqsf2':
          /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.104/src/macros.rs:499: multiple definition of `__eqsf2'; /usr/local/bin/../lib/gcc/mips-linux-muslsf/9.2.0/libgcc.a(eqsf2.o):/tmp/tmp.hqQUeDwZIe/build/local/mips-linux-muslsf/obj_gcc/mips-linux-muslsf/libgcc/../../../src_gcc/libgcc/soft-fp/eqsf2.c:43: first defined here
          /usr/local/bin/../lib/gcc/mips-linux-muslsf/9.2.0/../../../../mips-linux-muslsf/bin/ld: /target/mips-unknown-linux-musl/debug/deps/libcompiler_builtins-5984e36b897ba13b.rlib(compiler_builtins-5984e36b897ba13b.compiler_builtins.e5ba7d578a050404-cgu.1.rcgu.o): in function `__nesf2':
          /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.104/src/macros.rs:499: multiple definition of `__nesf2'; /usr/local/bin/../lib/gcc/mips-linux-muslsf/9.2.0/libgcc.a(eqsf2.o):/tmp/tmp.hqQUeDwZIe/build/local/mips-linux-muslsf/obj_gcc/mips-linux-muslsf/libgcc/../../../src_gcc/libgcc/soft-fp/eqsf2.c:43: first defined here

@wcampbell0x2a
Copy link
Author

Looks like the same as my CI:

$ cross --version
cross 0.2.5 (e2e643f 2024-01-10)


mempeek $ cross build --bin mempeek --locked --release --target mips-unknown-linux-musl -Zbuild-std="core,std,alloc,proc_macro"
   Compiling mempeek v0.1.5 (/home/wcampbell/projects/wcampbell/mempeek)
error: linking with `mips-linux-muslsf-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "mips-linux-muslsf-gcc" "crt1.o" "crti.o" "crtbegin.o" "/tmp/rustcoxFHCI/symbols.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.00.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.01.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.02.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.03.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.04.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.05.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.06.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.07.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.08.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.09.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.10.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.11.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.12.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.13.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.14.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.mempeek.eb8aafbaa805f415-cgu.15.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e.lzxto9loas2o49g.rcgu.o" "-Wl,--as-needed" "-L" "/target/mips-unknown-linux-musl/release/deps" "-L" "/target/release/deps" "-L" "/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib" "-Wl,-Bstatic" "/target/mips-unknown-linux-musl/release/deps/libquoted_strings-3f86821f8a8959fe.rlib" "/target/mips-unknown-linux-musl/release/deps/librustyline-378c1c66d333741c.rlib" "/target/mips-unknown-linux-musl/release/deps/libutf8parse-83d7e491fb0cb295.rlib" "/target/mips-unknown-linux-musl/release/deps/libnix-207524889cb89a3f.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemoffset-9a4c08e4886d4718.rlib" "/target/mips-unknown-linux-musl/release/deps/libfd_lock-9f9725d40468a2d0.rlib" "/target/mips-unknown-linux-musl/release/deps/librustix-60af2a09a8d0c598.rlib" "/target/mips-unknown-linux-musl/release/deps/libbitflags-129a40469095dd0a.rlib" "/target/mips-unknown-linux-musl/release/deps/liberrno-feaf35900d00509b.rlib" "/target/mips-unknown-linux-musl/release/deps/libio_lifetimes-2e320dc96f5b2d7e.rlib" "/target/mips-unknown-linux-musl/release/deps/libunicode_width-0ca943d63306d7f5.rlib" "/target/mips-unknown-linux-musl/release/deps/libunicode_segmentation-3adf39730347a365.rlib" "/target/mips-unknown-linux-musl/release/deps/liblog-579bf58d67f56ed4.rlib" "/target/mips-unknown-linux-musl/release/deps/libdirs_next-f24f1ab1163baa46.rlib" "/target/mips-unknown-linux-musl/release/deps/libdirs_sys_next-f006918deb1f6c0c.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibc-2041180cef049d2d.rlib" "/target/mips-unknown-linux-musl/release/deps/libcfg_if-42b4425ad61394e1.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemchr-2abc50572e454ae3.rlib" "/target/mips-unknown-linux-musl/release/deps/libradix_trie-f547380a27ae3125.rlib" "/target/mips-unknown-linux-musl/release/deps/libnibble_vec-a930a0492201b84b.rlib" "/target/mips-unknown-linux-musl/release/deps/libsmallvec-e06960e6742d9c31.rlib" "/target/mips-unknown-linux-musl/release/deps/libendian_type-ba6e88f33e99f9ab.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibprocmem-94704556afa87dc4.rlib" "/target/mips-unknown-linux-musl/release/deps/libstd-09cb161c533af38b.rlib" "/target/mips-unknown-linux-musl/release/deps/libpanic_unwind-0ffefa605ea2384c.rlib" "/target/mips-unknown-linux-musl/release/deps/libobject-a263cda1a69d5af5.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemchr-35d1d4fef25e3a3c.rlib" "/target/mips-unknown-linux-musl/release/deps/libaddr2line-938f3c4c53330738.rlib" "/target/mips-unknown-linux-musl/release/deps/libgimli-6b65f0b4ec65e137.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_demangle-cb4575a6875d0421.rlib" "/target/mips-unknown-linux-musl/release/deps/libstd_detect-0b5b2e46ac73f8d5.rlib" "/target/mips-unknown-linux-musl/release/deps/libhashbrown-69470548e07bae13.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_alloc-2acd7e950e47a5bd.rlib" "/target/mips-unknown-linux-musl/release/deps/libminiz_oxide-0cea573322e1ae8e.rlib" "/target/mips-unknown-linux-musl/release/deps/libadler-ffb87f3f8c9f514f.rlib" "/target/mips-unknown-linux-musl/release/deps/libunwind-1c6cc2142b587572.rlib" "-lunwind" "/target/mips-unknown-linux-musl/release/deps/libcfg_if-06bd90eedb920945.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibc-dc31e85c2946525a.rlib" "-lc" "/target/mips-unknown-linux-musl/release/deps/liballoc-8fbbe3b681f94a44.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_core-c8bf80c75c411f7c.rlib" "/target/mips-unknown-linux-musl/release/deps/libcore-dd7041a17180d666.rlib" "/target/mips-unknown-linux-musl/release/deps/libcompiler_builtins-208b7daed09b840d.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib" "-L" "/home/wcampbell/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib/self-contained" "-o" "/target/mips-unknown-linux-musl/release/deps/mempeek-09c19145e6a1850e" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "crtend.o" "crtn.o"
  = note: mips-linux-muslsf-gcc: error: crt1.o: No such file or directory
          mips-linux-muslsf-gcc: error: crti.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtbegin.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtend.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtn.o: No such file or directory


error: could not compile `mempeek` (bin "mempeek") due to 1 previous error
[cross] warning: rust-std is not available for mips-unknown-linux-musl
[cross] note: you may need to build components for the target via `-Z build-std=<components>` or in your cross configuration specify `target.mips-unknown-linux-musl.build-std`
              the available components are core, std, alloc, and proc_macro

@arun11299
Copy link

arun11299 commented Feb 2, 2024

I am also running into same issue when trying to cross compile it for my openwrt device.

error: linking with `mips-linux-muslsf-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "mips-linux-muslsf-gcc" "crt1.o" "crti.o" "crtbegin.o" "/tmp/rustcFzFyhp/symbols.o" "/target/mips-unknown-linux-musl/release/deps/test_wrt-de74074d5f84b58c.test_wrt.8fbfe36ca492038d-cgu.0.rcgu.o" "/target/mips-unknown-linux-musl/release/deps/test_wrt-de74074d5f84b58c.1hsjzlnf4f8owh2u.rcgu.o" "-Wl,--as-needed" "-L" "/target/mips-unknown-linux-musl/release/deps" "-L" "/target/release/deps" "-L" "/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib" "-Wl,-Bstatic" "/target/mips-unknown-linux-musl/release/deps/libstd-d5c64276843dfe37.rlib" "/target/mips-unknown-linux-musl/release/deps/libpanic_unwind-60d01f6b11b67240.rlib" "/target/mips-unknown-linux-musl/release/deps/libobject-d4b33dcc73d270e4.rlib" "/target/mips-unknown-linux-musl/release/deps/libmemchr-520036fe5adde890.rlib" "/target/mips-unknown-linux-musl/release/deps/libaddr2line-dc19538d65c979d2.rlib" "/target/mips-unknown-linux-musl/release/deps/libgimli-e00ca22af3b264c0.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_demangle-bdf20ae0bd97cbcc.rlib" "/target/mips-unknown-linux-musl/release/deps/libstd_detect-16ba25a5d9c13c3f.rlib" "/target/mips-unknown-linux-musl/release/deps/libhashbrown-b60de9ae54848274.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_alloc-5203b17a7a9aebad.rlib" "/target/mips-unknown-linux-musl/release/deps/libminiz_oxide-5813d47b8d767f45.rlib" "/target/mips-unknown-linux-musl/release/deps/libadler-4d90d5fd973398d8.rlib" "/target/mips-unknown-linux-musl/release/deps/libunwind-00f00316dad21909.rlib" "-lunwind" "/target/mips-unknown-linux-musl/release/deps/libcfg_if-71dcb19bddccc362.rlib" "/target/mips-unknown-linux-musl/release/deps/liblibc-fb81f75cafb8d66f.rlib" "-lc" "/target/mips-unknown-linux-musl/release/deps/liballoc-cf3584c6d8ef97f5.rlib" "/target/mips-unknown-linux-musl/release/deps/librustc_std_workspace_core-75c02c6cc8e31626.rlib" "/target/mips-unknown-linux-musl/release/deps/libcore-322e11f2fef198b6.rlib" "/target/mips-unknown-linux-musl/release/deps/libcompiler_builtins-16a4b04de4f12b22.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib" "-L" "/home/arun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-musl/lib/self-contained" "-o" "/target/mips-unknown-linux-musl/release/deps/test_wrt-de74074d5f84b58c" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-s" "crtend.o" "crtn.o"
  = note: mips-linux-muslsf-gcc: error: crt1.o: No such file or directory
          mips-linux-muslsf-gcc: error: crti.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtbegin.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtend.o: No such file or directory
          mips-linux-muslsf-gcc: error: crtn.o: No such file or directory

@Emilgardis would there be any WA available to get this built for now ?

@Emilgardis
Copy link
Member

Im not sure. Im trying to find a way to solve it with #1422 and #1432

For now I've just disabled it, but I want a real solution. A possibility would be to use a older rustc, just invoke cross like cross +1.65

@wcampbell0x2a
Copy link
Author

Would this be something the rust-lang compiler guys would look into? I assume it's lower priority for them.

@Emilgardis
Copy link
Member

I dont know yet if this is something we do or rustc does wrongly yet.

@wcampbell0x2a
Copy link
Author

I tried yesterday to use https://github.com/richfelker/musl-cross-make and had the same issues with CRT.

@Emilgardis
Copy link
Member

Which makes sense, thats what cross uses ;)

@Emilgardis
Copy link
Member

Here's where its installed/setup

curl --retry 3 -sSfL "https://github.com/richfelker/musl-cross-make/archive/${version}.tar.gz" -O

@wcampbell0x2a
Copy link
Author

So with my local musl-cross-make, I can get the linking further by adding the location of the sysroot to -L:

> fd crt
lib/gcc/mips-linux-musl/9.4.0/crtbegin.o
lib/gcc/mips-linux-musl/9.4.0/crtbeginS.o
lib/gcc/mips-linux-musl/9.4.0/crtbeginT.o
lib/gcc/mips-linux-musl/9.4.0/crtend.o
lib/gcc/mips-linux-musl/9.4.0/crtendS.o
lib/gcc/mips-linux-musl/9.4.0/crtfastmath.o
mips-linux-musl/lib/Scrt1.o
mips-linux-musl/lib/crt1.o
mips-linux-musl/lib/crti.o
mips-linux-musl/lib/crtn.o
mips-linux-musl/lib/rcrt1.o
[build]
rustflags = [
	"-C", "target-feature=+crt-static",
	"-L", "musl-cross-make/output/mips-linux-musl/lib",
	"-L", "musl-cross-make/output/lib/gcc/mips-linux-musl/9.4.0/"
]
target = "x86_64-unknown-linux-musl"

[target.mips-unknown-linux-musl]
linker = "musl-cross-make/output/bin/mips-linux-musl-gcc"

I don't know if this is a rustc issue or not? Anyway, the linker now gives:

  = note: musl-cross-make/output/bin/../lib/gcc/mips-linux-musl/9.4.0/../../../../mips-linux-musl/bin/ld: cannot find -lunwind
          collect2: error: ld returned 1 exit status

@wcampbell0x2a
Copy link
Author

Maybe this will work? I don't have time to check: rust-lang/wg-cargo-std-aware#81 / https://stackoverflow.com/a/74060091.

@wcampbell0x2a
Copy link
Author

I opened rust-lang/rust#120655, just in case this is an rustc bug.

@arun11299
Copy link

Just as an update, I am now able to build it using the nightly, which is 1.77.

@wcampbell0x2a
Copy link
Author

Just as an update, I am now able to build it using the nightly, which is 1.77.

What does your buildchain/config/cmd look like?

@Ragnt
Copy link

Ragnt commented Feb 13, 2024

I'm having this same issue, and came to the same conclusion as you thus far. Can't figure out a way around this.

@wcampbell0x2a
Copy link
Author

A solution to this is just to create a symbolic link the libgcc.a into libuwind.a:

ln -s musl-cross-make/output/lib/gcc/mips-linux-musl/11.2.0/libgcc.a /musl-cross-make/output/lib/gcc/mips-linux-musl/11.2.0/libunwind.a

A better solution could be found within rustc, but that will take more effort and investigation.

@Revertron
Copy link

Im not sure. Im trying to find a way to solve it with #1422 and #1432

For now I've just disabled it, but I want a real solution. A possibility would be to use a older rustc, just invoke cross like cross +1.65

I'm trying to build like this:

cross +nightly build --release --target=mipsel-unknown-linux-musl --no-default-features --features="doh" -Zbuild-std="core,std,alloc,proc_macro"

But I get error:

error: couldn't read /home/revertron/Projects/Alfis/target/release/build/rustversion-9753591362dadb7d/out/version.expr: No such file or directory (os error 2)
   --> /home/revertron/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustversion-1.0.17/src/lib.rs:187:30
    |
187 | const RUSTVERSION: Version = include!(concat!(env!("OUT_DIR"), "/version.expr"));
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `rustversion` (lib) due to 1 previous error

I wanted to try your recipe "cross +1.70 build ..." (trying old versions), but it says:

[cross] warning: unable to get metadata for package
[cross] note: Falling back to `cargo` on the host.
error: toolchain '1.70-x86_64-unknown-linux-gnu' is not installed

How does this thing with older versions work?

@Emilgardis
Copy link
Member

1.70 is not old enough. Anyway, to use another toolchain you'll need to install it.

rustup install 1.70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mips Area: MIPS targets A-musl Area: musl libc targets
Projects
None yet
Development

No branches or pull requests

5 participants