Comments (13)
文档也没错,单独切也是可以的,但你得切对 arch, msvc 里面的对应 arch 的 clang-cl.exe ,你自己额外安装 clang-cl 加了 path,就会优先用你的,被干扰了而已。
额外安装 clang-cl 是指啥?我没装其他的呀,我只从visual studio installer里面安装了clang-cl。然后把它加到环境变量的
PS C:\Users\Administrator\temp\test_xmake\test_clang> which clang-cl C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin\clang-cl.exe
那还是 path 干扰了。。
实际这边跟 cl.exe 一样,都是使用指定 arch 下的 clang-cl.exe ,前面有 arch 子目录的。走 xmake f --toolchain=clang-cl 会自动根据 arch 去找对 clang-cl.exe ,如果只是通过 --cxx=clang-cl.exe 设置,你得设置对,否则用了 path 的,有可能不匹配 arch
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\Llvm\\x64\\bin\\clang-cl.exe"
from xmake.
要切整个工具链,而不是单独指定 cc
from xmake.
要切整个工具链,而不是单独指定 cc
from xmake.
切了工具链就可以了。不过上面提到的文档可以改一下
from xmake.
文档也没错,单独切也是可以的,但你得切对 arch, msvc 里面的对应 arch 的 clang-cl.exe ,你自己额外安装 clang-cl 加了 path,就会优先用你的,被干扰了而已。
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
Title: specifies the clang-cl compiler, and the compiled program is always a 32-bit program
Xmake version
2.9.2+dev.ecb16eba3
Operating system version and architecture
Windows 11
Describe the problem
Create a default project and set it to use clang-cl. The compilation is successful, but it seems that the compiled obj is 32-bit, causing the link to fail.
PS C:\Users\Administrator\temp\test_xmake> xmake create -l c++ -P test_clang-cl
create test_clang-cl ...
[+]: src\main.cpp
[+]: xmake.lua
[+]: .gitignore
Create OK!
PS C:\Users\Administrator\temp\test_xmake> cd .\test_clang-cl\
PS C:\Users\Administrator\temp\test_xmake\test_clang-cl> xmake f --cc=clang-cl --cxx=clang-cl -c
checking for platform...windows
checking for architecture...x64
checking for Microsoft Visual Studio (x64) version ... 2022
PS C:\Users\Administrator\temp\test_xmake\test_clang-cl> xmake -v -D
checking for clang-cl...ok
checking for flags (-O2) ... ok
> clang-cl "-O2"
checking for flags (-DNDEBUG) ... ok
> clang-cl "-DNDEBUG"
[50%]: cache compiling.release src\main.cpp
clang-cl -c -O2 /EHsc -DNDEBUG -Fobuild\.objs\test_clang-cl\windows\x64\release\src\main.cpp.obj src\main.cpp
checking for flags (-fcolor-diagnostics) ... ok
> clang-cl "-fcolor-diagnostics"
checking for flags (-fansi-escape-codes) ... ok
> clang-cl "-fansi-escape-codes"
[75%]: linking.release test_clang-cl.exe
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\link.exe" -nologo - dynamicbase -nxcompat -machine:x64 /opt:ref /opt:icf -out:build\windows\x64\release\test_clang-cl.exe build\.objs\test_clang-cl\windows\x64\release\src\main. cpp.obj
error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:325: @programdir\actions\build\kinds\binary. lua:53: @programdir\modules\core\tools\link.lua:175: build\.objs\test_clang-cl\windows\x64\release\src\main.cpp.obj : fatal error LNK1112: Module computer type " x86" conflicts with target computer type "x64"
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:221]: in function 'link'
[@programdir\actions\build\kinds\binary.lua:53]: in function 'callback'
[@programdir\modules\core\project\depend.lua:217]: in function 'on_changed'
[@programdir\actions\build\kinds\binary.lua:41]: in function '_do_link_target'
[@programdir\actions\build\kinds\binary.lua:83]:
[@programdir\actions\build\kinds\binary.lua:110]: in function '_link_target'
[@programdir\actions\build\kinds\binary.lua:138]: 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]:
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>
Expected results
Correctly handle the schema according to the project settings
Project configuration
C++ project created by default
Additional information and error logs
As shown above
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
To cut the entire tool chain instead of specifying cc individually
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
To cut the entire tool chain instead of specifying cc individually
I saw that the xmake documentation says this
from xmake.
文档也没错,单独切也是可以的,但你得切对 arch, msvc 里面的对应 arch 的 clang-cl.exe ,你自己额外安装 clang-cl 加了 path,就会优先用你的,被干扰了而已。
额外安装 clang-cl 是指啥?我没装其他的呀,我只从visual studio installer里面安装了clang-cl。然后把它加到环境变量的
PS C:\Users\Administrator\temp\test_xmake\test_clang> which clang-cl
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin\clang-cl.exe
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
Just cut the tool chain. However, the documents mentioned above can be modified.
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
The document is correct. You can switch it alone, but you have to switch to arch. The clang-cl.exe in msvc corresponds to arch. If you install clang-cl yourself and add the path, yours will be used first and you will be disturbed. That’s all.
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
The document is correct. You can switch it alone, but you have to switch to arch. The clang-cl.exe in msvc corresponds to arch. If you install clang-cl yourself and add the path, yours will be used first. It's just interference.
What does it mean to install additional clang-cl? I didn't install anything else. I only installed clang-cl from the visual studio installer. Then add it to the environment variables
PS C:\Users\Administrator\temp\test_xmake\test_clang> which clang-cl
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin\clang-cl.exe
from xmake.
Bot detected the issue body's language is not English, translate it automatically.
The document is correct. You can switch it alone, but you have to switch to arch. The clang-cl.exe in msvc corresponds to arch. If you install clang-cl yourself and add the path, yours will be used first. It's just been disturbed.
What does it mean to additionally install clang-cl? I didn't install anything else. I only installed clang-cl from the visual studio installer. Then add it to the environment variables
PS C:\Users\Administrator\temp\test_xmake\test_clang> which clang-cl C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin\clang-cl.exe
Then path interferes. .
In fact, it is the same as cl.exe. clang-cl.exe under the specified arch is used, and there is an arch subdirectory in front.
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Tools\\Llvm\\x64\\bin\\clang-cl.exe"
from xmake.
Related Issues (20)
- The behavior of `set_optimize` is inconsistent on MSVC-related platforms. HOT 5
- Windows下shared目标缺少定义_WINDLL宏 HOT 2
- Macos下Qt开发使用add_frameworks添加的frameworks没有添加到链接命令中 HOT 3
- plugin.compile_commands.autoupdate 报错 HOT 17
- incorrect conan profile generated when using vs 17.1x HOT 1
- xmake添加多个deps时,deps内部有相互依赖的情况下编译无法通过 HOT 24
- Please add support for IAR ARM embedded toolchain HOT 16
- links not found when add_deps("openmp") HOT 10
- 支持在 xmake-repo 下发 toolchain 和 opiton HOT 9
- 添加`qt5widget`包后,xmake的qt规则无法自动识别qt路径 HOT 1
- How to set llvm-rc's options on msys2/clangarm64? HOT 1
- No way to set build type in `qt.deploy.flags` passed to windeployqt HOT 1
- Improve copy pdb when using ninja on Windows HOT 11
- 引用外部库时如何使用预编译头文件的功能 HOT 5
- 解决rc文件不会重新编译的问题 HOT 15
- 升级 xmake 后,包构建失败:package(nlohmann-json): links not found! HOT 4
- Linux系统编译多出-framework选项 HOT 13
- Cannot create static library providing C++ module HOT 11
- 多target的项目中,使用add_shflags("/NOENTRY")的纯资源动态库项目会对其它shared项目产生影响 HOT 3
- 本地定义的 package 无法替换掉间接依赖 HOT 27
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xmake.