-
Notifications
You must be signed in to change notification settings - Fork 19
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
fail with 'Unable identify compiler architecture for CMAKE_SYSTEM_PROCESSOR' #58
Comments
I think by using the |
Perhaps just defaulting |
Oh... I try and default if(NOT CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif() |
I downloaded last 'WindowsToolchain' which was 'project_option' dependent, back when 'project option' works. it was
so I manually changed newer version(v0.5.1)'s I don't know well enough on cmake, but it seems that relying on |
As you see |
IMHO: You are cross compiling! |
Please let me know if if I misunderstand something. Since I have set It means that But I have no idea when cmake runs |
IMHO: If you are working with If it works, I do not know, if have never tried to build a |
Since
So the fix for #41 (#42) changed the default of if(NOT CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif() And The error message from OP, contains the text:
That's written by this code which shows that the value of What version of CMake are you using? Any idea why |
The fact that you're specifying the TBH, even though the VCPkg documentation says to specify |
OK, I tried using WindowsToolchain and VCPkg, and whilst it was a bit painful - I'll file a separate issue to have that conversation - I can't reproduce the I think that the best way to track this down would be to use
So CMake is setting:
And then processing the toolchain. I'm assuming that because you're using the VCPkg as your toolchain, then something must be clearing |
Is there a minimal reproduction of this issue? I use vcpkg every day without problems. Is the difference in adding the toolchain in |
I'm unable to reproduce this. If anyone can reproduce it, and can share steps, or is comfortable sharing their |
Try to use lukka's run_vcpkg with a simple project. It fails for this reason on windows runners. (Reproduced with 0.30) |
is not working because
I'm not sure who is responsible to set those two. |
I tried lukka's run_vcpkg locally, and it works for me. The steps I took:
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "<qualified path>/Windows.MSVC.toolchain.cmake"
}
Do you mean under GitHub Actions? I'll give that a try. |
I tried under GitHub Actions and can't repro. Steps:
|
An update on the project_options: |
There is still a problem with WindowsToolchain v0.70 and PackageOptions v.0.32.0: You may find my test setup here aminya/cpp_vcpkg_project#31
My workaround is to set this in my configure presets used: {
"name": "default-config",
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
"CMAKE_HOST_SYSTEM_PROCESSOR": "$penv{PROCESSOR_ARCHITECTURE}"
},
"environment": { "VARIANT": "MSVC" }
} |
This is my git repo used: MINGW64 ~/Workspace/cpp/cpp_vcpkg_project (feature/test-docker-build) MINGW64 ~/Workspace/cpp/cpp_vcpkg_project (feature/test-docker-build)
|
If I change this, it works fine: diff --git a/CMakeLists.txt b/CMakeLists.txt
index c74c603..5fdf8b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ if(ENABLE_CROSS_COMPILING)
enable_cross_compiler()
endif()
# install vcpkg dependencies: - should be called before defining project()
-run_vcpkg()
+#XXX run_vcpkg()
# Set the project name and language
project(
diff --git a/CMakeWorkflowPresets.json b/CMakeWorkflowPresets.json
index f797b93..fd4b407 100644
--- a/CMakeWorkflowPresets.json
+++ b/CMakeWorkflowPresets.json
@@ -11,7 +11,10 @@
"hidden": true,
"generator": "Ninja",
"cacheVariables": {
- "CMAKE_HOST_SYSTEM_PROCESSOR": "$penv{PROCESSOR_ARCHITECTURE}"
+ "CMAKE_TOOL_CHAIN": "WindowsToolchain",
+ "CMAKE_C_COMPILER_Y": "cl",
+ "CMAKE_CXX_COMPILER_Y": "cl",
+ "CMAKE_HOST_SYSTEM_PROCESSOR_Y": "$penv{PROCESSOR_ARCHITECTURE}"
},
"environment": { "VARIANT": "MSVC" }
}, |
|
@MarkSchofield According to this answer, |
I am facing this issue again directly in a project. |
Well, I tried to repro -
Then things get further, but my Toolchain files are supposed to be read in the |
Ah, nope. |
I have decided not to activate the Windows toolchain in the next version of project_options. The corner cases need to be tackled for cross-compilation and inclusion before CMake knows the system. Right now, this is still not there. I still provide the function in case someone ensures that their configurations don't hit any of the corner cases. msvc_toolchain() |
So the bottom line is that including WindowsToolchain before the top-level project call fails, because CMAKE_HOST_SYSTEM_PROCESSOR isn't set. Toolchains are supposed to be read in the call to the top-level project, when CMAKE_HOST_SYSTEM_PROCESSOR has been set. I don't see the point in supporting non-standard consumption, so I'll close this as "By Design". |
This issue is mirrored from aminya/project_options#200
@hihig2001 originally wrote:
I use visual studio 2022 17.4.4 with integrated cmake, and pre-installed vcpkg.
My cmake file is mostly similar with example file.
Difference is that I don't use
run_vcpkg()
functionality.Instead, I register 'CMAKE_TOOL_CHAIN' using CMakePresets.json, just like visual studio's official manual.
I'm not so sure about that it is appropriate to report here or 'WindowsToolchain' cause it is dependency not 'project_option' itself.
but I thought that it is something worth to report.
The text was updated successfully, but these errors were encountered: