New to rust, trying to build a debug version for a binary in ubuntu which fails with below linking error:
linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/my_home/.rustup/toolchains/nightly-2023-05-31-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/my_home/my_project-2-dev/bin:/home/my_home/.nvm/versions/node/v16.19.1/bin:/home/my_home/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcsg0duh/symbols.o" "/home/my_home/my_project-2-dev/my_service/target/debug/deps/my_project_my_service_abc-8aad4b2b83ae80f6.10vvqzkopsquoi13.rcgu.o" "/home/my_home/my_project-2-dev/my_service/target/debug/deps/my_project_my_service_abc-8aad4b2b83ae80f6.11rgc8keoer74gis.rcgu.o" "/home/my_home/my_project-2-dev/my_service/target/debug/deps/my_project_my_service_abc-8aad4b2b83ae80f6.12a9dvufwkt6aflp.rcgu.o" "/home/my_home/my_project-2-dev/my_service/target/debug/deps/my_project_my_service_abc-8aad4b2b83ae80f6.14sl35u4afv70bhq.rcgu.o" "/home/my_home/my_project-2-dev/my_service/target/debug/deps/my_project_my_service_abc-8aad4b2b83ae80f6.15avg65pxqdjpcwx.rcgu.o"
= note: /home/my_home/.rustup/toolchains/nightly-2023-05-31-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a8a9ba95b1228749.rlib(std-a8a9ba95b1228749.std.97c55777bef24d10-cgu.0.rcgu.o):(.debug_info+0x12): relocation truncated to fit: R_X86_64_32 against `.debug_str'
/home/my_home/.rustup/toolchains/nightly-2023-05-31-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a8a9ba95b1228749.rlib(std-a8a9ba95b1228749.std.97c55777bef24d10-cgu.0.rcgu.o):(.debug_info+0x73): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
my versions on ubuntu are:
cc --version
cc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
ld --version
GNU ld (GNU Binutils for Ubuntu) 2.38
whereas on macos both the debug and the release build both passes.
cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
My suspicion is the issue is with the linker on ubuntu, not sure how to troubleshoot, any help is highly appreciated?