Closed yh-sb closed 4 weeks ago
you can open a pr to improve find_vulkansdk.lua to find it from mingw env.
But I have installed VulkanSDK in my system and appropriate env variables are present:
It should be found. You can add some logs to debug here.
The problem somewhere with {plat = opt.plat}
or opt
in:
https://github.com/xmake-io/xmake/blob/87630c8cf33105cc8c000e73cb7b67a2decfe02d/xmake/core/sandbox/modules/import/lib/detect/find_library.lua#L62
If plat is windows, find_file.lua
searches for vulkan-1.lib
which is correct. But if plat is mingw - it tries to search libvulkan-1.a
or libvulkan-1.dll
six times. So, the filename prefix lib
and extension .a
in case of mingw - definitely wrong for VulkanSDK.
At the end, filepath
in find_library.lua becomes empty and nothing found.
xmake/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
it will continue to find vulkan-1.lib if not found.
Bot detected the issue body's language is not English, translate it automatically.
xmake/xmake/core/sandbox/modules/import/lib/detect/find_library.lua
it will continue to find vulkan-1.lib if not found.
We need to improve vulkan package and find script.
diff --git a/xmake/modules/detect/sdks/find_vulkansdk.lua b/xmake/modules/detect/sdks/find_vulkansdk.lua
index 6ddeddd27..3d7b70993 100644
--- a/xmake/modules/detect/sdks/find_vulkansdk.lua
+++ b/xmake/modules/detect/sdks/find_vulkansdk.lua
@@ -36,7 +36,8 @@ function _find_vulkan_from_paths(paths, opt)
-- find library
local result = {links = {}, linkdirs = {}, includedirs = {}}
- local linkinfo = find_library(libname, paths, {suffixes = {libsuffix}})
+ local linkinfo = find_library(libname, paths, {suffixes = {libsuffix}, plat = "mingw"})
+ print(linkinfo)
if linkinfo then
result.sdkdir = path.directory(linkinfo.linkdir)
result.bindir = path.join(result.sdkdir, binsuffix)
$ mingw
$ xmake f -c
checking for platform ... mingw
checking for architecture ... x86_64
checking for mingw directory ... C:/Users/star/scoop/apps/msys2/2024-07-27/mingw64
{
link = "vulkan-1",
filename = "vulkan-1.lib",
kind = "static",
linkdir = "C:\Users\star\scoop\apps\vulkan\current\lib"
}
{
link = "vulkan-1",
filename = "vulkan-1.lib",
kind = "static",
linkdir = "C:\Users\star\scoop\apps\vulkan\current\lib"
}
{
link = "vulkan-1",
filename = "vulkan-1.lib",
kind = "static",
linkdir = "C:\Users\star\scoop\apps\vulkan\current\lib"
}
warning: The library vulkan for x86_64 is not found!
you can open a pr to improve it if it works.
thanks
Xmake Version
2.9.4
Operating System Version and Architecture
Windows 11 23H2 22631.4037
Describe Bug
This issue is specific only for
mingw
profile.When I add
vulkansdk
package to my root xmake.lua, then I see the following error:But I have installed VulkanSDK in my system and appropriate env variables are present:
Note: I am able to build project with vulkan using old CMake files. Just want to migrate to xmake. I am also able to build project with msvc windows profile.
From what I found in modules/detect/sdks/find_vulkansdk.lua, neither
_find_vulkan_from_paths
nor_find_vulkan_from_system
find vulkan.Expected Behavior
vulkansdk package found and project successfully built.
Project Configuration
Additional Information and Error Logs
xmake f -p mingw -vD -y
``` PS D:\dev\cpp\vulkan-app> xmake f -p mingw -vD -y checking for architecture ... x86_64 checking for mingw directory ... C:\Program Files\mydevtools\MinGW-w64 checkinfo: cannot runv(unzip.exe -v), No such file or directory checking for unzip ... no checking for 7z ... C:\Program Files\mydevtools\xmake\winenv\bin\7z checking for git ... ok checkinfo: cannot runv(gzip.exe --version), No such file or directory checking for gzip ... no checking for ping ... ok pinging the host(gitlab.com) ... 2 ms pinging the host(github.com) ... 35 ms pinging the host(gitee.com) ... 151 ms git rev-parse HEAD finding vulkan from pkgconfig .. checkinfo: cannot runv(pkg-config.exe --version), No such file or directory checking for pkg-config ... no checkinfo: cannot runv(pkgconf.exe --version), No such file or directory checking for pkgconf ... no checking for pkgconfig::vulkan ... no checking for cmake ... no checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe checking for Microsoft Visual Studio (x64) version ... 2022 checking for Microsoft C/C++ Compiler (x64) version ... 19.40.33812 checking for cmake ... no checking for cmake ... no checking for cmake ... ok checking for xmake-repo::opengl ... opengl finding glfw from xmake .. checking for xmake::glfw ... glfw 3.4 finding vulkan-hpp from xmake .. checking for xmake::vulkan-hpp ... vulkan-hpp v1.3.290 finding vulkansdk from xmake .. checking for xmake::vulkansdk ... no finding vulkansdk from find_vulkansdk .. finding vulkansdk from vcpkg .. finding vulkansdk from conan .. finding vulkansdk from pkgconfig .. finding vulkansdk from system .. checking for x86_64-w64-mingw32-gcc ... C:\Program Files\mydevtools\MinGW-w64\bin\x86_64-w64-mingw32-gcc checking for the c compiler (cc) ... x86_64-w64-mingw32-gcc > "C:\\Program Files\\mydevtools\\MinGW-w64\\bin\\x86_64-w64-mingw32-gcc" -c -m64 -o C:\Users\Y\AppData\Local\Temp\.xmake\240829\_91A698D61C054B0085236E66D4DBA120.o C:\Users\Y\AppData\Local\Temp\.xmake\240829\_775FB00633BC4F66BF87D39CCDE5CF30.c checking for C:\Program Files\mydevtools\MinGW-w64\bin\x86_64-w64-mingw32-gcc ... ok checking for flags (-fdiagnostics-color=always) ... ok > x86_64-w64-mingw32-gcc "-fdiagnostics-color=always" "-m64" checking for x86_64-w64-mingw32-g++ ... C:\Program Files\mydevtools\MinGW-w64\bin\x86_64-w64-mingw32-g++ checking for the c++ compiler (cxx) ... x86_64-w64-mingw32-g++ checking for x86_64-w64-mingw32-g++ ... C:\Program Files\mydevtools\MinGW-w64\bin\x86_64-w64-mingw32-g++ checking for the linker (ld) ... x86_64-w64-mingw32-g++ > "C:\\Program Files\\mydevtools\\MinGW-w64\\bin\\x86_64-w64-mingw32-g++" -o C:\Users\Y\AppData\Local\Temp\.xmake\240829\_91A698D61C054B0085236E66D4DBA120.b C:\Users\Y\AppData\Local\Temp\.xmake\240829\_91A698D61C054B0085236E66D4DBA120.o -m64 -lvulkansdk C:/Program Files/mydevtools/MinGW-w64/bin/../lib/gcc/x86_64-w64-mingw32/15.0.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lvulkansdk: No such file or directory collect2.exe: error: ld returned 1 exit status > checking for c links(vulkansdk) > checking for c snippet(find_package/vulkansdk) checkinfo: ...gramdir\core\sandbox\modules\import\core\tool\linker.lua:75: @programdir\core\sandbox\modules\os.lua:378: execv(C:\Program Files\mydevtools\MinGW-w64\bin\x86_64-w64-mingw32-g++ -o C:\Users\Y\AppData\Local\Temp\.xmake\240829\_91A698D61C054B0085236E66D4DBA120.b C:\Users\Y\AppData\Local\Temp\.xmake\240829\_91A698D61C054B0085236E66D4DBA120.o -m64 -lvulkansdk) failed(1) stack traceback: [C]: in function 'error' [@programdir\core\base\os.lua:973]: [@programdir\core\sandbox\modules\os.lua:378]: in function 'execv' [@programdir\modules\core\tools\gcc.lua:583]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:275]: [@programdir\core\tool\linker.lua:222]: in function 'link' [...gramdir\core\sandbox\modules\import\core\tool\linker.lua:73]: in function 'link' [@programdir\modules\lib\detect\check_cxsnippets.lua:249]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:275]: in function 'trycall' [@programdir\core\sandbox\modules\try.lua:117]: in function 'try' [@programdir\modules\lib\detect\check_cxsnippets.lua:236]: [@programdir\modules\package\manager\system\find_package.lua:103]: [@programdir\modules\package\manager\find_package.lua:84]: in function '_find_package_with_builtin_rule' [@programdir\modules\package\manager\find_package.lua:130]: in function '_find_package' [@programdir\modules\package\manager\find_package.lua:194]: [@programdir\modules\lib\detect\find_package.lua:109]: [@programdir\core\package\package.lua:1852]: in function '_fetch_library' [@programdir\core\package\package.lua:2022]: in function 'fetch' [...modules\private\action\require\impl\install_packages.lua:335]: in function 'jobfunc' [@programdir\modules\async\runjobs.lua:241]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:275]: in function 'trycall' [@programdir\core\sandbox\modules\try.lua:117]: in function 'try' [@programdir\modules\async\runjobs.lua:223]: in function 'cotask' [@programdir\core\base\scheduler.lua:406]: checking for vulkansdk ... no error: @programdir\core\main.lua:329: @programdir\modules\private\action\require\install.lua:53: The packages(vulkansdk) not found, please run `xmake repo -u` first! stack traceback: [C]: in function 'error' [@programdir\core\base\os.lua:973]: [@programdir\modules\private\action\require\install.lua:53]: in function '_check_missing_packages' [@programdir\modules\private\action\require\install.lua:87]: [@programdir\actions\config\main.lua:391]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:275]: [@programdir\core\base\task.lua:491]: in function 'run' [@programdir\core\main.lua:327]: in function 'cotask' [@programdir\core\base\scheduler.lua:406]: stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:973: in function 'base/os.raiselevel' (...tail calls...) @programdir\core\main.lua:329: in upvalue 'cotask' @programdir\core\base\scheduler.lua:406: in function <@programdir\core\base\scheduler.lua:399> ```