ingowald / optix7course

Apache License 2.0
452 stars 80 forks source link

Windows GLFW & Vulkan build issue. #5

Closed rogerallen closed 3 years ago

rogerallen commented 3 years ago

Hi there,

I think I followed the instructions correctly, but I'm not able to get ex03_testFrameInWindow to build. The other two examples before this build & run fine. Looks like I'm somehow not linking the right Vulkan library? Any help figuring this out would be appreciated, googling doesn't seem to give relevant results. Thanks in advance!

I'm on Windows 10, using Visual Studio 2019 CE and used CMake 3.17.1 to configure & generate. I tried with GLFW_VULKAN_STATIC both unselected & selected. Not quite sure what else to try.

Errors:

5>   Creating library C:/Users/rallen/Documents/Devel/Optix/optix7course/build/Debug/ex03_testFrameInWindow.lib and object C:/Users/rallen/Documents/Devel/Optix/optix7course/build/Debug/ex03_testFrameInWindow.exp
5>glfw3.lib(vulkan.obj) : error LNK2019: unresolved external symbol vkGetInstanceProcAddr referenced in function glfwGetInstanceProcAddress
5>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol vkGetInstanceProcAddr
5>glfw3.lib(vulkan.obj) : error LNK2019: unresolved external symbol vkEnumerateInstanceExtensionProperties referenced in function _glfwInitVulkan
5>C:\Users\rallen\Documents\Devel\Optix\optix7course\build\Debug\ex03_testFrameInWindow.exe : fatal error LNK1120: 2 unresolved externals

Full build output here:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
2>------ Build started: Project: gdt, Configuration: Debug x64 ------
3>------ Build started: Project: glfWindow, Configuration: Debug x64 ------
4>------ Build started: Project: glfw, Configuration: Debug x64 ------
3>Building Custom Rule C:/Users/rallen/Documents/Devel/Optix/optix7course/common/glfWindow/CMakeLists.txt
4>Building Custom Rule C:/Users/rallen/Documents/Devel/Optix/optix7course/common/3rdParty/glfw/src/CMakeLists.txt
2>Building Custom Rule C:/Users/rallen/Documents/Devel/Optix/optix7course/common/gdt/CMakeLists.txt
2>gdt.cpp
3>GLFWindow.cpp
2>gdt.vcxproj -> C:\Users\rallen\Documents\Devel\Optix\optix7course\build\Debug\gdt.lib
3>glfWindow.vcxproj -> C:\Users\rallen\Documents\Devel\Optix\optix7course\build\Debug\glfWindow.lib
4>context.c
4>init.c
4>input.c
4>monitor.c
4>vulkan.c
4>window.c
4>win32_init.c
4>win32_joystick.c
4>win32_monitor.c
4>win32_time.c
4>win32_thread.c
4>win32_window.c
4>wgl_context.c
4>egl_context.c
4>osmesa_context.c
4>Generating Code...
4>glfw.vcxproj -> C:\Users\rallen\Documents\Devel\Optix\optix7course\build\Debug\glfw3.lib
5>------ Build started: Project: ex03_testFrameInWindow, Configuration: Debug x64 ------
5>Building NVCC ptx file example03_inGLFWindow/cuda_compile_ptx_1_generated_devicePrograms.cu.ptx
5>devicePrograms.cu
5>C:/Users/rallen/Documents/Devel/Optix/optix7course/example03_inGLFWindow/devicePrograms.cu(28): warning : extern declaration of the entity optixLaunchParams is treated as a static definition
5>
5>devicePrograms.cu
5>Building Custom Rule C:/Users/rallen/Documents/Devel/Optix/optix7course/example03_inGLFWindow/CMakeLists.txt
5>compiling (and embedding ptx from) devicePrograms.cu
5>cuda_compile_ptx_1_generated_devicePrograms.cu.ptx_embedded.c
5>SampleRenderer.cpp
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(83,5): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(84,5): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(157,9): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(158,9): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\Users\rallen\Documents\Devel\Optix\optix7course\example03_inGLFWindow\SampleRenderer.cpp(382,40): warning C4554: '|': check operator precedence for possible error; use parentheses to clarify precedence
5>main.cpp
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(83,5): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(84,5): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(157,9): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.2.0\include\optix_stubs.h(158,9): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
5>Generating Code...
5>   Creating library C:/Users/rallen/Documents/Devel/Optix/optix7course/build/Debug/ex03_testFrameInWindow.lib and object C:/Users/rallen/Documents/Devel/Optix/optix7course/build/Debug/ex03_testFrameInWindow.exp
5>glfw3.lib(vulkan.obj) : error LNK2019: unresolved external symbol vkGetInstanceProcAddr referenced in function glfwGetInstanceProcAddress
5>glfw3.lib(win32_window.obj) : error LNK2001: unresolved external symbol vkGetInstanceProcAddr
5>glfw3.lib(vulkan.obj) : error LNK2019: unresolved external symbol vkEnumerateInstanceExtensionProperties referenced in function _glfwInitVulkan
5>C:\Users\rallen\Documents\Devel\Optix\optix7course\build\Debug\ex03_testFrameInWindow.exe : fatal error LNK1120: 2 unresolved externals
5>Done building project "ex03_testFrameInWindow.vcxproj" -- FAILED.
========== Build: 4 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
rogerallen commented 3 years ago

Well, I thought I tried with GLFW_VULKAN_STATIC both unselected & selected, but retracing my steps with Ingo & Nathan shows I must have always selected GLFW_VULKAN_STATIC in the cmake setup.

In any event, maybe this issue helps someone else--make sure GLFW_VULKAN_STATIC is NOT selected in the cmake setup step.