From 87d8255f03e11a74aed04599e98cd6b9b4cdebfd Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Sun, 20 May 2018 18:36:53 +0200 Subject: [PATCH] Sync arm64 wtih other crosstool-ng targets --- common.crosstool | 1 + common.debian | 6 ++-- linux-arm64/Dockerfile.in | 60 +++++++++++++-------------------- linux-arm64/Toolchain.cmake | 11 +++--- linux-arm64/crosstool-ng.config | 2 +- linux-arm64/sources.list | 12 ------- linux-mips/Toolchain.cmake | 3 +- linux-s390x/Toolchain.cmake | 3 +- 8 files changed, 38 insertions(+), 60 deletions(-) delete mode 100644 linux-arm64/sources.list diff --git a/common.crosstool b/common.crosstool index 27dd583..c47a5c3 100644 --- a/common.crosstool +++ b/common.crosstool @@ -19,6 +19,7 @@ RUN apt-get update --yes && apt-get install --no-install-recommends --yes \ gawk \ gperf \ help2man \ + python-dev \ texinfo \ && apt-get clean --yes diff --git a/common.debian b/common.debian index 042e4cb..0a7a7a2 100644 --- a/common.debian +++ b/common.debian @@ -5,9 +5,10 @@ ARG DEBIAN_FRONTEND=noninteractive ARG REPO=http://cdn-fastly.deb.debian.org RUN \ - bash -c "echo \"deb $REPO/debian jessie main\" > /etc/apt/sources.list" && \ - bash -c "echo \"deb $REPO/debian jessie-updates main\" >> /etc/apt/sources.list" && \ + bash -c "echo \"deb $REPO/debian jessie main contrib non-free\" > /etc/apt/sources.list" && \ + bash -c "echo \"deb $REPO/debian jessie-updates main contrib non-free\" >> /etc/apt/sources.list" && \ bash -c "echo \"deb $REPO/debian-security jessie/updates main\" >> /etc/apt/sources.list" && \ + bash -c "echo \"deb http://ftp.debian.org/debian jessie-backports main\" >> /etc/apt/sources.list" && \ apt-get update --yes && \ apt-get install --no-install-recommends --yes \ automake \ @@ -43,4 +44,3 @@ RUN \ apt-get clean --yes && \ /buildscripts/install-gosu-binary.sh && \ rm -rf /buildscripts - diff --git a/linux-arm64/Dockerfile.in b/linux-arm64/Dockerfile.in index 365439e..2d848e6 100644 --- a/linux-arm64/Dockerfile.in +++ b/linux-arm64/Dockerfile.in @@ -1,47 +1,37 @@ FROM dockcross/base:latest -MAINTAINER Matt McCormick "matt.mccormick@kitware.com" - -# Add sources.list -COPY sources.list /etc/apt/sources.list -RUN dpkg --add-architecture arm64 ; apt-get update ; apt-get -y upgrade ; apt-get update ; -RUN apt-get install -y \ - libbz2-dev:arm64 \ - libexpat1-dev:arm64 \ - ncurses-dev:arm64 \ - libssl-dev:arm64 \ - python-dev +# This is for 64-bit ARM Linux machine #include "common.crosstool" -WORKDIR /usr/src - -RUN apt-get install -y libglib2.0-dev zlib1g-dev libpixman-1-dev && \ - curl -L http://wiki.qemu-project.org/download/qemu-2.6.0.tar.bz2 | tar xj && \ - cd qemu-2.6.0 && \ - ./configure --target-list=aarch64-linux-user --prefix=/usr && \ - make -j$(nproc) && \ - make install && \ - cd .. && rm -rf qemu-2.6.0 +# The cross-compiling emulator +RUN apt-get update \ +&& apt-get install -y \ + qemu-user \ + qemu-user-static \ +&& apt-get clean --yes +# The CROSS_TRIPLE is a configured alias of the "aarch64-unknown-linux-gnueabi" target. ENV CROSS_TRIPLE aarch64-unknown-linux-gnueabi -ENV CROSS_ROOT /usr/bin/${CROSS_TRIPLE} -ENV AS=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-as \ - AR=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-ar \ - CC=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-gcc \ - CPP=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-cpp \ - CXX=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-g++ \ - LD=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-ld \ - FC=/usr/bin/${CROSS_TRIPLE}/bin/${CROSS_TRIPLE}-gfortran + +ENV CROSS_ROOT ${XCC_PREFIX}/${CROSS_TRIPLE} +ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ + AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \ + CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ + CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \ + CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ \ + LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld \ + FC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gfortran + +ENV QEMU_LD_PREFIX "${CROSS_ROOT}/${CROSS_TRIPLE}/sysroot" +ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${QEMU_LD_PREFIX}" ENV DEFAULT_DOCKCROSS_IMAGE dockcross/linux-arm64 -WORKDIR /work -# Note: Toolchain file support is currently in debian Experimental according to: -# https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 -# We can switch to that when it becomes stable. -COPY Toolchain.cmake /usr/lib/${CROSS_TRIPLE}/ -ENV CMAKE_TOOLCHAIN_FILE /usr/lib/${CROSS_TRIPLE}/Toolchain.cmake +COPY Toolchain.cmake ${CROSS_ROOT}/ +ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake + +ENV PKG_CONFIG_PATH /usr/lib/aarch64-linux-gnu/pkgconfig # Build-time metadata as defined at http://label-schema.org ARG BUILD_DATE @@ -53,5 +43,3 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.vcs-url=$VCS_URL \ org.label-schema.schema-version="1.0" - -ENV PKG_CONFIG_PATH /usr/lib/aarch64-linux-gnu/pkgconfig diff --git a/linux-arm64/Toolchain.cmake b/linux-arm64/Toolchain.cmake index 29cdde6..b4b745c 100644 --- a/linux-arm64/Toolchain.cmake +++ b/linux-arm64/Toolchain.cmake @@ -1,21 +1,20 @@ - set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR aarch64) set(cross_triple "aarch64-unknown-linux-gnueabi") +set(cross_root /usr/xcc/${cross_triple}) set(CMAKE_C_COMPILER $ENV{CC}) set(CMAKE_CXX_COMPILER $ENV{CXX}) set(CMAKE_Fortran_COMPILER $ENV{FC}) -set(CMAKE_FIND_ROOT_PATH $ENV{CROSS_ROOT}) +set(CMAKE_CXX_FLAGS "-I ${cross_root}/include/") + +set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${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) -set(CMAKE_SYSROOT /usr/bin/aarch64-unknown-linux-gnueabi/aarch64-unknown-linux-gnueabi/sysroot) - -set(CMAKE_CXX_FLAGS "-I /usr/bin/aarch64-unknown-linux-gnueabi/include") -set(ADDITIONAL_COMPILER_FLAGS "-L /usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/usr/lib/aarch64-linux-gnu -Wl,-rpath-link,/lib/aarch64-linux-gnu") +set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/sysroot) set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-aarch64) diff --git a/linux-arm64/crosstool-ng.config b/linux-arm64/crosstool-ng.config index 601b997..6380b6d 100644 --- a/linux-arm64/crosstool-ng.config +++ b/linux-arm64/crosstool-ng.config @@ -32,7 +32,7 @@ CT_LOCAL_TARBALLS_DIR="${HOME}/src" CT_SAVE_TARBALLS=y CT_WORK_DIR="${CT_TOP_DIR}/.build" CT_BUILD_TOP_DIR="${CT_WORK_DIR}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/usr/bin/${CT_TARGET}" +CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" CT_RM_RF_PREFIX_DIR=y CT_REMOVE_DOCS=y CT_PREFIX_DIR_RO=y diff --git a/linux-arm64/sources.list b/linux-arm64/sources.list deleted file mode 100644 index e834650..0000000 --- a/linux-arm64/sources.list +++ /dev/null @@ -1,12 +0,0 @@ -#------------------------------------------------------------------------------# -# OFFICIAL DEBIAN REPOS -#------------------------------------------------------------------------------# - -###### Debian Main Repos -deb http://deb.debian.org/debian/ oldstable main contrib non-free - -deb http://deb.debian.org/debian/ oldstable-updates main contrib non-free - -deb http://deb.debian.org/debian-security oldstable/updates main - -deb http://ftp.debian.org/debian jessie-backports main diff --git a/linux-mips/Toolchain.cmake b/linux-mips/Toolchain.cmake index abf4616..3c49933 100644 --- a/linux-mips/Toolchain.cmake +++ b/linux-mips/Toolchain.cmake @@ -9,9 +9,10 @@ set(CMAKE_C_COMPILER $ENV{CC}) set(CMAKE_CXX_COMPILER $ENV{CXX}) set(CMAKE_Fortran_COMPILER $ENV{FC}) -set(CMAKE_FIND_ROOT_PATH ${cross_root}/lib ${cross_root}/${cross_triple}/lib) +set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${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) +set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/sysroot) set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-mips) diff --git a/linux-s390x/Toolchain.cmake b/linux-s390x/Toolchain.cmake index 1345cf9..4a26d59 100644 --- a/linux-s390x/Toolchain.cmake +++ b/linux-s390x/Toolchain.cmake @@ -9,9 +9,10 @@ set(CMAKE_C_COMPILER $ENV{CC}) set(CMAKE_CXX_COMPILER $ENV{CXX}) set(CMAKE_Fortran_COMPILER $ENV{FC}) -set(CMAKE_FIND_ROOT_PATH ${cross_root}/lib ${cross_root}/${cross_triple}/lib) +set(CMAKE_FIND_ROOT_PATH ${cross_root} ${cross_root}/${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) +set(CMAKE_SYSROOT ${cross_root}/${cross_triple}/sysroot) set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-s390x)