xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.86k stars 774 forks source link

xmake在Ubuntu上无法找到VulkanSDK #3767

Closed HuajiKojima closed 1 year ago

HuajiKojima commented 1 year ago

Xmake 版本

2.7.9

操作系统版本和架构

Ubuntu 22.04.1

描述问题

在Ubuntu 22.04.1安装VulkanSDK并配置好环境变量之后,运行项目中的xmake.lua出现The packages(vulkansdk) not found, please run "xmake repo -u" first!,但输入xmake l find_package vulkansdk却是如下结果: 屏幕截图 2023-05-22 191155 不过在windows平台上生成VS项目或者是直接生成exe均没有问题。 与#3268的问题相似,但是这里是纯C++项目,不包含qt的任何东西。同时,在xmake.lua里面加上system = true依旧不起作用。

期待的结果

在相似情况下可以设置vulkansdk的路径。

工程配置

set_project("ShadowPlay2")
set_arch("x64")
set_warnings("all")
add_rules("mode.debug", "mode.release")

add_requires("vulkansdk", "glfw", "glm")

target("ShadowPlay2")
    set_kind("shared")
    set_targetdir("ShadowPlay2")
    add_files("ShadowPlay2/Core/RHI/*.cpp")
    add_files("ShadowPlay2/Core/Memory/*.cpp")
    add_files("ShadowPlay2/*.cpp")
    add_headerfiles("ShadowPlay2/Core/RHI/*.h")
    add_headerfiles("ShadowPlay2/Core/Memory/*.h")
    add_headerfiles("ShadowPlay2/*.h")
    add_includedirs("ShadowPlay2")
    add_packages("vulkansdk", "glfw", "glm")

    set_pcxxheader("ShadowPlay2/ShadowPreCompileHeader.h")

    add_defines("SHADOWPLAY_CORE_EXPORT")
    add_defines("SHADOWPLAY_ACC_AVX")
    add_defines("SHADOWPLAY_API_VK")
    if is_plat("windows") then
        add_defines("SHADOWPLAY_PLAT_WIN")
    end
    if is_plat("linux") then
        add_defines("SHADOWPLAY_PLAT_LINUX")
    end
    if is_mode("debug") then
        add_defines("SHADOWPLAY_DEBUG")
    end

    set_symbols("debug")
    set_strip("all")

    set_basename("ShadowPlay2_$(mode)_$(arch)")
    set_targetdir("bin/$(arch)/$(mode)")
    set_objectdir("bin-int/$(arch)/$(mode)")
target_end()

附加信息和错误日志

No response

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake cannot find VulkanSDK on Ubuntu

waruqi commented 1 year ago
xrepo update-repo
xrepo fetch -vD vulkansdk
xmake f -cvD

执行下,看看能找到么

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


xrepo update-repo
xrepo fetch -vD vulkansdk
xmake f -cvD

Execute it and see if you can find it

HuajiKojima commented 1 year ago
xrepo update-repo
xrepo fetch -vD vulkansdk
xmake f -cvD

执行下,看看能找到么

感谢解答,但是还是无法找到,以下是xmake返回的结果: 屏幕截图 2023-05-22 224427 屏幕截图 2023-05-22 224650 屏幕截图 2023-05-22 224714

waruqi commented 1 year ago

你可以在 xmake-repo 里调下 https://github.com/xmake-io/xmake-repo/blob/6f6bcf4c91736b579d7b5ee16094cca13f4dfd82/packages/v/vulkansdk/xmake.lua#L22 这块代码,看看找的到么,进去了么。。

你可以把 xmake-repo clone 后,走 xmake repo --add local /xxx/xmake-repo 关联后调试。。

git clone  ....xmake-repo
xmake repo --add local /xxx/xmake-repo
xmake f -cvD
Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


You can adjust https://github.com/xmake-io/xmake-repo/blob/6f6bcf4c91736b579d7b5ee16094cca13f4dfd82/packages/v/vulkansdk/xmake.lua#L22 in xmake-repo to see if you can find it , did you go in? .

You can clone xmake-repo and run xmake repo --add local /xxx/xmake-repo to associate and debug. .

git clone ....xmake-repo
xmake repo --add local /xxx/xmake-repo
xmake f -cvD
HuajiKojima commented 1 year ago

你可以在 xmake-repo 里调下 https://github.com/xmake-io/xmake-repo/blob/6f6bcf4c91736b579d7b5ee16094cca13f4dfd82/packages/v/vulkansdk/xmake.lua#L22 这块代码,看看找的到么,进去了么。。

你可以把 xmake-repo clone 后,走 xmake repo --add local /xxx/xmake-repo 关联后调试。。

git clone  ....xmake-repo
xmake repo --add local /xxx/xmake-repo
xmake f -cvD

尝试clone下来,使用您给的方案试了一下,目前的结果是这样:还是无法生成 屏幕截图 2023-05-23 103143 屏幕截图 2023-05-23 103114

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


You can adjust https://github.com/xmake-io/xmake-repo/blob/6f6bcf4c91736b579d7b5ee16094cca13f4dfd82/packages/v/vulkansdk/xmake.lua#L22 in xmake-repo to see if you can find it Well, did you go in? .

After you can clone xmake-repo, run xmake repo --add local /xxx/xmake-repo to associate and debug. .

git clone ....xmake-repo
xmake repo --add local /xxx/xmake-repo
xmake f -cvD

Try to clone it, and try it with the scheme you gave. The current result is this: it still cannot be generated Screenshot 2023-05-23 103143 Screenshot 2023-05-23 103114

waruqi commented 1 year ago

我是说按我说的 自己调试下包

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


I mean, according to what I said, debug the package yourself

waruqi commented 1 year ago

我这里可以,没啥问题。。dev 上我改进了下,增加对 vulkan apt 包的查找。。不过跟这个问题无关

ruki@66d64831d5e9:/tmp/test$ xmake f -cvD
checking for platform ... linux
checking for architecture ... x86_64
checking for gcc ... /usr/bin/gcc
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /usr/bin/gzip
checking for tar ... /usr/bin/tar
/usr/bin/git rev-parse HEAD
finding vulkansdk from xmake ..
checking for xmake::vulkansdk ... no
checking for xmake-repo::vulkansdk ... vulkansdk 
configure
{
    clean = true
    buildir = build
    ndk_stdcxx = true
    ccache = true
    arch = x86_64
    mode = release
    host = linux
    kind = static
    plat = linux
}
ruki@66d64831d5e9:/tmp/test$ xmake -rv
checking for gcc ... /usr/bin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for /usr/bin/gcc ... ok
checking for flags (-fPIC) ... ok
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O3) ... ok
checking for flags (-DNDEBUG) ... ok
[ 25%]: cache compiling.release src/main.cpp
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -isystem /mnt/1.3.243.0/x86_64/include -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
checking for g++ ... /usr/bin/g++
checking for the linker (ld) ... g++
checking for /usr/bin/g++ ... ok
checking for flags (-fPIC) ... ok
[ 50%]: linking.release test
/usr/bin/g++ -o build/linux/x86_64/release/test build/.objs/test/linux/x86_64/release/src/main.cpp.o -m64 -L/mnt/1.3.243.0/x86_64/lib -s -lvulkan
[100%]: build ok, spent 4.324s
HuajiKojima commented 1 year ago

感谢解答,我尝试了一下使用cmake::Vulkan的方式试了一下可以找到,貌似是环境变量的问题,重新配置并应用过后已经可以正常使用了。

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


Thanks for the answer. I tried to use cmake::Vulkan to find out. It seems to be a problem with environment variables. After reconfiguring and applying it, it can be used normally.