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

Cross compiling for aarch64 and ppc64le #105

Merged
merged 4 commits into from
Aug 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ cxx_compiler_version:
- '7'
docker_image:
- condaforge/linux-anvil-comp7
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x
python:
- '3.7'
target_platform:
- linux-64
variant:
- default
vc:
Expand Down
22 changes: 22 additions & 0 deletions .ci_support/linux_aarch64_variantdefault.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BUILD:
- aarch64-conda_cos7-linux-gnu
cdt_arch:
- aarch64
cdt_name:
- cos7
channel_sources:
- conda-forge
channel_targets:
- conda-forge main
cxx_compiler:
- gxx
cxx_compiler_version:
- '7'
docker_image:
- condaforge/linux-anvil-comp7
target_platform:
- linux-aarch64
variant:
- default
vc:
- '14'
16 changes: 16 additions & 0 deletions .ci_support/linux_ppc64le_variantdefault.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
channel_sources:
- conda-forge,defaults
channel_targets:
- conda-forge main
cxx_compiler:
- gxx
cxx_compiler_version:
- '8'
docker_image:
- condaforge/linux-anvil-comp7
target_platform:
- linux-ppc64le
variant:
- default
vc:
- '14'
2 changes: 2 additions & 0 deletions .ci_support/osx_.yaml → .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ macos_machine:
- x86_64-apple-darwin13.4.0
macos_min_version:
- '10.9'
target_platform:
- osx-64
variant:
- default
vc:
Expand Down
2 changes: 2 additions & 0 deletions .ci_support/win_.yaml → .ci_support/win_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ channel_targets:
- conda-forge main
cxx_compiler:
- vs2017
target_platform:
- win-64
variant:
- default
vc:
Expand Down
6 changes: 5 additions & 1 deletion .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 20 additions & 12 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions azure-pipelines.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ travis:
secure: {BINSTAR_TOKEN: EjLNlquQ2jFVsxUtTcp3E50C0xUcTGYAW6al0PR1Qpxz5vs6jSpWLizx03XloiVwD4K5ykTAwe2FBNJ3Oh8uPIsXRldFzKQsr7RT+mzO9WjTakg/RD45EedEgQPYTtmBfT4etPnpOKX5l1GGSoxXgem3MkWzlPU2nbuXrXo9uHGnw6XdNBu5QNHEn81g8Ih9fNK85K7VD4s2vAdzP3EDvxbOl16H12UskCIvIsmfh/J5jjA1K1R1YFiXf+Lb99y5oCd9DDjUAUNx/dmGmS2cJBdvP45etS7W3Ddk7tIvHR7SvIvG052w7GAbkAsgUTbHST0pLsiaDZxRZlziqjUt+grFXejYhUhdBJfoJq4MXyiWF93WxEO9+BoDJQYmefqHibiS8g3tjdELhPcTdUfCUZeB9PXy1qlCCu440oid373KfIpgAsPm7OMGhGUASfkX9C1mZIgjBaU/Il32TnNxlzD18CTPbMgehElirvet7JCSV07CJuEJiZRqSE+t1aXiMMVukVDH+akW5RWF55yGzJAX8pICivglhoG7XdjGvKj0a+HjOXeoFLIRV07BiP+acZUdar8FbmPCnlX0t5nilTqp9cQAE8xXS09mTz6dQ9LEc8T8Bm1xGVOJ8SfxVwhsogIFGmNs0Cq7i2CF9VbwmNiIq+P//skvYfnuEA/PUJE=}
provider:
win: azure
# aarch64 and ppc64le are built manually because they don't fit in the CI timeouts
conda_forge_output_validation: true
build_platform:
linux_ppc64le: linux_64
linux_aarch64: linux_64
test_on_native_only: true
19 changes: 12 additions & 7 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ IFS='.' read -r -a PKG_VER_ARRAY <<< "${PKG_VERSION}"

sed -i.bak "s/libLTO.dylib/libLTO.${PKG_VER_ARRAY[0]}.dylib/g" lib/Driver/ToolChains/Darwin.cpp

mkdir build
cd build

if [[ "$variant" == "hcc" ]]; then
EXTRA_ARGS="$EXTRA_ARGS -DKALMAR_BACKEND=HCC_BACKEND_AMDGPU -DHCC_VERSION_STRING=2.7-19365-24e69cd8-24e69cd8-24e69cd8"
EXTRA_ARGS="$EXTRA_ARGS -DHCC_VERSION_MAJOR=2 -DHCC_VERSION_MINOR=7 -DHCC_VERSION_PATCH=19365"
EXTRA_ARGS="$EXTRA_ARGS -DKALMAR_SDK_COMMIT=24e69cd8 -DKALMAR_FRONTEND_COMMIT=24e69cd8 -DKALMAR_BACKEND_COMMIT=24e69cd8"
CMAKE_ARGS="$CMAKE_ARGS -DKALMAR_BACKEND=HCC_BACKEND_AMDGPU -DHCC_VERSION_STRING=2.7-19365-24e69cd8-24e69cd8-24e69cd8"
CMAKE_ARGS="$CMAKE_ARGS -DHCC_VERSION_MAJOR=2 -DHCC_VERSION_MINOR=7 -DHCC_VERSION_PATCH=19365"
CMAKE_ARGS="$CMAKE_ARGS -DKALMAR_SDK_COMMIT=24e69cd8 -DKALMAR_FRONTEND_COMMIT=24e69cd8 -DKALMAR_BACKEND_COMMIT=24e69cd8"
fi

if [[ "$CC_FOR_BUILD" != "" && "$CC_FOR_BUILD" != "$CC" ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_TABLEGEN_EXE=$BUILD_PREFIX/bin/llvm-tblgen -DNATIVE_LLVM_DIR=$BUILD_PREFIX/lib/cmake/llvm"
CMAKE_ARGS="${CMAKE_ARGS} -DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=$CC_FOR_BUILD;-DCMAKE_CXX_COMPILER=$CXX_FOR_BUILD;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2;-DCMAKE_EXE_LINKER_FLAGS=;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=;-DCMAKE_STATIC_LINKER_FLAGS=;"
fi

mkdir build
cd build

cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_PREFIX_PATH=$PREFIX \
Expand All @@ -24,7 +29,7 @@ cmake \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DCMAKE_AR=$AR \
$EXTRA_ARGS \
$CMAKE_ARGS \
..

make -j${CPU_COUNT}
12 changes: 10 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% set version = "10.0.1" %}
{% set major_version = version.split(".")[0] %}
{% set build_number = 0 %}
{% set build_number = 1 %}

package:
name: clang_packages
Expand All @@ -15,6 +15,7 @@ source:
- patches/0002-clang-add-conda-specific-env-var-CONDA_BUILD_SYSROOT.patch
- patches/0003-clang-Fix-normalizeProgramName-s-handling-of-dots-ou.patch
- patches/0001-Set-VERSION-in-osx-as-well.patch
- patches/cross-compile.diff
#- patches/amd-roc-2.7.0.diff # [variant != "hcc"]
#- patches/amd-roc-hcc-2.7.0.diff # [variant == "hcc"]
folder: .
Expand All @@ -37,6 +38,7 @@ requirements:
# Building with ninja on windows for parallel builds
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- llvmdev =={{ version }}
Expand Down Expand Up @@ -74,6 +76,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- {{ pin_subpackage("clang", exact=True) }}
- {{ pin_subpackage("clangxx", exact=True) }}
Expand Down Expand Up @@ -112,6 +115,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- llvmdev =={{ version }}
Expand Down Expand Up @@ -141,6 +145,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- llvmdev =={{ version }}
Expand Down Expand Up @@ -168,6 +173,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- llvmdev =={{ version }}
Expand Down Expand Up @@ -196,6 +202,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- llvmdev =={{ version }}
Expand Down Expand Up @@ -258,6 +265,7 @@ outputs:
- cmake >=3.4.3
- ninja # [win]
- make # [unix]
- llvmdev =={{ version }} # [build_platform != target_platform]
host:
- {{ pin_subpackage("clang", exact=True) }}
- {{ pin_subpackage("clangxx", exact=True) }}
Expand All @@ -281,7 +289,7 @@ outputs:
noarch: python
# Building this output using this recipe is only supported on unix
# It can still be installed on Windows as it is marked as `noarch: python`
skip: true # [win or variant=="hcc"]
skip: true # [win or variant=="hcc" or (build_platform != target_platform)]
track_features:
- hcc # [variant=="hcc"]
string: {{ variant }}_h{{ PKG_HASH }}_{{ build_number }}
Expand Down
19 changes: 19 additions & 0 deletions recipe/patches/cross-compile.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- CMakeLists.txt.old 2020-08-07 20:15:39.605174899 +0000
+++ CMakeLists.txt 2020-08-07 20:20:01.383910098 +0000
@@ -111,6 +111,16 @@
option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)

include(AddLLVM)
+ if(CMAKE_CROSSCOMPILING)
+ set(LLVM_USE_HOST_TOOLS ON)
+ include(CrossCompile)
+ if (NOT NATIVE_LLVM_DIR)
+ message(FATAL_ERROR
+ "Crosscompiling standalone requires the variable NATIVE_LLVM_DIR
+ for building the native lldb-tblgen used during the build process.")
+ endif()
+ llvm_create_cross_target(Clang NATIVE "" Release -DLLVM_DIR=${NATIVE_LLVM_DIR})
+ endif()
include(TableGen)
include(HandleLLVMOptions)
include(VersionFromVCS)