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

Fail to build from master #26

Open
fulalas opened this issue Jan 5, 2025 · 15 comments
Open

Fail to build from master #26

fulalas opened this issue Jan 5, 2025 · 15 comments

Comments

@fulalas
Copy link

fulalas commented Jan 5, 2025

I'm using these commands to build on PorteuX 1.8 with rust nightly + LLVM 19.1.5:

export RUSTFLAGS="-Cpanic=abort -Cstrip=debuginfo -Copt-level=z -Clto=true -Cembed-bitcode=yes -Zdylib-lto -Ccodegen-units=1 -Zlocation-detail=none"

ls rust-toolchain* 1> /dev/null 2>&1 && rm rust-toolchain*
just build-release -Z build-std=std,panic_abort --target x86_64-unknown-linux-gnu
rsync -r ./target/x86_64-unknown-linux-gnu/release ./target/ --remove-source-files
just rootdir=$MODULEPATH/$PRGNAM/package install || exit 1

And get this:

   Compiling libcosmic v0.1.0 (https://github.com/pop-os/libcosmic.git#aeb87f88)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/tmpjust-master/target/x86_64-unknown-linux-gnu/release/:/root/.cargo/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcKLrkZK/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "-lEGL" "-lgbm" "-ldrm" "-ludev" "-Wl,-Bstatic" "-lnvtop" "/tmp/rustcKLrkZK/{liblibdbus_sys-fa825127e56dc5ae.rlib}" "/tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/{libcompiler_builtins-938ba6069df3afc2.rlib}" "-Wl,-Bdynamic" "-lEGL" "-lc" "-lm" "-lgbm" "-ldl" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-B/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/usr/lib64" "-L" "/usr/lib64" "-L" "/usr/lib64" "-L" "/usr/lib64" "-L" "/usr/lib64" "-L" "/usr/lib64" "-L" "/tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/observatory-daemon-c0b61e8b8bc5a982/out" "-L" "/tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/libdbus-sys-a972829d2355664a/out" "-L" "/tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/libdbus-sys-a972829d2355664a/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" "-nodefaultlibs" "-ldrm" "-ludev"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: undefined symbol: init_extract_gpuinfo_intel
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(core::ops::function::FnOnce::call_once::hed0ff85a29d13864)
          
          rust-lld: error: undefined symbol: init_extract_gpuinfo_amdgpu
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(core::ops::function::FnOnce::call_once::hed0ff85a29d13864)
          
          rust-lld: error: undefined symbol: init_extract_gpuinfo_nvidia
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(core::ops::function::FnOnce::call_once::hed0ff85a29d13864)
          
          rust-lld: error: undefined symbol: gpuinfo_init_info_extraction
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(_$LT$observatory_daemon..platform..platform_impl..gpu_info..LinuxGpuInfo$u20$as$u20$observatory_daemon..platform..gpu_info..GpuInfoExt$GT$::refresh_gpu_list::h914628b24e3d9b4e)
          
          rust-lld: error: undefined symbol: gpuinfo_populate_static_infos
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(_$LT$observatory_daemon..platform..platform_impl..gpu_info..LinuxGpuInfo$u20$as$u20$observatory_daemon..platform..gpu_info..GpuInfoExt$GT$::refresh_gpu_list::h914628b24e3d9b4e)
          
          rust-lld: error: undefined symbol: gpuinfo_refresh_dynamic_info
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(_$LT$observatory_daemon..platform..platform_impl..gpu_info..LinuxGpuInfo$u20$as$u20$observatory_daemon..platform..gpu_info..GpuInfoExt$GT$::refresh_gpu_list::h914628b24e3d9b4e)
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(observatory_daemon::SystemState::snapshot::h0e77f66b95df1eb5)
          
          rust-lld: error: undefined symbol: gpuinfo_utilisation_rate
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(_$LT$observatory_daemon..platform..platform_impl..gpu_info..LinuxGpuInfo$u20$as$u20$observatory_daemon..platform..gpu_info..GpuInfoExt$GT$::refresh_gpu_list::h914628b24e3d9b4e)
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(observatory_daemon::SystemState::snapshot::h0e77f66b95df1eb5)
          
          rust-lld: error: undefined symbol: gpuinfo_shutdown_info_extraction
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(_$LT$observatory_daemon..platform..platform_impl..gpu_info..LinuxGpuInfo$u20$as$u20$observatory_daemon..platform..gpu_info..GpuInfoExt$GT$::refresh_gpu_list::h914628b24e3d9b4e)
          
          rust-lld: error: undefined symbol: gpuinfo_refresh_processes
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(observatory_daemon::SystemState::snapshot::h0e77f66b95df1eb5)
          
          rust-lld: error: undefined symbol: gpuinfo_fix_dynamic_info_from_process_info
          >>> referenced by observatory_daemon.98b814d7d0eba5b5-cgu.0
          >>>               /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/deps/observatory_daemon-d2d059be191723ec.observatory_daemon.98b814d7d0eba5b5-cgu.0.rcgu.o:(observatory_daemon::SystemState::snapshot::h0e77f66b95df1eb5)
          collect2: error: ld returned 1 exit status
          

warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel.c: In function 'gpuinfo_intel_refresh_dynamic_info':
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel.c:272:22: warning: unused variable 'ts_diff' [-Wunused-variable]
warning: observatory-daemon@0.6.2:   272 |       nvtop_time ts, ts_diff;
warning: observatory-daemon@0.6.2:       |                      ^~~~~~~
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel.c: In function 'parse_drm_fdinfo_intel':
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel.c:90:1: warning: control reaches end of non-void function [-Wreturn-type]
warning: observatory-daemon@0.6.2:    90 | }
warning: observatory-daemon@0.6.2:       | ^
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel_xe.c: In function 'gpuinfo_intel_xe_refresh_dynamic_info':
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel_xe.c:84:89: warning: pointer targets in passing argument 3 of 'xe_device_query_alloc_fetch' differ in signedness [-Wpointer-sign]
warning: observatory-daemon@0.6.2:    84 |         xe_device_query_alloc_fetch(gpu_info->card_fd, DRM_XE_DEVICE_QUERY_MEM_REGIONS, &length);
warning: observatory-daemon@0.6.2:       |                                                                                         ^~~~~~~
warning: observatory-daemon@0.6.2:       |                                                                                         |
warning: observatory-daemon@0.6.2:       |                                                                                         int32_t * {aka int *}
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel_xe.c:54:79: note: expected 'uint32_t *' {aka 'unsigned int *'} but argument is of type 'int32_t *' {aka 'int *'}
warning: observatory-daemon@0.6.2:    54 | static void *xe_device_query_alloc_fetch(int fd, uint32_t query_id, uint32_t *len) {
warning: observatory-daemon@0.6.2:       |                                                                     ~~~~~~~~~~^~~
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel_xe.c: At top level:
warning: observatory-daemon@0.6.2: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/native/nvtop-19382d93086acf36f32a8d72173fb9968232e3c1/src/extract_gpuinfo_intel_xe.c:106:19: warning: 'xe_drm_intel_gtt' defined but not used [-Wunused-const-variable=]
warning: observatory-daemon@0.6.2:   106 | static const char xe_drm_intel_gtt[] = "drm-total-gtt";
warning: observatory-daemon@0.6.2:       |                   ^~~~~~~~~~~~~~~~
warning: observatory-daemon@0.6.2: Inherited flag "-flto=full" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: Inherited flag "-fembed-bitcode=all" is not supported by the currently used CC
warning: observatory-daemon@0.6.2: ar: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/observatory-daemon-c0b61e8b8bc5a982/out/4d1b66ea4ff140de-get_process_info_linux.o: plugin needed to handle lto object
warning: observatory-daemon@0.6.2: ar: /tmp/observatory/observatory/target/x86_64-unknown-linux-gnu/release/build/observatory-daemon-c0b61e8b8bc5a982/out/libnvtop.a(4d1b66ea4ff140de-get_process_info_linux.o): plugin needed to handle lto object
error: could not compile `observatory-daemon` (bin "observatory-daemon") due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: Recipe `build-debug` failed on line 37 with exit code 101

It was building fine a few weeks ago (probably before this daemon was introduced).

Also, I don't understand why build-debug is being called if I explicitly called build-release.

@fulalas fulalas changed the title Fail to build Fail to build from master Jan 5, 2025
@Adam-Cosner
Copy link
Collaborator

build-release just calls build-debug with the --release flag, so that's normal. As for the build issues, do you have a proper C linker setup? The backend interfaces with nvtop which is developed in C. Also, it's using the same backend as Mission Center so I'd recommend checking if that fails to build as well.

@fulalas
Copy link
Author

fulalas commented Jan 6, 2025

do you have a proper C linker setup?

I build a whole distro, with 8 desktop environments (including COSMIC), and have zero problems.

I don't understand what is missing that is causing this link error:

rust-lld: error: undefined symbol: init_extract_gpuinfo_intel

Most likely I don't have some of your project dependencies, and since it was building fine just a few weeks ago, maybe you know what dependency has been included recently.

Thanks!

@Adam-Cosner
Copy link
Collaborator

The only dependency that's been added is nvtop for GPU usage monitoring, whatever is going on it seems that cargo isn't properly building nvtop on your end.

@fulalas
Copy link
Author

fulalas commented Jan 6, 2025

I just built nvtop from scratch:

$ cmake ..
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Looking for cbreak in /usr/lib64/libncursesw.so
-- Looking for cbreak in /usr/lib64/libncursesw.so - found
-- Found Curses: /usr/lib64/libncursesw.so
-- Performing Test HAS_REALLOCARRAY
-- Performing Test HAS_REALLOCARRAY - Success
-- Found UDev: /usr/lib64/libudev.so (found version "251")
-- Libudev stable: TRUE
-- Could NOT find Systemd (missing: SYSTEMD_LIBRARY SYSTEMD_INCLUDE_DIR) (found version "")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Found Libdrm: /usr/lib64/libdrm.so (found version "2.4.124")
-- Found libdrm; Enabling support
-- Performing Test compiler_has-Wall
-- Performing Test compiler_has-Wall - Success
-- Performing Test compiler_has-Wextra
-- Performing Test compiler_has-Wextra - Success
-- Performing Test compiler_has-Waddress
-- Performing Test compiler_has-Waddress - Success
-- Performing Test compiler_has-Waggressive-loop-optimizations
-- Performing Test compiler_has-Waggressive-loop-optimizations - Success
-- Performing Test compiler_has-Wbad-function-cast
-- Performing Test compiler_has-Wbad-function-cast - Success
-- Performing Test compiler_has-Wmissing-declarations
-- Performing Test compiler_has-Wmissing-declarations - Success
-- Performing Test compiler_has-Wmissing-parameter-type
-- Performing Test compiler_has-Wmissing-parameter-type - Success
-- Performing Test compiler_has-Wmissing-prototypes
-- Performing Test compiler_has-Wmissing-prototypes - Success
-- Performing Test compiler_has-Wnested-externs
-- Performing Test compiler_has-Wnested-externs - Success
-- Performing Test compiler_has-Wold-style-declaration
-- Performing Test compiler_has-Wold-style-declaration - Success
-- Performing Test compiler_has-Wold-style-definition
-- Performing Test compiler_has-Wold-style-definition - Success
-- Performing Test compiler_has-Wstrict-prototypes
-- Performing Test compiler_has-Wstrict-prototypes - Success
-- Performing Test compiler_has-Wpointer-sign
-- Performing Test compiler_has-Wpointer-sign - Success
-- Performing Test compiler_has-Wdouble-promotion
-- Performing Test compiler_has-Wdouble-promotion - Success
-- Performing Test compiler_has-Wuninitialized
-- Performing Test compiler_has-Wuninitialized - Success
-- Performing Test compiler_has-Winit-self
-- Performing Test compiler_has-Winit-self - Success
-- Performing Test compiler_has-Wstrict-aliasing
-- Performing Test compiler_has-Wstrict-aliasing - Success
-- Performing Test compiler_has-Wsuggest-attribute-const
-- Performing Test compiler_has-Wsuggest-attribute-const - Success
-- Performing Test compiler_has-Wtrampolines
-- Performing Test compiler_has-Wtrampolines - Success
-- Performing Test compiler_has-Wfloat-equal
-- Performing Test compiler_has-Wfloat-equal - Success
-- Performing Test compiler_has-Wshadow
-- Performing Test compiler_has-Wshadow - Success
-- Performing Test compiler_has-Wunsafe-loop-optimizations
-- Performing Test compiler_has-Wunsafe-loop-optimizations - Success
-- Performing Test compiler_has-Wfloat-conversion
-- Performing Test compiler_has-Wfloat-conversion - Success
-- Performing Test compiler_has-Wlogical-op
-- Performing Test compiler_has-Wlogical-op - Success
-- Performing Test compiler_has-Wnormalized
-- Performing Test compiler_has-Wnormalized - Success
-- Performing Test compiler_has-Wdisabled-optimization
-- Performing Test compiler_has-Wdisabled-optimization - Success
-- Performing Test compiler_has-Whsa
-- Performing Test compiler_has-Whsa - Success
-- Performing Test compiler_has-Wunused-result
-- Performing Test compiler_has-Wunused-result - Success
-- Performing Test compiler_has-Werror-implicit-function-declaration
-- Performing Test compiler_has-Werror-implicit-function-declaration - Success
-- Performing Test compiler_has-Wformat
-- Performing Test compiler_has-Wformat - Success
-- Performing Test compiler_has-Wformat-security
-- Performing Test compiler_has-Wformat-security - Success
-- Performing Test linker_has-Wl_-z_relro
-- Performing Test linker_has-Wl_-z_relro - Success
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Configuring done (1.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/guest/nvtop/build
$ make -j16
[ 16%] Building C object src/CMakeFiles/nvtop.dir/nvtop.c.o
[ 16%] Building C object src/CMakeFiles/nvtop.dir/interface_options.c.o
[ 16%] Building C object src/CMakeFiles/nvtop.dir/interface_layout_selection.c.o
[ 16%] Building C object src/CMakeFiles/nvtop.dir/interface.c.o
[ 16%] Building C object src/CMakeFiles/nvtop.dir/interface_setup_win.c.o
[ 20%] Building C object src/CMakeFiles/nvtop.dir/interface_ring_buffer.c.o
[ 26%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo.c.o
[ 30%] Building C object src/CMakeFiles/nvtop.dir/time.c.o
[ 33%] Building C object src/CMakeFiles/nvtop.dir/ini.c.o
[ 33%] Building C object src/CMakeFiles/nvtop.dir/plot.c.o
[ 40%] Building C object src/CMakeFiles/nvtop.dir/get_process_info_linux.c.o
[ 40%] Building C object src/CMakeFiles/nvtop.dir/extract_processinfo_fdinfo.c.o
[ 43%] Building C object src/CMakeFiles/nvtop.dir/info_messages_linux.c.o
[ 46%] Building C object src/CMakeFiles/nvtop.dir/device_discovery_linux.c.o
[ 50%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_nvidia.c.o
[ 53%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu.c.o
[ 56%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_amdgpu_utils.c.o
[ 60%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_msm.c.o
[ 63%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_msm_utils.c.o
[ 66%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_intel.c.o
[ 70%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_intel_i915.c.o
[ 73%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_intel_xe.c.o
[ 76%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_v3d.c.o
[ 80%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_v3d_utils.c.o
[ 83%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_panfrost.c.o
[ 86%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_panfrost_utils.c.o
[ 90%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_panthor.c.o
[ 93%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_panthor_utils.c.o
[ 96%] Building C object src/CMakeFiles/nvtop.dir/extract_gpuinfo_mali_common.c.o
[100%] Linking C executable nvtop
[100%] Built target nvtop

No problem at all. I'm confused.

@fulalas
Copy link
Author

fulalas commented Jan 6, 2025

I think your project is failing to find nvtop .c files with the headers. For instance, this error:

rust-lld: error: undefined symbol: init_extract_gpuinfo_intel

init_extract_gpuinfo_intel is a method in nvtop/src/extract_gpuinfo_intel.c. The fact that I can build nvtop but I cannot build your project means that your system probably has access to these .c files somehow, while my system doesn't. So my guess is that you need to properly set your project to be system-agnostic.

@Adam-Cosner
Copy link
Collaborator

I even tried building in a fresh VM and it still built fine for me. I'm not sure what the issue could be. The command cc works on your system right?

@Adam-Cosner
Copy link
Collaborator

Could you try building with Rust stable and no extra flags to see if it works?

@Adam-Cosner
Copy link
Collaborator

(also just checking, you have clang installed right?)

@fulalas
Copy link
Author

fulalas commented Jan 6, 2025

Do you mind telling exactly how you're building your project? Every single command you type until you have a working binary.

@Adam-Cosner
Copy link
Collaborator

From the VM? I'm installing rustup and just, doing rustup default stable, and running just build-release and installing whatever dependencies it says I'm missing, and once they're all there it builds fine. Never mentions nvtop

@Adam-Cosner
Copy link
Collaborator

Adam-Cosner commented Jan 6, 2025

-- Check for working C compiler: /usr/bin/cc - skipped

That's odd that it skipped, does cc output anything when you run it on your system?

@fulalas
Copy link
Author

fulalas commented Jan 6, 2025

I tried using rust stable 1.83.0 and LLVM 19.1.6 passing no flags to build your project, just just build-release. The same errors occur.

There's nothing wrong with my build environment. As I said, I'm building a whole (!) distro with 8 desktop environments and I have zero errors. It's definitely something related to how your project configuration is being set.

For now I'm giving up your project, sorry. Let's wait and see if other people will face the same problem.

Thanks anyway :)

@marchaesen
Copy link

I am facing the same problem for the release build.
The debug build is working though.
If I look at the generated static library libnvtop.a from the release build, I do not see any of the symbols in it.
So I guess that for the release build the unused functions are removed from the library.

@marchaesen
Copy link

If you remove the -flto option from build.rs, the release build is also working:

diff --git a/observatory-daemon/build/build.rs b/observatory-daemon/build/build.rs
index 726403a..b42fa4a 100644
--- a/observatory-daemon/build/build.rs
+++ b/observatory-daemon/build/build.rs
@@ -163,7 +163,7 @@ fn build_nvtop(src_dir: &std::path::Path) -> Result<(), Box<dyn std::error::Erro
src_dir.join("src/time.c"),
]);
#[cfg(not(debug_assertions))]

  • build_def.flag("-flto");
  • //build_def.flag("-flto");
    build_def.flag("-Wno-unused-function");

    build_def.compile("nvtop");

@fulalas
Copy link
Author

fulalas commented Jan 8, 2025

If you remove the -flto option from build.rs, the release build is also working

I confirm that.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants