From 7527b8e6e3b8452af2a6562f3c5b78d80a38135d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 03:29:07 -0400 Subject: [PATCH 1/7] linux-x86: Tweak toolchain comment associated with CMAKE_IGNORE_PATH --- linux-x86/Toolchain.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-x86/Toolchain.cmake b/linux-x86/Toolchain.cmake index 0d4a74a..5369f26 100644 --- a/linux-x86/Toolchain.cmake +++ b/linux-x86/Toolchain.cmake @@ -14,7 +14,8 @@ set(CMAKE_CXX_COMPILER /usr/${cross_triple}/bin/${cross_triple}-g++) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) set(CMAKE_AR /usr/${cross_triple}/bin/${cross_triple}-ar) -# Prevent 64-bit libraries from being discovered +# Discard path returned by pkg-config and associated with HINTS in module +# like FindOpenSSL. set(CMAKE_IGNORE_PATH /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/lib/) set(CMAKE_CROSSCOMPILING_EMULATOR sh -c) From aec085ce9bd634e633a0c72d2d8aae6e89adc811 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 03:30:59 -0400 Subject: [PATCH 2/7] linux-armv6: Specify system processor and add missing find root path. The additional find root path will ensure libraries like libm and libutils are found. --- linux-armv6/Toolchain.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-armv6/Toolchain.cmake b/linux-armv6/Toolchain.cmake index e737f3a..1336f9d 100644 --- a/linux-armv6/Toolchain.cmake +++ b/linux-armv6/Toolchain.cmake @@ -1,5 +1,6 @@ set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR arm) set(cross_triple "arm-linux-gnueabihf") @@ -7,7 +8,7 @@ set(CMAKE_C_COMPILER /usr/bin/${cross_triple}-gcc) set(CMAKE_CXX_COMPILER /usr/bin/${cross_triple}-g++) set(CMAKE_Fortran_COMPILER /usr/bin/${cross_triple}-gfortran) -set(CMAKE_FIND_ROOT_PATH /usr/${cross_triple}) +set(CMAKE_FIND_ROOT_PATH /usr/${cross_triple} /usr/${cross_triple}/libc/usr) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) From 44dd51cbe8453cbd447a2114ebac0fbe47980907 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 03:40:58 -0400 Subject: [PATCH 3/7] linux-armv7: Specify system processor and fix library finding. This commit updates the toolchain to ensure libraries associated with arm can be found. While a new root path needed to be set for armv6, the most recent armv7 toolchain doesn't require to explicitly set a new root. --- linux-armv7/Toolchain.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-armv7/Toolchain.cmake b/linux-armv7/Toolchain.cmake index 49c5efd..51601a9 100644 --- a/linux-armv7/Toolchain.cmake +++ b/linux-armv7/Toolchain.cmake @@ -1,5 +1,6 @@ set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR arm) set(cross_triple "arm-linux-gnueabihf") @@ -7,9 +8,8 @@ set(CMAKE_C_COMPILER /usr/bin/${cross_triple}-cc) set(CMAKE_CXX_COMPILER /usr/bin/${cross_triple}-c++) set(CMAKE_Fortran_COMPILER /usr/bin/${cross_triple}-gfortran) -set(CMAKE_FIND_ROOT_PATH /usr/${cross_triple}) -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +# Discard path returned by pkg-config and associated with HINTS in module +# like FindOpenSSL. +set(CMAKE_IGNORE_PATH /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/lib/) set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-arm) From 4ccd459994e318a78b745270c0d79b87f30beed9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 18:30:02 -0400 Subject: [PATCH 4/7] linux-x86: Avoid CMake issue by not setting CMAKE_AR. It is automatically set. It is automatically set in CMakeFindBinUtils.cmake using the value of _CMAKE_TOOLCHAIN_PREFIX extracted from the compiler name within CMakeDetermineCCompiler.cmake. The CMake issue is #15448 - https://cmake.org/Bug/view.php?id=15448 --- linux-x86/Toolchain.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/linux-x86/Toolchain.cmake b/linux-x86/Toolchain.cmake index 5369f26..745ad11 100644 --- a/linux-x86/Toolchain.cmake +++ b/linux-x86/Toolchain.cmake @@ -12,7 +12,6 @@ set(cross_triple "i686-linux-gnu") set(CMAKE_C_COMPILER /usr/${cross_triple}/bin/${cross_triple}-gcc) set(CMAKE_CXX_COMPILER /usr/${cross_triple}/bin/${cross_triple}-g++) set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) -set(CMAKE_AR /usr/${cross_triple}/bin/${cross_triple}-ar) # Discard path returned by pkg-config and associated with HINTS in module # like FindOpenSSL. From dc871beb505f56504465df116c99eacec1ce4c42 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 19:39:21 -0400 Subject: [PATCH 5/7] linux-x86: Set emulator path using a "noop" script without argument. This will fix issue where emulator is used doing: COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} /path/to/prog arg1 arg2 Prior to this commit, it wasn't working because the following command was used: /bin/sh -c /path/to/prog arg1 arg2 --- linux-x86/Dockerfile | 4 +++- linux-x86/Toolchain.cmake | 2 +- linux-x86/i686-linux-gnu-noop.sh | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100755 linux-x86/i686-linux-gnu-noop.sh diff --git a/linux-x86/Dockerfile b/linux-x86/Dockerfile index c343852..9702387 100644 --- a/linux-x86/Dockerfile +++ b/linux-x86/Dockerfile @@ -14,6 +14,7 @@ ENV PATH ${PATH}:${CROSS_ROOT}/bin RUN mkdir -p ${CROSS_ROOT}/bin COPY ${CROSS_TRIPLE}.sh ${CROSS_ROOT}/bin/${CROSS_TRIPLE}.sh COPY ${CROSS_TRIPLE}-as.sh ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as.sh +COPY ${CROSS_TRIPLE}-noop.sh ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-noop.sh RUN cd ${CROSS_ROOT}/bin && \ chmod +x ${CROSS_TRIPLE}.sh && \ ln -s /usr/bin/x86_64-linux-gnu-gcc && \ @@ -22,7 +23,8 @@ RUN cd ${CROSS_ROOT}/bin && \ ln -s ${CROSS_TRIPLE}.sh ${CROSS_TRIPLE}-gcc && \ ln -s ${CROSS_TRIPLE}.sh ${CROSS_TRIPLE}-g++ && \ ln -s ${CROSS_TRIPLE}-as.sh ${CROSS_TRIPLE}-as && \ - ln -s /usr/bin/x86_64-linux-gnu-ar ${CROSS_TRIPLE}-ar + ln -s /usr/bin/x86_64-linux-gnu-ar ${CROSS_TRIPLE}-ar && \ + ln -s ${CROSS_TRIPLE}-noop.sh ${CROSS_TRIPLE}-noop ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \ CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ diff --git a/linux-x86/Toolchain.cmake b/linux-x86/Toolchain.cmake index 745ad11..4245df7 100644 --- a/linux-x86/Toolchain.cmake +++ b/linux-x86/Toolchain.cmake @@ -17,4 +17,4 @@ set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) # like FindOpenSSL. set(CMAKE_IGNORE_PATH /usr/lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux-gnu/lib/) -set(CMAKE_CROSSCOMPILING_EMULATOR sh -c) +set(CMAKE_CROSSCOMPILING_EMULATOR /usr/${cross_triple}/bin/${cross_triple}-noop) diff --git a/linux-x86/i686-linux-gnu-noop.sh b/linux-x86/i686-linux-gnu-noop.sh new file mode 100755 index 0000000..311cb8c --- /dev/null +++ b/linux-x86/i686-linux-gnu-noop.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec "$@" From bf42ff14c89ecc7418531cf6b68738020ffabf87 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 15 Apr 2016 19:40:28 -0400 Subject: [PATCH 6/7] linux-x86: Install "common" additional packages These packages also mirror the one already available in the base images for x86_64. --- linux-x86/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-x86/Dockerfile b/linux-x86/Dockerfile index 9702387..bbd9bd1 100644 --- a/linux-x86/Dockerfile +++ b/linux-x86/Dockerfile @@ -6,7 +6,11 @@ RUN dpkg --add-architecture i386 && \ gcc-multilib \ g++-multilib \ libc6:i386 \ - libstdc++6:i386 + libstdc++6:i386 \ + libbz2-dev:i386 \ + libexpat1-dev:i386 \ + ncurses-dev:i386 \ + libssl-dev:i386 ENV CROSS_TRIPLE i686-linux-gnu ENV CROSS_ROOT /usr/${CROSS_TRIPLE} From f07fe2e3b9e5ff22aa09de75766cbb892afd9998 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sat, 16 Apr 2016 00:21:02 -0400 Subject: [PATCH 7/7] linux-armv7: Install "common" additional packages These packages also mirror the one already available in the base images for x86_64. --- linux-armv7/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linux-armv7/Dockerfile b/linux-armv7/Dockerfile index 67f75e1..912d551 100644 --- a/linux-armv7/Dockerfile +++ b/linux-armv7/Dockerfile @@ -10,7 +10,11 @@ RUN apt-get update && apt-get install -y \ crossbuild-essential-armhf \ gfortran-arm-linux-gnueabihf \ qemu-user \ - qemu-user-static + qemu-user-static \ + libbz2-dev:armhf \ + libexpat1-dev:armhf \ + ncurses-dev:armhf \ + libssl-dev:armhf ENV CROSS_TRIPLE arm-linux-gnueabihf ENV CROSS_ROOT /usr/${CROSS_TRIPLE}