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

x86_64-apple-darwin cmake not functioning correctly #62

Open
kmturley opened this issue Dec 19, 2021 · 0 comments
Open

x86_64-apple-darwin cmake not functioning correctly #62

kmturley opened this issue Dec 19, 2021 · 0 comments

Comments

@kmturley
Copy link

kmturley commented Dec 19, 2021

multiarch/crossbuild currently uses Debian stretch:
FROM buildpack-deps:stretch-curl

This comes with cmake version 3.7.2
https://packages.debian.org/stretch/devel/cmake

Therefore I took the old CMake tutorial (which is compatible with cmake 3.3+)
https://github.com/Kitware/CMake/tree/161b33f12b9a225607a4ea8339eabd4875bebbfe/Help/guide/tutorial/Complete

I placed the tutorials files inside a /src directory and added a docker-compose.yml file:

version: '3'
services:

  linux:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-linux-gnu
      FOLDER: linux
    command: >
      sh -c "mkdir -p ./build/linux &&
             cd ./build/linux &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

  mac:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-apple-darwin
    command: >
      sh -c "mkdir -p ./build/mac &&
             cd ./build/mac &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

  win:
    image: multiarch/crossbuild
    environment:
      CROSS_TRIPLE: x86_64-w64-mingw32
      FOLDER: win
    command: >
      sh -c "mkdir -p ./build/win &&
             cd ./build/win &&
             cmake ../../src &&
             cmake --build . &&
            ./Tutorial 4294967296"
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./build:/app/build

When running docker-compose up you get

  • Linux: all ok
  • Mac: no errors, but binary is not created
  • Win: An error see below

./build/win/CMakeFiles/CMakeError.log

Determining if the C compiler works failed with the following output:
Change Dir: /app/build/win/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_731ec/fast"
/usr/bin/make -f CMakeFiles/cmTC_731ec.dir/build.make CMakeFiles/cmTC_731ec.dir/build
make[1]: Entering directory '/app/build/win/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o
/usr/x86_64-w64-mingw32/bin/cc     -o CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o   -c /app/build/win/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_731ec
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_731ec.dir/link.txt --verbose=1
/usr/x86_64-w64-mingw32/bin/cc       CMakeFiles/cmTC_731ec.dir/testCCompiler.c.o  -o cmTC_731ec -rdynamic 
cc: error: unrecognized command line option '-rdynamic'
CMakeFiles/cmTC_731ec.dir/build.make:97: recipe for target 'cmTC_731ec' failed
make[1]: *** [cmTC_731ec] Error 1
make[1]: Leaving directory '/app/build/win/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_731ec/fast' failed
make: *** [cmTC_731ec/fast] Error 2

I have a branch with the code here:
https://github.com/kmturley/cmake-multiarch-docker/tree/feature/crossbuild

What is the issue?

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

1 participant