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

安装libtorch缺失cuda库 #5113

Open
Stehsaer opened this issue Sep 1, 2024 · 3 comments
Open

安装libtorch缺失cuda库 #5113

Stehsaer opened this issue Sep 1, 2024 · 3 comments
Labels

Comments

@Stehsaer
Copy link

Stehsaer commented Sep 1, 2024

Xmake 版本

v2.9.4+HEAD.e85b001f1

操作系统版本和架构

Windows 11 22631.4112

描述问题

libtorch开启cuda和openmp选项,安装libtorch本体成功后提示缺失cuda库

期待的结果

xrepo中补全CUDA库,或修改libtorch安装脚本,使得xmake能够在windows上面安装cuda支持的libtorch

工程配置

-- Requires
add_requires("libtorch", {config={cuda=true, openmp=true}})
-- target, mode等其他配置...
...

附加信息和错误日志

配置时的输出:

PS E:\Dev\sr\sr-cpp> xmake f -a x64 --toolchain=msvc -m debug
checking for platform ... windows
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.40.33814
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> libtorch v2.4.0 [runtimes:"MT", cuda:y, openmp:y, toolchains:"msvc"]
please input: y (y/n/m)
y
  => install libtorch v2.4.0 .. ok      
error: The packages(cuda) not found, please run `xmake repo -u` first!
warning: add_requires("libtorch") has unknown option: {config=table: 00000202D19912B0}!
warning: add -v for getting more warnings ..
PS E:\Dev\sr\sr-cpp> xmake repo -u                  
updating repositories .. ok
PS E:\Dev\sr\sr-cpp> xmake f -a x64 --toolchain=msvc -m debug 
checking for platform ... windows
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.40.33814
error: The packages(cuda) not found, please run `xmake repo -u` first!
warning: add_requires("libtorch") has unknown option: {config=table: 0000015680671FB0}!
warning: add -v for getting more warnings ..
PS E:\Dev\sr\sr-cpp> xrepo install cuda    
error: The packages(cuda) not found, please run `xrepo update-repo` first!
error: execv(C:\Users\Lenovo\xmake\xmake.exe require -j 18 --extra={system=false} cuda) failed(-1)

加上-vD参数后:

PS E:\Dev\sr\sr-cpp> xmake f -a x64 --toolchain=msvc -m debug -vD
checking for platform ... windows
checking for cl.exe ... D:\Tools\VS2022\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.33814
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Users\Lenovo\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
git rev-parse HEAD
checking for cl.exe ... D:\Tools\VS2022\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe
checking for the c compiler (cc) ... cl.exe
checking for cl.exe ... D:\Tools\VS2022\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe
checking for the c++ compiler (cxx) ... cl.exe
checking for Cuda SDK directory ... C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3
checking for cmake ... no
checking for cmake ... no
checking for cmake ... no
checking for cmake ... C:\Program Files\CMake\bin\cmake
checking for python ... no
checking for python3 ... no
checking for python ... no
checking for python2 ... no
checking for python ... no
checking for ninja ... no
checking for ninja ... no
checking for ninja ... no
checking for ninja ... ok
checking for link.exe ... D:\Tools\VS2022\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
checking for xmake-repo::openmp ... openmp 
finding cuda from xmake ..
checking for xmake::cuda ... no
finding cuda from vcpkg ..
finding cuda from conan ..
finding cuda 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
finding cuda from system ..
> D:\Tools\VS2022\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe -c -nologo -FoC:\Users\Lenovo\AppData\Local\Temp\.xmake\240901\_3D1A5E8C95854C7083B298F3182688E0.o C:\Users\Lenovo\AppData\Local\Temp\.xmake\240901\_775FB00633BC4F66BF87D39CCDE5CF30.c
> D:\Tools\VS2022\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\link.exe -nologo -dynamicbase -nxcompat -machine:x64 cuda.lib -out:C:\Users\Lenovo\AppData\Local\Temp\.xmake\240901\_3D1A5E8C95854C7083B298F3182688E0.b C:\Users\Lenovo\AppData\Local\Temp\.xmake\240901\_3D1A5E8C95854C7083B298F3182688E0.o
> checking for c links(cuda)
> checking for c snippet(find_package/cuda)
checkinfo: ...gramdir\core\sandbox\modules\import\core\tool\linker.lua:75: @programdir\modules\core\tools\link.lua:175: LINK : fatal error LNK1181: 无法打开输入文件“cuda.lib”

stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:973]:
    [@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: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 cuda ... no
finding nvtx from xmake ..
checking for xmake::nvtx ... no
checking for xmake-repo::nvtx ... nvtx 
finding openblas from xmake ..
checking for xmake::openblas ... openblas 0.3.27
finding libtorch from xmake ..
checking for xmake::libtorch ... libtorch v2.4.0
error: @programdir\core\main.lua:329: @programdir\modules\private\action\require\install.lua:53: The packages(cuda) 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 '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>
warning: add_requires("libtorch") has unknown option: {config=table: 00000202960A4CC0}!
warning: The library cudnn for x64 is not found!
@Stehsaer Stehsaer added the bug label Sep 1, 2024
@waruqi waruqi transferred this issue from xmake-io/xrepo Sep 1, 2024
@Issues-translate-bot
Copy link

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


Title: Install libtorch missing cuda library

@xq114
Copy link
Contributor

xq114 commented Sep 2, 2024

configs 不是 config

@Issues-translate-bot
Copy link

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


configs is not config

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

No branches or pull requests

3 participants