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

clang-cl compiler not found on Windows #12292

Closed
jsmolka opened this issue Jul 6, 2020 · 9 comments · Fixed by #12319
Closed

clang-cl compiler not found on Windows #12292

jsmolka opened this issue Jul 6, 2020 · 9 comments · Fixed by #12319
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@jsmolka
Copy link
Contributor

jsmolka commented Jul 6, 2020

Describe the bug
No CMAKE_CXX_COMPILER could be found. when trying to build with clang-cl with cmake on Windows. This just happens with the latest vcpkg version, previous ones worked.

Environment

  • OS: Windows
  • Compiler: clang-cl latest

To Reproduce

git clone https:/jsmolka/NanoboyAdvance
cd NanoboyAdvance
mkdir build
cd build
set VCPKG_ROOT=path/to/vcpkg
cmake -T clangcl ..

Full build instructions in the readme.

Expected behavior
The previous vcpkg version managed to compile.

Failure logs

-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:8 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
See also "C:/dev/code/NanoboyAdvance/build/CMakeFiles/CMakeOutput.log".
See also "C:/dev/code/NanoboyAdvance/build/CMakeFiles/CMakeError.log".

Logs are attached (some areas in German, I can translate if necessary).
CMakeError.log
CMakeOutput.log

Additional context
I first noticed this issue in a GitHub Actions workflow and therefore created an issue in the actions repo. The answer is worth a read and gives a possible explanation.

@BillyONeal
Copy link
Member

The triplet x64-windows is intended to mean the MSVC compiler, and the recent binary caching change triggering this is a reflection of that; perhaps this is effectively a request to add x64-windows-clang or similar?

@jsmolka
Copy link
Contributor Author

jsmolka commented Jul 7, 2020

This would be a great addition but I don't think it's required for this issue. clang-cl tries to be a drop-in replacement (ABI, arguments, ...) so compiling the libraries with MSVC is no problem. But for the application itself I would like to have the possibility to choose a specific compiler (due to some MSVC template limitations) and vcpkg shouldn't interfere with that.

@MVoz
Copy link
Contributor

MVoz commented Jul 7, 2020

cmake -T clangcl .. this is not correct
->> cmake -G"V... S... ver" -T clangcl
or

cmake -G"Ninja" -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl

@Neumann-A
Copy link
Contributor

in triplet file:

set(ENV{CC} clang-cl)
set(ENV{CXX} clang-cl)

don't forget to add the path for clang-cl to PATH in the vcpkg environment or use the fullpath.

@jsmolka
Copy link
Contributor Author

jsmolka commented Jul 7, 2020

@voskrese my version should be equal to your first one (cmake selects Visual Studio 16 2019 as default generator if none is supplied) and the second version fails with the following error logs.

CMakeOutput.log
CMakeError.log

I success generating the solution with cmake -T clangcl -DCMAKE_CXX_COMPILER="path/to/clang-cl.exe" .. but then building itself failed with an error about disabled exceptions (which is nowhere to be seen in the cmake file).

@Neumann-A where would I change that? Also this seems rather unnecessary. The previous version just perfectly fine without manually altering triples.

@MVoz
Copy link
Contributor

MVoz commented Jul 7, 2020

selects Visual Studio 16 2019 as default generator

14.26.28801\lib\x64\libcmt.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

Visual Studio 16 2019 -A x64 << -- x64 default generator
?

"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/bin/clang-cl.exe" --help

flag -m32 == x86, -m64 == x64

or cmake only

cmake -T"ClangCL,host=x64" == x64

@jsmolka
Copy link
Contributor Author

jsmolka commented Jul 7, 2020

Even if I manage to generate a solution for clang-cl I still end up with the disabled exceptions error cannot use 'throw' with exc eptions disabled even though exceptions aren't disabled anywhere in the project.

@ras0219-msft
Copy link
Contributor

I believe I've identified the issue and proposed a fix in #12319.

@NancyLi1013 NancyLi1013 added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Jul 8, 2020
@jsmolka
Copy link
Contributor Author

jsmolka commented Jul 8, 2020

@ras0219-msft Yes, this fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants