Linking with rust issue. #277

Closed
opened 2025-08-15 00:01:59 +02:00 by patlefort · 15 comments

Hi, I have an issue that started recently whenever I try to build rust code against libs from this repository. I can build just fine against official Arch repos. Example from AUR: cinny-desktop.

Result in:

error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-Wl,--version-script=/tmp/rustcrdkhUn/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcrdkhUn/symbols.o" "<5 object files omitted>" "/tmp/rustcrdkhUn/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libproc_macro-*,librustc_literal_escaper-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcrdkhUn/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/pkgbuild/out/cinny-desktop/src/cinny-desktop/src-tauri/target/release/deps/libproc_macro_hack-b7559654566774ba.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-68e7be1c71cd87ea.rlib: error adding symbols: file format not recognized
          collect2: error: ld returned 1 exit status


error: could not compile `proc-macro-hack` (lib) due to 1 previous error

Flags are -Ctarget-cpu=native -Clink-dead-code=off -Copt-level=2. I also tried to disable LTO with options=(!lto). I tested against -v3 and -v4 repos.

Hi, I have an issue that started recently whenever I try to build rust code against libs from this repository. I can build just fine against official Arch repos. Example from AUR: `cinny-desktop`. Result in: ``` error: linking with `cc` failed: exit status: 1 | = note: "cc" "-Wl,--version-script=/tmp/rustcrdkhUn/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcrdkhUn/symbols.o" "<5 object files omitted>" "/tmp/rustcrdkhUn/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libproc_macro-*,librustc_literal_escaper-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcrdkhUn/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/pkgbuild/out/cinny-desktop/src/cinny-desktop/src-tauri/target/release/deps/libproc_macro_hack-b7559654566774ba.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs" = note: some arguments are omitted. use `--verbose` to show all linker arguments = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-68e7be1c71cd87ea.rlib: error adding symbols: file format not recognized collect2: error: ld returned 1 exit status error: could not compile `proc-macro-hack` (lib) due to 1 previous error ``` Flags are `-Ctarget-cpu=native -Clink-dead-code=off -Copt-level=2`. I also tried to disable LTO with `options=(!lto)`. I tested against -v3 and -v4 repos.
Author

Doing objdump -x /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-68e7be1c71cd87ea.rlib result in the same file format not recognized error. Could it has gotten corrupted?

Doing `objdump -x /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-68e7be1c71cd87ea.rlib` result in the same `file format not recognized` error. Could it has gotten corrupted?
Author

I tested the package from different mirrors and same issue.

I tested the package from different mirrors and same issue.

I also ran into the issue when trying to recompile mesa locally.

Can you try to rebuild rust locally with the relevant makepkg.conf from here: https://alhp.dev/makepkg/
and check if the issue also happens with that package?
This is to rule out a maybe temprorary build-time problem. If the issue is reproducible, that would mean that rust is not compatible with the optimizations anymore and should maybe be blacklisted.

Unfortunately I don't have time myself to help with the debugging in the next days.

I also ran into the issue when trying to recompile mesa locally. Can you try to rebuild rust locally with the relevant makepkg.conf from here: https://alhp.dev/makepkg/ and check if the issue also happens with that package? This is to rule out a maybe temprorary build-time problem. If the issue is reproducible, that would mean that rust is not compatible with the optimizations anymore and should maybe be blacklisted. Unfortunately I don't have time myself to help with the debugging in the next days.

ok found some time to compile rust locally.

@anonfunc can you add rust to the non-LTO packages and trigger a rebuild? Or are there other things that should be checked first?

ok found some time to compile rust locally. - Building rust with the regular [makepkg-x86-64-v4.conf](https://alhp.dev/makepkg/makepkg-x86-64-v4.conf) leads to the above mentioned error when using the resulting rust package. - Building rust with the [makepkg-x86-64-v4-non-lto.conf](https://alhp.dev/makepkg/makepkg-x86-64-v4-non-lto.conf) leads to a working rust package @anonfunc can you add rust to the non-LTO packages and trigger a rebuild? Or are there other things that should be checked first?
anonfunc added the
bug
label 2025-08-23 17:34:43 +02:00
Owner

Thanks for figuring this out, rebuild is on the way.

Thanks for figuring this out, rebuild is on the way.

no worries. Something seems to have gone wrong though - rust 1:1.89.0-1.2 still produces the error, and the status page shows that it is still an LTO build.

no worries. Something seems to have gone wrong though - `rust 1:1.89.0-1.2` still produces the error, and the status page shows that it is still an LTO build.
Owner

no worries. Something seems to have gone wrong though - rust 1:1.89.0-1.2 still produces the error, and the status page shows that it is still an LTO build.

I think the status page thing does not update correctly. I'll check later.

> no worries. Something seems to have gone wrong though - `rust 1:1.89.0-1.2` still produces the error, and the status page shows that it is still an LTO build. I think the status page thing does not update correctly. I'll check later.

I have been unable to compile proton-cachyos for a while now. System is updated with the latest rust. Just got this libproc_macro error too.

error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-Wl,--version-script=/tmp/rustcYmlaKY/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcYmlaKY/symbols.o" "<8 object files omitted>" "/tmp/rustcYmlaKY/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libproc_macro-*,librustc_literal_escaper-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcYmlaKY/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps/libpaste-4241645abcf6b5a2.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-5794f4bb3a3758b7.rlib: error adding symbols: file format not recognized
          collect2: error: ld returned 1 exit status
          

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

Caused by:
  process didn't exit successfully: `rustc --crate-name paste --edition=2018 /ssd2/csaba/.cache/yay/proton-cachyos/proton-cargo/registry/src/index.crates.io-1949cf8c6b5b557f/paste-1.0.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=272 --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=291d35616d09b96f -C extra-filename=-4241645abcf6b5a2 --out-dir /ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps -L dependency=/ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps --extern proc_macro --cap-lints allow --check-cfg 'cfg(no_literal_fromstr)' --check-cfg 'cfg(feature, values("protocol_feature_paste"))'` (exit status: 1)

I have been unable to compile `proton-cachyos` for a while now. System is updated with the latest rust. Just got this `libproc_macro` error too. ``` error: linking with `cc` failed: exit status: 1 | = note: "cc" "-Wl,--version-script=/tmp/rustcYmlaKY/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcYmlaKY/symbols.o" "<8 object files omitted>" "/tmp/rustcYmlaKY/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libproc_macro-*,librustc_literal_escaper-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcYmlaKY/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps/libpaste-4241645abcf6b5a2.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-nodefaultlibs" = note: some arguments are omitted. use `--verbose` to show all linker arguments = note: /usr/bin/ld: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-5794f4bb3a3758b7.rlib: error adding symbols: file format not recognized collect2: error: ld returned 1 exit status error: could not compile `paste` (lib) due to 1 previous error Caused by: process didn't exit successfully: `rustc --crate-name paste --edition=2018 /ssd2/csaba/.cache/yay/proton-cachyos/proton-cargo/registry/src/index.crates.io-1949cf8c6b5b557f/paste-1.0.15/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=272 --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=off --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=291d35616d09b96f -C extra-filename=-4241645abcf6b5a2 --out-dir /ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps -L dependency=/ssd2/csaba/.cache/yay/proton-cachyos/src/build/obj-gst_plugins_rs-i386/release/deps --extern proc_macro --cap-lints allow --check-cfg 'cfg(no_literal_fromstr)' --check-cfg 'cfg(feature, values("protocol_feature_paste"))'` (exit status: 1) ```

output from yay
extra-x86-64-v3/rust 1:1.89.0-1.2 (66.3 MiB 255.8 MiB) (Installed)

output from yay `extra-x86-64-v3/rust 1:1.89.0-1.2 (66.3 MiB 255.8 MiB) (Installed)`

@anonfunc i tried again with rebuilding rust with the non-lto.conf and it still produces a usable rust package. The version in the repository is still producing the error.

@anonfunc i tried again with rebuilding rust with the non-lto.conf and it still produces a usable rust package. The version in the repository is still producing the error.
Owner

Yep my fault, I think I missed the config reload after adding it to the LTO exceptions. Rebuild is queued.

Yep my fault, I think I missed the config reload after adding it to the LTO exceptions. Rebuild is queued.

@anonfunc I think you need to rebuild lib32-rust-libs too. I just can't find it in https://status.alhp.dev/?pkgbase=lib32-rust-libs

@anonfunc I think you need to rebuild `lib32-rust-libs` too. I just can't find it in https://status.alhp.dev/?pkgbase=lib32-rust-libs
Owner

The lib32-rust-libs package is a split package of rust: https://archlinux.org/packages/extra/x86_64/rust/ and will be rebuild when the base package is anyways.

The `lib32-rust-libs` package is a split package of rust: https://archlinux.org/packages/extra/x86_64/rust/ and will be rebuild when the base package is anyways.

rust 1:1.89.0-1.3 looks good, can't trigger the error any more. Thanks!

`rust 1:1.89.0-1.3` looks good, can't trigger the error any more. Thanks!
Author

Sorry, email notifications got caught by spam filters. The new version works fine, thank you very much.

Sorry, email notifications got caught by spam filters. The new version works fine, thank you very much.
Sign in to join this conversation.
No description provided.