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

CMakeLists linker is missing libdl #24

Open
chrisdonlan opened this issue Jan 20, 2021 · 6 comments
Open

CMakeLists linker is missing libdl #24

chrisdonlan opened this issue Jan 20, 2021 · 6 comments
Assignees

Comments

@chrisdonlan
Copy link

cd vk_raytracing_tutorial_KHR
mkdir build
cd build
cmake ..
make -j 40

Compiles shared sources successfully, fails during the linking step:

[100%] Linking CXX executable /home/chris/ray-tracing/bin_x64/vk_ray_tracing__advance_NV.exe
/usr/bin/ld: CMakeFiles/vk_ray_tracing_anyhit_NV.dir/hello_vulkan.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib64/libdl.so.2: error adding symbols: DSO missing from command line

libdl is installed via glibc-devel

Installed Packages
glibc-devel.x86_64  2.32-1.fc33

I think that the fix is going to be adding:

-ldl 

Somewhere in a CMakeLists target_link_library; I'll try that, and post the fix (if I get it working).

@ghost
Copy link

ghost commented Jan 3, 2023

Any idea on the fix so far? I've been unable to start the ray tracing tutorial.

@NBickford-NV NBickford-NV self-assigned this Jan 3, 2023
@NBickford-NV
Copy link
Contributor

NBickford-NV commented Jan 3, 2023

Hi @DannyLeWasTaken! I've just had a go at building this on Ubuntu 20.04 and CMake 3.24.1, but couldn't reproduce it (i.e. it seemed to link successfully) - here's the complete script I used to download and build:

git clone --recursive https://github.com/nvpro-samples/nvpro_core.git
git clone https://github.com/nvpro-samples/vk_raytracing_tutorial_KHR.git
cd vk_raytracing_tutorial_KHR && mkdir build && cd build
cmake ..
make -j

Running make VERBOSE=1, it looks like the linker command line now includes -ldl near the end (possibly from glfw, though I'm not 100% sure yet):

[ 25%] Linking CXX executable [omitted]/bin_x64/Release/vk_ray_tracing__advance_KHR_app
cd [omitted]/vk_raytracing_tutorial_KHR/build/ray_tracing__advance && /usr/bin/cmake -E cmake_link_script CMakeFiles/vk_ray_tracing__advance_KHR.dir/link.txt --verbose=1
/usr/bin/c++ -O3 -DNDEBUG CMakeFiles/vk_ray_tracing__advance_KHR.dir/hello_vulkan.cpp.o CMakeFiles/vk_ray_tracing__advance_KHR.dir/main.cpp.o CMakeFiles/vk_ray_tracing__advance_KHR.dir/offscreen.cpp.o CMakeFiles/vk_ray_tracing__advance_KHR.dir/raytrace.cpp.o "CMakeFiles/vk_ray_tracing__advance_KHR.dir/[omitted]/nvpro_core/nvp/perproject_globals.cpp.o" "CMakeFiles/vk_ray_tracing__advance_KHR.dir/mnt/c/Users/nbickford/Documents/GitHub/nvpro-samples-test/nvpro_core/nvvk/nsight_aftermath_vk.cpp.o" CMakeFiles/vk_ray_tracing__advance_KHR.dir/__/common/obj_loader.cpp.o -o [omitted]/bin_x64/Release/vk_ray_tracing__advance_KHR_app  /usr/lib/x86_64-linux-gnu/libvulkan.so -lXxf86vm [omitted]/bin_x64/Release/libnvpro_core_vk.a /usr/lib/x86_64-linux-gnu/libvulkan.so /usr/lib/x86_64-linux-gnu/libvulkan.so -lXxf86vm /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libXext.so ../nvpro_core/third_party/glfw/src/libglfw3.a /usr/lib/x86_64-linux-gnu/librt.so -lm -ldl /usr/lib/x86_64-linux-gnu/libX11.so -lpthread ../nvpro_core/third_party/libimgui.a

My best guess is that the mechanism that's adding the -ldl here is breaking somehow. Could you post what OS and compiler versions you're using, if possible? I can set up a clean OS image and try to reproduce this build issue there.

Thanks!

@nvmheyer
Copy link
Contributor

nvmheyer commented Jan 4, 2023

@chrisdonlan what build environment are you using?

I'm confused as to which sample you're attempting to build. The error message posted indicates you're attempting to build
https://github.com/nvpro-samples/vk_raytracing_tutorial_NV which is deprecated.

Please try building the KHR sample instead.

@ghost
Copy link

ghost commented Jan 4, 2023

@neilbickford-nv Ah, the error seemed to lie in the fact that my Windows 10 device had a space in it's user file. As such, the program ended up searching for directories in "Le" user folder which did not exist when the user folder existed in "Danny Le". I kinda ended up borking my system trying to arrogantly to fix the problem by changing my user folder name so I sadly don't have the logs with me any more. Sorry!

@NBickford-NV
Copy link
Contributor

@DannyLeWasTaken - ah, thanks, good to know! Best of luck with the system recovery process!

@NBickford-NV
Copy link
Contributor

@DannyLeWasTaken Oh, one more question: since you mentioned using a Windows 10 device, but also libdl, are you using WSL2? If so, it might be easier to test running these samples under Windows directly; note that while we support building and running on both Windows and native Linux, and building on WSL2, WSL2 does not yet support Vulkan hardware acceleration.

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

4 participants