You are not logged in.

#1 2024-02-21 14:16:29

josephg
Member
From: Brazil
Registered: 2009-09-28
Posts: 118

[SOLVED] Rust tests failing that once worked just fine

The ddnet AUR package's check() run some tests, including on Rust code. Building in a clean chroot, the current version that once built just fine is now failing on Rust tests. Since I didn't change a single config in my system since the last successful build, I'm assuming this is related to a package upgrade that changed a flag or something.

Logs: ddnet-18.0.3-1-x86_64-build.log, ddnet-18.0.3-1-x86_64-check.log

Help please?

Here is one of the failure logs:

---- src/engine/console.rs - console::ffi::CreateConsole (line 28) stdout ----
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/usr/lib64/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" VSLANG="1033" "cc" "-m64" "/tmp/rustcS9vTLz/symbols.o" "/tmp/rustdoctestPnOGIm/rust_out.rust_out.17bd9d68ad64dd6a-cgu.0.rcgu.o" "/tmp/rustdoctestPnOGIm/rust_out.25468inwjpnsszg7.rcgu.o" "-Wl,--as-needed" "-L" "/build/ddnet/src/build/debug/deps" "-L" "/build/ddnet/src/build/debug/deps" "-L" "/build/ddnet/src/build" "-L" "/usr/lib" "-L" "/build/ddnet/src/build/debug/build/cxx-abcd03f9a48f6c98/out" "-L" "/build/ddnet/src/build/debug/build/link-cplusplus-13186b002f9e61a4/out" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/build/ddnet/src/build/debug/deps/libddnet_engine_shared-df256684e06068e8.rlib" "/build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib" "/build/ddnet/src/build/debug/deps/libddnet_base-408696517e49ae68.rlib" "/build/ddnet/src/build/debug/deps/libcxx-8caff527fd5c1ceb.rlib" "/build/ddnet/src/build/debug/deps/liblink_cplusplus-86720fb93a5f9151.rlib" "/build/ddnet/src/build/debug/deps/libddnet_test-d1c562c86e69d420.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-dce4da11b2ccc789.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-c5aff1055622daf3.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libobject-9027304ca17f2680.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-c5fb359364fdb009.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-19a4ac3a15b73927.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-545ef01c478e3996.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-6ac5c2838ec4f836.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-290b884672cd911f.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-f9093be1927a1602.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-19087ab4fa333a2c.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f66fa5fbf4547710.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libadler-d7285f96d8856fea.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-406c5a4d6fa7f15b.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-43d91895302c1941.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-8e42f4a5e7a1d2d4.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-79b317ec80906222.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-099918608866d404.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcore-9a01eccf23a84d5b.rlib" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-dc359f8c64813cd3.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lcrypto" "-lcurl" "-lsqlite3" "-lz" "-lrt" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/rustdoctestPnOGIm/rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib(ddnet_engine-5db227e770255fa3.3rh2lgz9p5bynxp5.rcgu.o): in function `ddnet_engine::console::ffi::IConsole::ExecuteLine':
          /usr/src/debug/ddnet/DDNet-18.0.3/src/engine/console.rs:342:(.text._ZN12ddnet_engine7console3ffi8IConsole11ExecuteLine17h573fbb481d402e35E+0x4e): undefined reference to `cxxbridge1$IConsole$ExecuteLine'
          /usr/bin/ld: /build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib(ddnet_engine-5db227e770255fa3.3rh2lgz9p5bynxp5.rcgu.o): in function `ddnet_engine::console::ffi::CreateConsole':
          /usr/src/debug/ddnet/DDNet-18.0.3/src/engine/console.rs:503:(.text._ZN12ddnet_engine7console3ffi13CreateConsole17hb23780938f90c2a6E+0xa): undefined reference to `cxxbridge1$CreateConsole'
          /usr/bin/ld: /build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib(ddnet_engine-5db227e770255fa3.3rh2lgz9p5bynxp5.rcgu.o): in function `<ddnet_engine::console::ffi::IConsole as cxx::unique_ptr::UniquePtrTarget>::__raw':
          /usr/src/debug/ddnet/DDNet-18.0.3/src/engine/console.rs:503:(.text._ZN89_$LT$ddnet_engine..console..ffi..IConsole$u20$as$u20$cxx..unique_ptr..UniquePtrTarget$GT$5__raw17hc7a1ff79b8b57fcaE+0x22): undefined reference to `cxxbridge1$unique_ptr$IConsole$raw'
          /usr/bin/ld: /build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib(ddnet_engine-5db227e770255fa3.3rh2lgz9p5bynxp5.rcgu.o): in function `<ddnet_engine::console::ffi::IConsole as cxx::unique_ptr::UniquePtrTarget>::__get':
          /usr/src/debug/ddnet/DDNet-18.0.3/src/engine/console.rs:503:(.text._ZN89_$LT$ddnet_engine..console..ffi..IConsole$u20$as$u20$cxx..unique_ptr..UniquePtrTarget$GT$5__get17hd4b2c431899b56aeE+0x10): undefined reference to `cxxbridge1$unique_ptr$IConsole$get'
          /usr/bin/ld: /build/ddnet/src/build/debug/deps/libddnet_engine-5db227e770255fa3.rlib(ddnet_engine-5db227e770255fa3.3rh2lgz9p5bynxp5.rcgu.o): in function `<ddnet_engine::console::ffi::IConsole as cxx::unique_ptr::UniquePtrTarget>::__drop':
          /usr/src/debug/ddnet/DDNet-18.0.3/src/engine/console.rs:503:(.text._ZN89_$LT$ddnet_engine..console..ffi..IConsole$u20$as$u20$cxx..unique_ptr..UniquePtrTarget$GT$6__drop17hdc86f8380c807e32E+0xa): undefined reference to `cxxbridge1$unique_ptr$IConsole$drop'
          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#cargorustc-link-libkindname)

error: aborting due to 1 previous error

Couldn't compile the test.

Last edited by josephg (2024-02-23 02:59:23)

Offline

#2 2024-02-21 15:24:38

loqs
Member
Registered: 2014-03-06
Posts: 18,042

Re: [SOLVED] Rust tests failing that once worked just fine

I was able to avoid the issue by disabling LTO.  So I would suspect the issue was introduced on your system when you updated pacman that contained an updated /etc/makepkg.conf with LTO now enabled in the options array.
Edit:
Fixed static library build by adding -ffat-lto-objects to CXXFLAGS.

diff --git a/PKGBUILD b/PKGBUILD
index 5955598..b873230 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -30,6 +30,7 @@ sha256sums=('68d62635194a87f35c16077f3b65dd0b56877b74bd0776f4c3f3196fa79b87c8'
 build() {
     mkdir -p build
     cd build
+    CXXFLAGS+=' -ffat-lto-objects'
     cmake ../DDNet-$pkgver          \
         -DCMAKE_BUILD_TYPE=Release  \
         -DCMAKE_INSTALL_PREFIX=/usr \

Last edited by loqs (2024-02-21 16:02:48)

Offline

#3 2024-02-23 02:58:30

josephg
Member
From: Brazil
Registered: 2009-09-28
Posts: 118

Re: [SOLVED] Rust tests failing that once worked just fine

Indeed, /etc/makepkg.conf has options=(... lto) and LTOFLAGS="-flto=auto" since pacman 6.0.2-8, introduced in the pacman commit 90bf367e6. Thanks for debugging and suggesting this flag!

Last edited by josephg (2024-02-23 03:00:00)

Offline

Board footer

Powered by FluxBB