Skip to content

Commit

Permalink
Merge pull request #863 from ArsenArsen/kill/cxxshim
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisbonke authored Nov 30, 2023
2 parents 96e57af + 3bceb57 commit 749b27b
Show file tree
Hide file tree
Showing 23 changed files with 257 additions and 159 deletions.
80 changes: 53 additions & 27 deletions .github/workflows/abidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,20 @@ on:
jobs:
run-abidiff:
name: Compare ABIs
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
container:
image: ghcr.io/managarm/mlibc-crossers:latest
defaults:
run:
shell: bash
steps:
- name: Install prerequisites
run: |
sudo apt-get install ninja-build g++-10 abigail-tools
sudo pip3 install setuptools
sudo pip3 install meson xbstrap
apt-get update
apt-get install -y ninja-build qemu-user \
python3-setuptools python3-jsonschema \
python3-pip abigail-tools
pip install -U xbstrap pyexpect meson
- name: Checkout base branch
if: ${{ github.base_ref }}
Expand Down Expand Up @@ -56,48 +63,67 @@ jobs:
- name: Set up linux kernel headers
run: |
mkdir -p linux-headers-base/{src,build}
cp mlibc-base/ci/bootstrap.yml linux-headers-base/src/
(
cd linux-headers-base/build
xbstrap init ../src
xbstrap install linux-headers
)
mkdir -p linux-headers-branch/{src,build}
cp mlibc-branch/ci/bootstrap.yml linux-headers-branch/src/
(
cd linux-headers-branch/build
xbstrap init ../src
xbstrap install linux-headers
)
cat > linux-headers-base/build/bootstrap-site.yml << EOF
define_options:
arch: ${{matrix.arch}}
EOF
cp linux-headers-base/build/bootstrap-site.yml linux-headers-branch/build/bootstrap-site.yml
set -x
mkdir -p linux-headers-base/{src,build}
cp mlibc-base/ci/bootstrap.yml linux-headers-base/src/
(
cd linux-headers-base/build
xbstrap init ../src
xbstrap install linux-headers
)
mkdir -p linux-headers-branch/{src,build}
cp mlibc-branch/ci/bootstrap.yml linux-headers-branch/src/
(
cd linux-headers-branch/build
xbstrap init ../src
xbstrap install linux-headers
)
cat > linux-headers-base/build/bootstrap-site.yml << EOF
define_options:
arch: ${{matrix.arch}}
EOF
cp linux-headers-base/build/bootstrap-site.yml linux-headers-branch/build/bootstrap-site.yml
- name: Build and install both copies
run: |
set -xe
export C=gcc-10 CXX=g++-10
mkdir root-base root-branch
cat > linux-x86_64.cross-file <<-EOF
[binaries]
c = ['x86_64-linux-mlibc-gcc']
cpp = ['x86_64-linux-mlibc-g++']
[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
EOF
(
cd mlibc-branch
meson --buildtype=debugoptimized -Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-branch/build/packages/linux-headers/usr/include build
meson setup \
--cross-file=../linux-x86_64.cross-file \
--buildtype=debugoptimized \
-Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-branch/build/packages/linux-headers/usr/include \
build
ninja -C build
DESTDIR="$GITHUB_WORKSPACE/root-branch" ninja -C build install
)
(
cd mlibc-base
# defaults to all features, linux build
meson --buildtype=debugoptimized -Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-base/build/packages/linux-headers/usr/include build
meson setup \
--cross-file=../linux-x86_64.cross-file \
--buildtype=debugoptimized \
-Dlinux_kernel_headers=$GITHUB_WORKSPACE/linux-headers-branch/build/packages/linux-headers/usr/include \
build
ninja -C build
DESTDIR="$GITHUB_WORKSPACE/root-base" ninja -C build install
)
- name: Compare
run: |
# TODO(arsen): does this require handling for version suffixes?
set -e +x
exec 2>&1 # work around GHA foolishly decoupling stdout and stderr
exitcode=0
git -C mlibc-branch show -s --format=%s | grep -q abi-break || \
Expand Down
40 changes: 18 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ jobs:
arch: [x86_64, riscv64, aarch64]
builds: [mlibc, mlibc-static, mlibc-shared, mlibc-ansi-only, mlibc-headers-only]
name: Build mlibc
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: ghcr.io/managarm/mlibc-crossers:latest
steps:
- name: Install prerequisites
# Note: the default jsonschema is too old.
# xbstrap should fix this by demanding a recent version.
run: |
sudo apt-get update
sudo apt-get install ninja-build g++-10 g++-10-riscv64-linux-gnu g++-10-aarch64-linux-gnu qemu-user
sudo pip3 install setuptools
sudo pip3 install -U jsonschema
sudo pip3 install meson xbstrap
sudo pip3 install pyexpect
apt-get update
apt-get install -y ninja-build qemu-user \
python3-setuptools python3-jsonschema \
python3-pexpect python3-pip netbase
pip install -U xbstrap pyexpect meson
- name: Prepare directories
run: |
mkdir src/
Expand Down Expand Up @@ -49,26 +48,23 @@ jobs:
- name: Test mlibc
run: 'meson test -v -C pkg-builds/${{matrix.builds}}'
working-directory: build/
- name: Build GCC
if: ${{matrix.builds == 'mlibc' && matrix.arch == 'x86_64'}}
run: 'xbstrap install-tool gcc'
working-directory: build/

compile-sysdeps:
strategy:
matrix:
sysdeps: [dripos, lemon, aero, ironclad, lyre, keyronex]
name: Compile sysdeps
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
container:
image: ghcr.io/managarm/mlibc-crossers:latest
steps:
- name: Install prerequisites
# Note: the default jsonschema is too old.
# xbstrap should fix this by demanding a recent version.
run: |
sudo apt-get install ninja-build g++-10
sudo pip3 install setuptools
sudo pip3 install -U jsonschema
sudo pip3 install meson xbstrap
apt-get update
apt-get install -y ninja-build qemu-user \
python3-setuptools python3-jsonschema \
python3-pip
pip install -U xbstrap meson
- name: Checkout
uses: actions/checkout@v2
with:
Expand All @@ -85,8 +81,8 @@ jobs:
- name: Compile sysdeps
run: |
meson setup \
"-Dc_args=['-fno-stack-protector', '-U__linux__']" \
"-Dcpp_args=['-fno-stack-protector', '-U__linux__']" \
"-Dc_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized']" \
"-Dcpp_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized']" \
"-Dbuild_tests=true" \
"-Db_sanitize=undefined" \
"-Dlinux_kernel_headers=$(pwd)/packages/linux-headers/usr/include" \
Expand Down
4 changes: 2 additions & 2 deletions ci/aero.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = 'gcc-10'
cpp = 'g++-10'
c = 'x86_64-linux-mlibc-gcc'
cpp = 'x86_64-linux-mlibc-g++'

[properties]
needs_exe_wrapper = true
Expand Down
67 changes: 13 additions & 54 deletions ci/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ declare_options:
default: x86_64

sources:
- name: gcc
git: 'git://gcc.gnu.org/git/gcc.git'
tag: 'releases/gcc-10.3.0'
regenerate:
- args: ['./contrib/download_prerequisites']
workdir: '@THIS_SOURCE_DIR@'

- name: mlibc
git: 'https://github.com/managarm/mlibc.git'
branch: 'master'
Expand All @@ -21,53 +14,6 @@ sources:
version: '6.1.8'

tools:
- name: gcc
from_source: gcc
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
- '--prefix=@PREFIX@'
- '--program-prefix=mlibc-'
- '--with-sysroot=@SYSROOT_DIR@'
- '--enable-languages=c,c++'
- '--disable-multilib'
- '--disable-bootstrap'
- '--disable-libgomp'
- '--with-specs=%{!static:%x{-rpath=@SYSROOT_DIR@/usr/lib} %x{-dynamic-linker=@SYSROOT_DIR@/usr/lib/ld.so}}'
# -g blows up GCC's binary size.
- 'CFLAGS=-O2'
- 'CXXFLAGS=-O2'
environ:
C: 'gcc-10'
CXX: 'g++-10'
stages:
- name: compiler
pkgs_required:
- mlibc
- linux-headers
compile:
# GCC complains if the include directory is non-existant.
- args: ['mkdir', '-p', '@SYSROOT_DIR@/usr/include']
- args: ['make', '-j@PARALLELISM@', 'all-gcc']
install:
- args: ['make', 'install-gcc']
- name: libgcc
tools_required:
- tool: gcc
stage_dependencies: [compiler]
compile:
- args: ['make', '-j@PARALLELISM@', 'all-target-libgcc']
install:
- args: ['make', 'install-target-libgcc']
# TODO: libstdc++ requires some patching before it will work.
# - name: libstdc++
# tools_required:
# - tool: gcc
# stage_dependencies: [libgcc]
# compile:
# - args: ['make', '-j@PARALLELISM@', 'all-target-libstdc++-v3']
# install:
# - args: ['make', 'install-target-libstdc++-v3']

packages:
- name: mlibc
Expand All @@ -81,13 +27,18 @@ packages:
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- "-Dc_args=['-Wno-error=maybe-uninitialized']"
- "-Dcpp_args=['-Wno-error=maybe-uninitialized']"
- "-Dbuild_tests=true"
- "-Db_sanitize=undefined"
- "-Ddefault_library=both"
- "-Dwerror=true"
- '-Dlinux_kernel_headers=@BUILD_ROOT@/packages/linux-headers/usr/include'
- "--cross-file=@THIS_SOURCE_DIR@/ci/linux-@OPTION:[email protected]"
- '@THIS_SOURCE_DIR@'
environ:
CFLAGS: '-Wno-error=maybe-uninitialized'
CXXFLAGS: '-Wno-error=maybe-uninitialized'
build:
- args: ['ninja']
- args: ['ninja', 'install']
Expand All @@ -106,6 +57,8 @@ packages:
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- "-Dc_args=['-Wno-error=maybe-uninitialized']"
- "-Dcpp_args=['-Wno-error=maybe-uninitialized']"
- "-Dbuild_tests=true"
- "-Db_sanitize=undefined"
- "-Ddefault_library=static"
Expand All @@ -130,6 +83,8 @@ packages:
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- "-Dc_args=['-Wno-error=maybe-uninitialized']"
- "-Dcpp_args=['-Wno-error=maybe-uninitialized']"
- "-Dbuild_tests=true"
- "-Db_sanitize=undefined"
- "-Ddefault_library=shared"
Expand All @@ -155,6 +110,8 @@ packages:
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- "-Dc_args=['-Wno-error=maybe-uninitialized']"
- "-Dcpp_args=['-Wno-error=maybe-uninitialized']"
- "-Dbuild_tests=true"
- "-Db_sanitize=undefined"
- "-Ddefault_library=both"
Expand Down Expand Up @@ -184,6 +141,8 @@ packages:
- '--prefix=/usr'
- '--libdir=lib'
- '--buildtype=debugoptimized'
- "-Dc_args=['-Wno-error=maybe-uninitialized']"
- "-Dcpp_args=['-Wno-error=maybe-uninitialized']"
- "-Db_sanitize=undefined"
- "-Dwerror=true"
- "-Dheaders_only=true"
Expand Down
4 changes: 2 additions & 2 deletions ci/dripos.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = 'gcc-10'
cpp = 'g++-10'
c = 'x86_64-linux-mlibc-gcc'
cpp = 'x86_64-linux-mlibc-g++'

[properties]
needs_exe_wrapper = true
Expand Down
4 changes: 2 additions & 2 deletions ci/ironclad.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = 'gcc-10'
cpp = 'g++-10'
c = 'x86_64-linux-mlibc-gcc'
cpp = 'x86_64-linux-mlibc-g++'

[properties]
needs_exe_wrapper = true
Expand Down
4 changes: 2 additions & 2 deletions ci/keyronex.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = ['gcc-10']
cpp = ['g++-10']
c = ['x86_64-linux-mlibc-gcc']
cpp = ['x86_64-linux-mlibc-g++']

[host_machine]
system = 'keyronex'
Expand Down
4 changes: 2 additions & 2 deletions ci/lemon.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = 'gcc-10'
cpp = 'g++-10'
c = 'x86_64-linux-mlibc-gcc'
cpp = 'x86_64-linux-mlibc-g++'

[properties]
needs_exe_wrapper = true
Expand Down
4 changes: 2 additions & 2 deletions ci/linux-aarch64.cross-file
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
skip_sanity_check = true

[binaries]
c = ['aarch64-linux-gnu-gcc-10']
cpp = ['aarch64-linux-gnu-g++-10']
c = ['aarch64-linux-mlibc-gcc']
cpp = ['aarch64-linux-mlibc-g++']
exe_wrapper = 'qemu-aarch64'

[host_machine]
Expand Down
4 changes: 2 additions & 2 deletions ci/linux-riscv64.cross-file
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
skip_sanity_check = true

[binaries]
c = ['riscv64-linux-gnu-gcc-10']
cpp = ['riscv64-linux-gnu-g++-10']
c = ['riscv64-linux-mlibc-gcc']
cpp = ['riscv64-linux-mlibc-g++']
exe_wrapper = 'qemu-riscv64'

[host_machine]
Expand Down
4 changes: 2 additions & 2 deletions ci/linux-x86_64.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = ['gcc-10']
cpp = ['g++-10']
c = ['x86_64-linux-mlibc-gcc']
cpp = ['x86_64-linux-mlibc-g++']

[host_machine]
system = 'linux'
Expand Down
4 changes: 2 additions & 2 deletions ci/lyre.cross-file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[binaries]
c = 'gcc-10'
cpp = 'g++-10'
c = 'x86_64-linux-mlibc-gcc'
cpp = 'x86_64-linux-mlibc-g++'

[properties]
needs_exe_wrapper = true
Expand Down
Loading

0 comments on commit 749b27b

Please sign in to comment.