Skip to content

Cross compile from linux for windows #14

Closed
@R1tschY

Description

@R1tschY

I want to cross compile my library from linux for windows.

I use

bii configure \
  -DCMAKE_TOOLCHAIN_FILE=`pwd`/Toolchain-cross-mingw.cmake \
  -DCOMPILER_PREFIX=i686-w64-mingw32 \
  -DBII_BOOST_VERBOSE=ON

to configure with Toolchain-cross-mingw.cmake:

# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# Choose an appropriate compiler prefix

IF ("${COMPILER_PREFIX}" STREQUAL "")
    SET(COMPILER_PREFIX x86_64-w64-mingw32)
ENDIF()

# which compilers to use for C and C++
set(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
set(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH  /usr/${COMPILER_PREFIX} )

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

My problem is that the bootstrapping is failing:

INFO: Processing changes...
INFO: Saving files from: toeb/cmakepp
INFO: Saving files from: biicode/boost
INFO: Saving files from: boost/install
Running: "cmake"  -G "Unix Makefiles" -Wno-dev -DCMAKE_TOOLCHAIN_FILE=XXX/PowerWin/Toolchain-cross-mingw.cmake -DCOMPILER_PREFIX=i686-w64-mingw32 -DBII_BOOST_VERBOSE=ON ../cmake
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done

        BLOCK: r1tschy/PowerWin 
-----------------------------------------------------------
+ LIB: r1tschy_PowerWin
-- Setting up biicode Boost configuration...
-- BII_BOOST_TOOLSET not specified. Using GNU compiler
-- BII_BOOST_VARIANT not specified. Using Release variant
-- BII_BOOST_BUILD_J not specified. Parallel build disabled
-- Boost version: 1.57.0
-- Libraries: 
-- Upstream URL: http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.zip
-- Package: boost_1_57_0.zip
-- Path to package: XXX/.biicode/tmp/boost/1.57.0/boost_1_57_0.zip
-- Boost directory: XXX/.biicode/boost/1.57.0
-- Toolset: gcc-4.8
-- Bootstrapper: XXX/.biicode/boost/1.57.0/bootstrap.bat
-- Boost linking: DYNAMIC
-- Download aborted. boost_1_57_0.zip was downloaded previously
-- Bootstrapping Boost 1.57.0...
CMake Error at ../deps/toeb/cmakepp/cmake/core/message.cmake:94 (_message):
  Failed running
  XXX/.biicode/boost/1.57.0/bootstrap.bat;--prefix=XXX/.biicode/boost/1.57.0:

Call Stack (most recent call first):
  ../deps/boost/install/install.cmake:59 (message)
  ../deps/boost/install/install.cmake:235 (__BII_BOOST_BOOTSTRAP)
  ../deps/boost/install/install.cmake:326 (__BII_BOOST_INSTALL)
  ../../hooklib/CMakeLists.txt:10 (bii_setup_boost)

-- Configuring incomplete, errors occurred!
See also "XXX/PowerWin/bii/build/CMakeFiles/CMakeOutput.log".
ERROR: CMake failed

Problem seems to be in the install.cmake:

    #Bootstrap
    if(CMAKE_SYSTEM_NAME MATCHES "Windows")
        set(__BII_BOOST_BOOSTRAPER ${BII_BOOST_DIR}/bootstrap.bat ${SCOPE})
        set(__BII_BOOST_B2         ${BII_BOOST_DIR}/b2.exe        ${SCOPE})
        set(__DYNLIB_EXTENSION     .dll  
...

It uses ${BII_BOOST_DIR}/bootstrap.bat but should use ${BII_BOOST_DIR}/bootstrap.sh for cross compiling. Is there any solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions