Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Cant link with nvml.lib(nvml.dll) with VS2022 #25

Open
pcarret opened this issue Jul 3, 2023 · 3 comments
Open

Cant link with nvml.lib(nvml.dll) with VS2022 #25

pcarret opened this issue Jul 3, 2023 · 3 comments

Comments

@pcarret
Copy link

pcarret commented Jul 3, 2023

Hello,

During compilation with VS2022 of vk_raytrace.exe I ended with an error I can't fix.

\vk_raytrace\out\build\x64-Debug\nvml.lib(nvml.dll) : error LNK2001: symbole externe non résolu __delayLoadHelper2

I tried to add

C:\Program Files\NVIDIA Corporation\NVSMI\nvml.dll
C:\Program Files\NVIDIA Corporation\NVSMI\nvml.lib

I have installed latest CUDA 12.2
https://developer.nvidia.com/gpu-deployment-kit says :
The GPU Deployment Kit is part of the CUDA Toolkit, in versions 8 and later, and is no longer available as a separate download.

I do not know how to proceed

@mklefrancois
Copy link
Collaborator

Hi, there is something unusual in your log, the nvml.lib shouldn't show up in the build directory.
Maybe you could try re-running CMake.

  • Clear the out\build directory
  • cd to the vk_raytrace
  • mkdir build
  • cd build
  • cmake ..

Open the solution and try compiling again.

Note: The nvml DLL is part of the driver and will be store in a path similar to this:

C:\Windows\System32\DriverStore\FileRepository\nv_dispig.inf_amd64_46b941c49f6a5e3e\nvml.dll

@pcarret
Copy link
Author

pcarret commented Jul 4, 2023

Hi @mklefrancois ,

Thanks for your message and your help proposal
I tried to clean buil, rebuild etc.. but nothing worked

I find out that delayimp.lib hold the missing __delayLoadHelper2 symbol
So I tried to add these two lines but without any success

  target_link_libraries(${PROJNAME} debug  "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/lib/x64/delayimp.lib")
  target_link_libraries(${PROJNAME} optimized "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/lib/x64/delayimp.lib")

Is there any way to get the vk_raytrace exe directly and use it from command line ?

@ynikanchyk
Copy link

@pcarret Not sure where you tried to add target_link_libraries mentioned but for me this works fine:

diff --git a/CMakeLists.txt b/CMakeLists.txt                                                                                                                                                                                                index cd662c6..7684636 100644                                                                                                                                                                                                               --- a/CMakeLists.txt                                                                                                                                                                                                                        +++ b/CMakeLists.txt                                                                                                                                                                                                                        @@ -80,6 +80,7 @@ _add_project_definitions(${PROJNAME})                                                                                                                                                                                      # For NVML, the DLL is loaded by the application                                                                                                                                                                                            if(MSVC)                                                                                                                                                                                                                                      set_target_properties(${PROJNAME} PROPERTIES LINK_FLAGS "/DELAYLOAD:nvml.dll")                                                                                                                                                           +  target_link_libraries(${PROJNAME} "delayimp.lib")                                                                                                                                                                                         endif()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 #--------------------------------------------------------------------------------------------------                                                                                                                                                                                                                                                                                                                                                                               

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

No branches or pull requests

3 participants