Giter VIP home page Giter VIP logo

Comments (13)

waruqi avatar waruqi commented on July 20, 2024 1

文档也没错,单独切也是可以的,但你得切对 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.

star-hengxing avatar star-hengxing commented on July 20, 2024

要切整个工具链,而不是单独指定 cc

from xmake.

heheda123123 avatar heheda123123 commented on July 20, 2024

要切整个工具链,而不是单独指定 cc

我看xmake文档这样写的
image

from xmake.

heheda123123 avatar heheda123123 commented on July 20, 2024

切了工具链就可以了。不过上面提到的文档可以改一下

from xmake.

waruqi avatar waruqi commented on July 20, 2024

文档也没错,单独切也是可以的,但你得切对 arch, msvc 里面的对应 arch 的 clang-cl.exe ,你自己额外安装 clang-cl 加了 path,就会优先用你的,被干扰了而已。

from xmake.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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
image

from xmake.

heheda123123 avatar heheda123123 commented on July 20, 2024

文档也没错,单独切也是可以的,但你得切对 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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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.

Issues-translate-bot avatar Issues-translate-bot commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.