CI: bring non-power qemu cross CI to ubuntu-latest
This commit is contained in:
committed by
Nathaniel Filardo
parent
a396c2d4de
commit
9207f3d8a0
28
.github/workflows/main.yml
vendored
28
.github/workflows/main.yml
vendored
@@ -198,27 +198,39 @@ jobs:
|
|||||||
name: ${{matrix.build-type}} cross-build for ${{ matrix.arch.triple }}
|
name: ${{matrix.build-type}} cross-build for ${{ matrix.arch.triple }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install cross-compile toolchain and QEMU
|
- name: "Install cross-compile toolchain and QEMU (ubuntu-20.04)"
|
||||||
# Install the dependencies and clang 13. Earlier versions of clang don't
|
# Install the dependencies and clang 13. Earlier versions of clang don't
|
||||||
# find the multilib things for this week's Ubuntu filesystem layout.
|
# find the multilib things for this week's Ubuntu filesystem layout.
|
||||||
|
if: matrix.arch.host-os == 'ubuntu-20.04'
|
||||||
run: |
|
run: |
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
|
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install libstdc++-9-dev-${{ matrix.arch.name }}-cross qemu-user ninja-build clang-13 lld-13
|
sudo apt install libstdc++-9-dev-${{ matrix.arch.name }}-cross qemu-user ninja-build clang-13 lld-13
|
||||||
sudo apt install ${{matrix.arch.extra-packages}}
|
sudo apt install ${{matrix.arch.extra-packages}}
|
||||||
# The default PowerPC qemu configuration uses the wrong page size.
|
- name: "Install cross-compile toolchain and QEMU (ubuntu-latest)"
|
||||||
# Wrap it in a script that fixes this.
|
if: matrix.arch.host-os == 'ubuntu-latest'
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install libstdc++-12-dev-${{ matrix.arch.name }}-cross qemu-user ninja-build
|
||||||
|
sudo apt install ${{matrix.arch.extra-packages}}
|
||||||
|
- name: Reconfigure for PowerPC64LE
|
||||||
|
if: startsWith(matrix.arch.triple, 'powerpc64le')
|
||||||
|
# The default PowerPC qemu configuration uses the wrong page size.
|
||||||
|
# Wrap it in a script that fixes this.
|
||||||
|
run: |
|
||||||
sudo update-binfmts --disable qemu-ppc64le
|
sudo update-binfmts --disable qemu-ppc64le
|
||||||
sudo sh -c 'echo ":qemu-ppc64le:M:0:\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00:\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00:`pwd`/ppc64.sh:" > /proc/sys/fs/binfmt_misc/register'
|
sudo sh -c 'echo ":qemu-ppc64le:M:0:\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00:\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00:`pwd`/ppc64.sh:" > /proc/sys/fs/binfmt_misc/register'
|
||||||
echo '#!/bin/sh' > ppc64.sh
|
echo '#!/bin/sh' > ppc64.sh
|
||||||
echo '/usr/bin/qemu-ppc64le -p 65536 $@' >> ppc64.sh
|
echo '/usr/bin/qemu-ppc64le -p 65536 $@' >> ppc64.sh
|
||||||
chmod +x ppc64.sh
|
chmod +x ppc64.sh
|
||||||
- name: Configure
|
- name: Configure
|
||||||
|
env:
|
||||||
|
SNMALLOC_CI_CLANG_VERSION: ${{ (matrix.arch.host-os == 'ubuntu-latest') && 14 || 13 }}
|
||||||
|
RTLD_NAME: ${{ matrix.arch.rtld }}
|
||||||
|
ARCH: ${{ matrix.arch.system-processor }}
|
||||||
|
TRIPLE: ${{ matrix.arch.triple}}
|
||||||
run: >
|
run: >
|
||||||
RTLD_NAME=${{ matrix.arch.rtld }}
|
|
||||||
ARCH=${{ matrix.arch.system-processor }}
|
|
||||||
TRIPLE=${{ matrix.arch.triple}}
|
|
||||||
cmake
|
cmake
|
||||||
-B ${{github.workspace}}/build
|
-B ${{github.workspace}}/build
|
||||||
-DCMAKE_BUILD_TYPE=${{matrix.build-type}}
|
-DCMAKE_BUILD_TYPE=${{matrix.build-type}}
|
||||||
@@ -232,6 +244,10 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
run: NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja
|
run: NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja
|
||||||
|
# For debugging: verify that we've actually cross-compiled.
|
||||||
|
- name: Run `file` for inspection
|
||||||
|
working-directory: ${{github.workspace}}/build
|
||||||
|
run: file func*
|
||||||
# Run the tests, skipping the -malloc and perf- tests (perf doesn't make
|
# Run the tests, skipping the -malloc and perf- tests (perf doesn't make
|
||||||
# sense in an emulator and the pass-through malloc is slightly flaky in
|
# sense in an emulator and the pass-through malloc is slightly flaky in
|
||||||
# QEMU)
|
# QEMU)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ set(CMAKE_SYSTEM_PROCESSOR $ENV{ARCH})
|
|||||||
|
|
||||||
set(triple $ENV{TRIPLE})
|
set(triple $ENV{TRIPLE})
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER clang-13)
|
set(CMAKE_C_COMPILER clang-$ENV{SNMALLOC_CI_CLANG_VERSION})
|
||||||
set(CMAKE_C_COMPILER_TARGET ${triple})
|
set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||||
set(CMAKE_CXX_COMPILER clang++-13)
|
set(CMAKE_CXX_COMPILER clang++-$ENV{SNMALLOC_CI_CLANG_VERSION})
|
||||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||||
|
|
||||||
set(CROSS_LINKER_FLAGS "-fuse-ld=${SNMALLOC_LINKER_FLAVOUR} -Wl,--dynamic-linker=/usr/${triple}/lib/$ENV{RTLD_NAME},-rpath,/usr/${triple}/lib")
|
set(CROSS_LINKER_FLAGS "-fuse-ld=${SNMALLOC_LINKER_FLAVOUR} -Wl,--dynamic-linker=/usr/${triple}/lib/$ENV{RTLD_NAME},-rpath,/usr/${triple}/lib")
|
||||||
|
|||||||
Reference in New Issue
Block a user