Open sk337 opened 5 months ago
What Linux? Do you have libstdc++ and libc installed?
Yes I do and fedora is what I am using
Having the same error on Fedora 39 :(
Does the issue persist in 5.0.1?
@rdbo Yes, unfortunately. Here is my error log:
Compiling test-project v0.1.0 (/home/user/Source_code/test-project)
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/usr/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/bin:/home/user/.local/bin:/home/user/.cargo/bin:/home/user/Android/Sdk/platform-tools:/home/user/Android/Sdk/tools:/usr/share/Modules/bin:/usr/lib64/ccache:/home/user/.local/bin:/home/user/.cargo/bin:/home/user/Android/Sdk/platform-tools:/home/user/Android/Sdk/tools:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin" VSLANG="1033" "cc" "-m64" "/tmp/rustceT33KW/symbols.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.12sls6qsw40n8i1c.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.1iapm3hm6gj3fvj3.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.31wmmvvkuetpjlqp.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.3if1cp3sbt8ldsxp.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.3x35a972nfbdr25k.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.4rwmwhvey6pdu6ra.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.wc6ld6umnori6qw.rcgu.o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f.3i1j3tbkudek1j23.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/Source_code/test-project/target/debug/deps" "-L" "/home/user/Source_code/test-project/target/debug/build/libmem-sys-28d8fa533d8070f7/out/libmem-5.0.1-x86_64-linux-musl-static/lib" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/Source_code/test-project/target/debug/deps/liblibmem-80be28f22da7ee4b.rlib" "/home/user/Source_code/test-project/target/debug/deps/libbitflags-a09448c8393f0fed.rlib" "/home/user/Source_code/test-project/target/debug/deps/liblibmem_sys-e153636b200286ce.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-204403da28d5972b.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-ddaebda35547a44d.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-477c221bccb9a593.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-3fc79f2446c90135.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-4e93c4d7b0a47c1f.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e05022b0af32ebc.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-6dc7e0145919af8f.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-883b8079ff6252af.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-df5b0a140be96485.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-6b42d82bc44ed5b6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-0e9c079fd0484faa.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-fc531124be6c8193.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-643f1f8cfb933ee8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-d8e0091cf14fd46c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b885c82266435372.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1130be314bc3df61.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-d7fc549b29637a95.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c8e690ff38075c09.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-c9053203f6cfbaef.rlib" "-Wl,-Bdynamic" "-ldl" "-lm" "-lstdc++" "-llibmem" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/Source_code/test-project/target/debug/deps/pa_hass-d6e3db04bbafa82f" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: /usr/bin/ld: /home/user/Source_code/test-project/target/debug/build/libmem-sys-28d8fa533d8070f7/out/libmem-5.0.1-x86_64-linux-musl-static/lib/liblibmem.a(ks.cpp.o): in function `_GLOBAL__sub_I_ks.cpp':
ks.cpp:(.text.startup._GLOBAL__sub_I_ks.cpp+0x3): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/bin/ld: /home/user/Source_code/test-project/target/debug/build/libmem-sys-28d8fa533d8070f7/out/libmem-5.0.1-x86_64-linux-musl-static/lib/liblibmem.a(X86MCTargetDesc.cpp.o): in function `llvm_ks::FeatureBitset::FeatureBitset(std::initializer_list<unsigned int>)':
X86MCTargetDesc.cpp:(.text._ZN7llvm_ks13FeatureBitsetC2ESt16initializer_listIjE[_ZN7llvm_ks13FeatureBitsetC5ESt16initializer_listIjE]+0x5c): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/usr/bin/ld: /home/user/Source_code/test-project/target/debug/build/libmem-sys-28d8fa533d8070f7/out/libmem-5.0.1-x86_64-linux-musl-static/lib/liblibmem.a(MipsAsmParser.cpp.o): in function `_GLOBAL__sub_I_MipsAsmParser.cpp':
MipsAsmParser.cpp:(.text.startup._GLOBAL__sub_I_MipsAsmParser.cpp+0xed): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/usr/bin/ld: /home/user/Source_code/test-project/target/debug/build/libmem-sys-28d8fa533d8070f7/out/libmem-5.0.1-x86_64-linux-musl-static/lib/liblibmem.a(MCFragment.cpp.o): in function `llvm_ks::MCFragment::MCFragment(llvm_ks::MCFragment::FragmentType, bool, unsigned char, llvm_ks::MCSection*)':
MCFragment.cpp:(.text._ZN7llvm_ks10MCFragmentC2ENS0_12FragmentTypeEbhPNS_9MCSectionE+0x7b): undefined reference to `operator new(unsigned long)'
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
error: could not compile `test-project` (bin "test-project") due to 1 previous error
In the logs I noticed x86_64-linux-musl-static
. I'm really bad at C++/Rust but I wonder if musl is expected here because the compiler is seem using x86_64-unknown-linux-gnu
.
For anyone having the same issue, you can try the binary release. Just unpack the libmem-5.0.1-x86_64-linux-gnu-shared.tar.gz archive to any directory and set environment variables pointing to it:
export LIBMEM_DIR=/path/to/libmem-5.0.1-x86_64-linux-gnu-shared/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/libmem-5.0.1-x86_64-linux-gnu-shared/lib
Also, it's advisable to remove the target
dir.
error log
program