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

同时安装多个版本optix时,add_packages中添加版本限制报错 #5566

Closed
xdestiny110 opened this issue Oct 23, 2024 · 12 comments · Fixed by #5588
Closed

同时安装多个版本optix时,add_packages中添加版本限制报错 #5566

xdestiny110 opened this issue Oct 23, 2024 · 12 comments · Fixed by #5588
Labels

Comments

@xdestiny110
Copy link
Contributor

xdestiny110 commented Oct 23, 2024

Xmake Version

xmake v2.9.5+master.654f14971

Operating System Version and Architecture

windows 11

Describe Bug

同时安装optix的7.3.0与8.0.0后,使用add_requires("optix 8.0.0")无法正确识别8.0.0版本。如果去掉版本限制只能识别7.3.0

Expected Behavior

能够正确识别版本

Project Configuration

add_rules("mode.debug", "mode.release")
set_project("ROTW-Optix-XMake")
set_version("0.0.1")
add_requires("cuda", "optix 8.0.0", "stb", "assimp")

target("rtow")
    set_languages("cxx17")
    add_packages("cuda", "optix", "stb", "assimp")
    set_kind("binary")
    add_files("*.cpp")
    add_cugencodes("native")
    add_includedirs("../include")
    add_defines(
        "OPTIX_IR_FILE=R\"($(scriptdir)/$(buildir)/optix-ir/optix-ir.optixir)\"",
        "OUTPUT_DIR=R\"($(scriptdir)/$(buildir)/)\"",
        "ASSETS_DIR=R\"($(scriptdir)/assets/)\""
    )

Additional Information and Error Logs

�[0mchecking for cl.exe ... �[38;2;0;255;0;1mC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe�[0m
�[0mchecking for Microsoft Visual Studio (x64) version ... �[38;2;0;255;0;1m2019�[0m
�[0mchecking for Microsoft C/C++ Compiler (x64) version ... �[38;2;0;255;0;1m19.29.30156�[0m
�[0m�[38;2;255;255;0;1mcheckinfo: �[0;2mcannot runv(zig.exe version), No such file or directory�[0m
�[0mchecking for zig ... �[38;2;255;0;0;1mno�[0m
�[0m�[38;2;255;255;0;1mcheckinfo: �[0;2mcannot runv(zig.exe version), No such file or directory�[0m
�[0mchecking for zig ... �[38;2;255;0;0;1mno�[0m
�[0m�[38;2;255;255;0;1mcheckinfo: �[0;2mcannot runv(nim.exe --version), No such file or directory�[0m
�[0mchecking for nim ... �[38;2;255;0;0;1mno�[0m
�[0m�[38;2;255;255;0;1mcheckinfo: �[0;2mcannot runv(nim.exe --version), No such file or directory�[0m
�[0mchecking for nim ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for git ... �[38;2;0;255;0;1mok�[0m
�[0m�[38;2;255;255;0;1mcheckinfo: �[0;2mcannot runv(gzip.exe --version), No such file or directory�[0m
�[0mchecking for gzip ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for 7z ... �[38;2;0;255;0;1mC:\Users\aaa\xmake\winenv\bin\7z�[0m
git rev-parse HEAD
�[0mchecking for Cuda SDK directory ... �[38;2;0;255;0;1mC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7�[0m
finding cuda from xmake ..
�[0mchecking for xmake::cuda ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for xmake-repo::cuda ... �[38;2;0;255;0;1mcuda �[0m
finding optix from xmake ..
�[0mchecking for xmake::optix ... �[38;2;255;0;0;1mno�[0m
finding optix from vcpkg ..
finding optix from conan ..
finding optix from system ..
�[0mchecking for cl.exe ... �[38;2;0;255;0;1mC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe�[0m
�[0m�[2mchecking for the c compiler (cc) ... �[38;2;0;255;0;1mcl.exe�[0m
�[0m�[2m> "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" -c -nologo -FoC:\Users\aaa\AppData\Local\Temp\.xmake\241023\_0D0A0D72DB41496085C1167573A5B1E0.o C:\Users\aaa\AppData\Local\Temp\.xmake\241023\_775FB00633BC4F66BF87D39CCDE5CF30.c�[0m
�[0mchecking for cl.exe ... �[38;2;0;255;0;1mC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe�[0m
�[0m�[2mchecking for the c++ compiler (cxx) ... �[38;2;0;255;0;1mcl.exe�[0m
�[0mchecking for link.exe ... �[38;2;0;255;0;1mC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe�[0m
�[0m�[2mchecking for the linker (ld) ... �[38;2;0;255;0;1mlink.exe�[0m
�[0m�[2m> "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\link.exe" -nologo -dynamicbase -nxcompat -machine:x64 optix.lib -out:C:\Users\aaa\AppData\Local\Temp\.xmake\241023\_0D0A0D72DB41496085C1167573A5B1E0.b C:\Users\aaa\AppData\Local\Temp\.xmake\241023\_0D0A0D72DB41496085C1167573A5B1E0.o�[0m
�[0m�[2m> checking for c links(optix)�[0m
�[0m�[2m> checking for c snippet(find_package/optix)�[0m
�[0m�[38;2;255;255;0;1mcheckinfo:�[0;2m ...gramdir\core\sandbox\modules\import\core\tool\linker.lua:75: @programdir\modules\core\tools\link.lua:175: LINK : fatal error LNK1181: 无法打开输入文件“optix.lib”

stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:1004]:
    [@programdir\modules\core\tools\link.lua:175]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [@programdir\modules\core\tools\link.lua:150]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:241]:
    [@programdir\core\tool\linker.lua:232]: 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:241]: 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:73]:
    [@programdir\modules\package\manager\find_package.lua:86]: in function '_find_package_with_builtin_rule'
    [@programdir\modules\package\manager\find_package.lua:132]: in function '_find_package'
    [@programdir\modules\package\manager\find_package.lua:196]:
    [@programdir\modules\lib\detect\find_package.lua:86]:
    [@programdir\core\package\package.lua:1902]: in function '_fetch_library'
    [@programdir\core\package\package.lua:2072]: in function 'fetch'
    [...modules\private\action\require\impl\install_packages.lua:340]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:241]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:241]: 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]:
�[0m
�[0mchecking for optix ... �[38;2;255;0;0;1mno�[0m
finding stb from xmake ..
�[0mchecking for xmake::stb ... �[38;2;0;255;0;1mstb 2024.06.01�[0m
�[0mchecking for cmake ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for cmake ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for cmake ... �[38;2;255;0;0;1mno�[0m
�[0mchecking for cmake ... �[38;2;0;255;0;1mC:\Program Files\CMake\bin\cmake�[0m
finding zlib from xmake ..
�[0mchecking for xmake::zlib ... �[38;2;0;255;0;1mzlib v1.3.1�[0m
finding minizip from xmake ..
�[0mchecking for xmake::minizip ... �[38;2;0;255;0;1mminizip v1.2.13�[0m
finding assimp from xmake ..
�[0mchecking for xmake::assimp ... �[38;2;0;255;0;1massimp v5.4.3�[0m
�[0m�[1;38;2;255;0;0;1merror: �[0m@programdir\core\main.lua:329: @programdir\core\sandbox\modules\import\core\base\task.lua:65: @programdir\modules\private\action\require\install.lua:53: The packages(optix) not found, please run `xmake repo -u` first!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:1004]:
    [@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:241]:
    [@programdir\core\base\task.lua:491]: in function 'run'
    [@programdir\core\sandbox\modules\import\core\base\task.lua:63]: in function 'run'
    [@programdir\actions\build\main.lua:191]:
    [C]: in function 'xpcall'
    [@programdir\core\base\utils.lua:241]:
    [@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:1004: 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>�[0m
@Issues-translate-bot
Copy link

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


Title: When installing multiple versions of optix at the same time, adding version restrictions in add_packages reports an error

@star-hengxing
Copy link
Contributor

我没有 optix 环境,可以把包描述拷贝到项目里调试一下为啥没找到
https://github.com/xmake-io/xmake-repo/blob/fe4776272cd545199e4fa82d679dd75ab708e0d4/packages/o/optix/xmake.lua

@Issues-translate-bot
Copy link

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


I don’t have an optix environment. I can copy the package description into the project and debug why it’s not found.
https://github.com/xmake-io/xmake-repo/blob/fe4776272cd545199e4fa82d679dd75ab708e0d4/packages/o/optix/xmake.lua

@xdestiny110
Copy link
Contributor Author

@star-hengxing 尝试调试了一下,发现是

local inc = find_path("optix.h", paths, {suffixes = "include"})

这里会优先找到7.3.0的版本
想问下add_requires里面的version是否会传入包描述里面?或者这里应该如何处理比较合理?

@Issues-translate-bot
Copy link

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


@star-hengxing tried to debug it and found that it is

local inc = find_path("optix.h", paths, {suffixes = "include"})

Version 7.3.0 will be found here first.
I would like to ask whether the version in add_requires will be passed into the package description? Or how should it be handled more reasonably?

@star-hengxing
Copy link
Contributor

想问下add_requires里面的version是否会传入包描述里面?或者这里应该如何处理比较合理?

local version = package:version()
if version:gt("7.3.0") then
    -- balabala
else
    local inc = find_path("optix.h", paths, {suffixes = "include"})
end

@Issues-translate-bot
Copy link

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


I would like to ask whether the version in add_requires will be passed into the package description? Or how should it be handled more reasonably?

local version = package:version()
if version:gt("7.3.0") then
    -- balabala
else
    local inc = find_path("optix.h", paths, {suffixes = "include"})
end

@xdestiny110
Copy link
Contributor Author

local version = package:version()
if version:gt("7.3.0") then
    -- balabala
else
    local inc = find_path("optix.h", paths, {suffixes = "include"})
end

如果外面传入的version使用了>=的语义符号进行版本范围限制,在这里又应该怎么获取呢?

@Issues-translate-bot
Copy link

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


``lua
local version = package:version()
if version:gt("7.3.0") then
-- balabala
else
local inc = find_path("optix.h", paths, {suffixes = "include"})
end

If the version passed in from outside uses the semantic symbol >= to limit the version range, how should it be obtained here?

@star-hengxing
Copy link
Contributor

star-hengxing commented Oct 26, 2024

import("core.base.semver")
-- semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') => true
if semver.satisfies("7.3", package:version_str()) then
    -- balabala
end

@xdestiny110
Copy link
Contributor Author

发起了一个MR,麻烦 @star-hengxing review一下

@Issues-translate-bot
Copy link

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


I initiated a MR, please @star-hengxing review it

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

Successfully merging a pull request may close this issue.

3 participants