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

fix cmake & mingw detect cross-compilation on windows #5888

Merged
merged 3 commits into from
Nov 26, 2024

Conversation

star-hengxing
Copy link
Contributor

CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   APSI_FOURQ_AMD64_EXITCODE (advanced)
For details see C:/Users/star/AppData/Local/.xmake/cache/packages/2411/m/microsoft-apsi/v0.12.0/source/microsoft-apsi/build_9e48a5a1/TryRunResults.cmake
-- FourQlib optimization: arch=AMD64
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_AVX_EXTENSIONS_EXITCODE (advanced)
For details see C:/Users/star/AppData/Local/.xmake/cache/packages/2411/m/microsoft-apsi/v0.12.0/source/microsoft-apsi/build_9e48a5a1/TryRunResults.cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_AVX2_EXTENSIONS_EXITCODE (advanced)
For details see C:/Users/star/AppData/Local/.xmake/cache/packages/2411/m/microsoft-apsi/v0.12.0/source/microsoft-apsi/build_9e48a5a1/TryRunResults.cmake

@waruqi
Copy link
Member

waruqi commented Nov 26, 2024

看不懂为啥要这么改? win 上 mingw 编译,需要置空这个不能显式设置 windows?那为啥其他这么多包的 win mingw 编译 都没问题呢,就这个包不行。

如果只是单个包的问题,应该这个包的 on_install 里单独去调整

@star-hengxing
Copy link
Contributor Author

cmake_minimum_required(VERSION 3.15.0)
project(test LANGUAGES CXX)

include(CheckCXXSourceRuns)

check_cxx_source_runs(
    "int main() {}"
    HELLO
)
-- The CXX compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Users/star/scoop/apps/w64devkit/current/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HELLO
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HELLO_EXITCODE (advanced)
For details see A:/project/xmake/test/build/cmake/TryRunResults.cmake
-- Performing Test HELLO - Failed
-- Configuring incomplete, errors occurred!
error: execv(cmake -B build/cmake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_COMPILER=g++ -G Ninja) failed(1)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I don’t understand why it needs to be changed like this? When compiling with mingw on win, you need to leave this blank and cannot explicitly set windows? Then why do so many other packages have no problem compiling with win mingw, but only this package does not work?

If it is just a problem with a single package, it should be adjusted separately in the on_install of this package.

@waruqi
Copy link
Member

waruqi commented Nov 26, 2024

@waruqi waruqi added this to the v2.9.7 milestone Nov 26, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Okay, this behavior is weird too.

https://cmake-doc.readthedocs.io/zh-cn/latest/variable/CMAKE_CROSSCOMPILING.html#variable:CMAKE_CROSSCOMPILING

@waruqi waruqi merged commit f4599d3 into xmake-io:dev Nov 26, 2024
17 of 19 checks passed
@star-hengxing star-hengxing deleted the cmake-mingw branch November 27, 2024 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants