xmake icon indicating copy to clipboard operation
xmake copied to clipboard

win7下xmake编译cuda出错

Open zt449569708 opened this issue 3 years ago • 3 comments

现象:在cmd下,通过xmake编译xmake通过的CUDA测试代码console,出现问题如下: 图片

从图中可以看出,编译到25%就退出来,也没提示任何的错误信息。

版本: xmake:v2.6.2+HEAD.90e499cb2 操作系统:win7 vs : vs2019

zt449569708 avatar Jan 12 '22 13:01 zt449569708

应该是吧 xmake 搞跪了,这种情况很少,之前只有一次低版本 vs 编译器的bug 吧 xmake 搞跪的情况出现。。

你可以先自己调下 https://github.com/xmake-io/xmake/blob/edcbcd5127a9f3b7bbe93d34aa1921856db9a8fb/xmake/modules/core/tools/nvcc.lua#L334 这块,我暂时没环境复现。。回头有环境了,我再看看

waruqi avatar Jan 12 '22 14:01 waruqi

系统的用户名绝对不能有中文,有中文的话如果系统某些语言选项设置不正确是无法编译成功cuda程序的

soloist-v avatar Feb 20 '22 16:02 soloist-v

如果中文编码问题,那可能跟 vs 有关,因为 nvcc 会内部调用 cl.exe ,但是 cl.exe 对 unicode 的处理支持,需要一些特殊处理。。

可以在

https://github.com/xmake-io/xmake/blob/6654a889d2403e8cb940d3b6bd9ad54de17bfece/xmake/modules/core/tools/nvcc.lua#L367

这行,替换成 vstool.iorunv 调用,来尝试解决验证这个问题。

参考

https://github.com/xmake-io/xmake/blob/5ffe41db0e46e5c86f034a3059f70fa3d364df43/xmake/modules/core/tools/cl.lua#L448

并导入相关模块:

import("private.tools.vstool")

waruqi avatar Feb 21 '22 02:02 waruqi