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

Set CMAKE_SYSTEM_NAME globally #47192

Closed
matthewbauer opened this issue Sep 22, 2018 · 2 comments
Closed

Set CMAKE_SYSTEM_NAME globally #47192

matthewbauer opened this issue Sep 22, 2018 · 2 comments
Assignees
Milestone

Comments

@matthewbauer
Copy link
Member

Issue description

Tracking issue for setting CMAKE_SYSTEM_NAME for proper CMake support for cross compilation. Most likely we will need to create a cmake wrapper to handle this.

See discussion in #46773.

@matthewbauer
Copy link
Member Author

Closed in favor of #25477

@mcmtroffaes
Copy link
Contributor

Just to note here that, for mingw builds, setting CMAKE_CROSSCOMPILING but not CMAKE_SYSTEM_NAME may not be enough for cmake to figure out that the target system is Windows. So, at least for mingw, it seems that CMAKE_SYSTEM_NAME still needs to be set globally.

For reference, here's the output for building brotli with CMAKE_CROSSCOMPILING=True but without CMAKE_SYSTEM_NAME=Windows:

building '/nix/store/wm1n4yvpldz9rzam8vxca1ix6g9x01x6-brotli-1.0.6-x86_64-pc-mingw32.drv'...
unpacking sources
unpacking source archive /nix/store/3s7194w20rijmldh64riwi8pz12c641i-source
source root is source
patching sources
configuring
fixing cmake files...
cmake flags: -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/8h2670qh94gi0sa02fzqq3rrczcwhbrg-brotli-1.0.6-x86_64-pc-mingw32-dev/include -DCMAKE_INSTALL_LIBDIR=/nix/store/05ysmxinr24zq8pswid9ygrmaj0pi3m3-brotli-1.0.6-x86_64-pc-mingw32-lib/lib -DCMAKE_INSTALL_NAME_DIR=/nix/store/05ysmxinr24zq8pswid9ygrmaj0pi3m3-brotli-1.0.6-x86_64-pc-mingw32-lib/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_DEPLOYMENT_TARGET= -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=last -DCMAKE_STRIP=/nix/store/b30c9sig3nkr8k2vi2j2ia9dylxy0grr-x86_64-pc-mingw32-binutils-2.30/bin/x86_64-pc-mingw32-strip -DCMAKE_RANLIB=/nix/store/b30c9sig3nkr8k2vi2j2ia9dylxy0grr-x86_64-pc-mingw32-binutils-2.30/bin/x86_64-pc-mingw32-ranlib -DCMAKE_AR=/nix/store/b30c9sig3nkr8k2vi2j2ia9dylxy0grr-x86_64-pc-mingw32-binutils-2.30/bin/x86_64-pc-mingw32-ar -DCMAKE_C_COMPILER=x86_64-pc-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-pc-mingw32-g++ -DCMAKE_INSTALL_PREFIX=/nix/store/4s8q9ci827wb9isp25rjvrfxhzwl82gz-brotli-1.0.6-x86_64-pc-mingw32 -DCMAKE_CROSSCOMPILING=True 
-- The C compiler identification is GNU 7.3.0
-- Check for working C compiler: /nix/store/m5csa3c3ma785c6d2ahap0v8d4vzjx1d-x86_64-pc-mingw32-stage-final-gcc-debug-wrapper-7.3.0/bin/x86_64-pc-mingw32-gcc
-- Check for working C compiler: /nix/store/m5csa3c3ma785c6d2ahap0v8d4vzjx1d-x86_64-pc-mingw32-stage-final-gcc-debug-wrapper-7.3.0/bin/x86_64-pc-mingw32-gcc -- broken
CMake Error at /nix/store/gwynihr81f3x5dcqdijk7p8wqgklqbb7-cmake-3.12.1/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/nix/store/m5csa3c3ma785c6d2ahap0v8d4vzjx1d-x86_64-pc-mingw32-stage-final-gcc-debug-wrapper-7.3.0/bin/x86_64-pc-mingw32-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /tmp/nix-build-brotli-1.0.6-x86_64-pc-mingw32.drv-0/source/build/CMakeFiles/CMakeTmp
    
    Run Build Command:"/nix/store/ql3azyviwyc6w73h6prk1j2945skfapf-gnumake-4.2.1/bin/make" "cmTC_f6e44/fast"
    /nix/store/ql3azyviwyc6w73h6prk1j2945skfapf-gnumake-4.2.1/bin/make -f CMakeFiles/cmTC_f6e44.dir/build.make CMakeFiles/cmTC_f6e44.dir/build
    make[1]: Entering directory '/tmp/nix-build-brotli-1.0.6-x86_64-pc-mingw32.drv-0/source/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_f6e44.dir/testCCompiler.c.o
    /nix/store/m5csa3c3ma785c6d2ahap0v8d4vzjx1d-x86_64-pc-mingw32-stage-final-gcc-debug-wrapper-7.3.0/bin/x86_64-pc-mingw32-gcc    -o CMakeFiles/cmTC_f6e44.dir/testCCompiler.c.o   -c /tmp/nix-build-brotli-1.0.6-x86_64-pc-mingw32.drv-0/source/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_f6e44
    /nix/store/gwynihr81f3x5dcqdijk7p8wqgklqbb7-cmake-3.12.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f6e44.dir/link.txt --verbose=1
    /nix/store/m5csa3c3ma785c6d2ahap0v8d4vzjx1d-x86_64-pc-mingw32-stage-final-gcc-debug-wrapper-7.3.0/bin/x86_64-pc-mingw32-gcc      -rdynamic CMakeFiles/cmTC_f6e44.dir/testCCompiler.c.o  -o cmTC_f6e44 
    x86_64-pc-mingw32-gcc: error: unrecognized command line option '-rdynamic'
    make[1]: *** [CMakeFiles/cmTC_f6e44.dir/build.make:87: cmTC_f6e44] Error 1
    make[1]: Leaving directory '/tmp/nix-build-brotli-1.0.6-x86_64-pc-mingw32.drv-0/source/build/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_f6e44/fast] Error 2

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

No branches or pull requests

3 participants