Skip to content

Commit 2a853ce

Browse files
vadorovskythesamesam
authored andcommitted
ci: Test building sysroots with LLVM
Add --llvm argument to the container_test.sh script. Use it on CI in combination with the llvm stage3 image. Signed-off-by: Michal Rostecki <[email protected]> Part-of: #24 Closes: #24 Signed-off-by: Sam James <[email protected]>
1 parent 26861c7 commit 2a853ce

File tree

2 files changed

+129
-6
lines changed

2 files changed

+129
-6
lines changed

.github/workflows/crossdev.yml

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,147 @@ jobs:
2222
# requests fixing them welcome!
2323
target:
2424
- target: aarch64-unknown-linux-gnu
25+
gcc: true
26+
llvm: false
2527
- target: aarch64-unknown-linux-musl
28+
gcc: true
29+
llvm: true
2630
- target: aarch64_be-unknown-linux-gnu
31+
gcc: true
32+
llvm: false
2733
- target: alpha-unknown-linux-gnu
34+
gcc: true
35+
llvm: false
2836
- target: arm-unknown-linux-gnueabi
37+
gcc: true
38+
llvm: false
2939
- target: arm-unknown-linux-gnueabihf
40+
gcc: true
41+
llvm: false
3042
- target: arm-unknown-linux-musleabi
43+
gcc: true
44+
llvm: false
3145
- target: arm-unknown-linux-musleabihf
46+
gcc: true
47+
llvm: false
3248
- target: armeb-unknown-linux-gnueabi
49+
gcc: true
50+
llvm: false
3351
- target: armeb-unknown-linux-gnueabihf
52+
gcc: true
53+
llvm: false
3454
- target: armeb-unknown-linux-musleabi
55+
gcc: true
56+
llvm: false
3557
- target: armeb-unknown-linux-musleabihf
58+
gcc: true
59+
llvm: false
3660
- target: armv7-unknown-linux-musleabi
61+
gcc: true
62+
llvm: false
3763
- target: armv7-unknown-linux-musleabihf
64+
gcc: true
65+
llvm: false
3866
- target: armv6j-softfp-linux-gnueabi
67+
gcc: true
68+
llvm: false
3969
- target: armv6j-unknown-linux-gnueabihf
70+
gcc: true
71+
llvm: false
4072
- target: armv7a-softfp-linux-gnueabi
73+
gcc: true
74+
llvm: false
4175
- target: armv7a-unknown-linux-gnueabihf
76+
gcc: true
77+
llvm: false
4278
- target: hppa1.1-unknown-linux-gnu
79+
gcc: true
80+
llvm: false
4381
- target: hppa2.0-unknown-linux-gnu
82+
gcc: true
83+
llvm: false
4484
- target: hppa64-unknown-linux-gnu
4585
args: --skip-system
86+
gcc: true
87+
llvm: false
4688
- target: loongarch64-unknown-linux-gnu
89+
gcc: true
90+
llvm: false
4791
# musl ebuilds don't support loong. The target is supported upstream,
4892
# we need to fix and test our ebuilds.
4993
#- target: loongarch64-unknown-linux-musl
5094
- target: m68k-unknown-linux-gnu
95+
gcc: true
96+
llvm: false
5197
- target: mips-unknown-linux-gnu
98+
gcc: true
99+
llvm: false
52100
- target: mips-unknown-linux-musl
101+
gcc: true
102+
llvm: false
53103
- target: mipsel-unknown-linux-gnu
104+
gcc: true
105+
llvm: false
54106
- target: mipsel-unknown-linux-musl
107+
gcc: true
108+
llvm: false
55109
- target: mips64-unknown-linux-gnu
110+
gcc: true
111+
llvm: false
56112
# libgcc_s.so fails to build: `cannot find crti.o: No such file or
57113
# directory`.
58114
# - target: mips64-unknown-linux-musl
59115
- target: mips64el-unknown-linux-gnu
116+
gcc: true
117+
llvm: false
60118
# libgcc_s.so fails to build: `cannot find crti.o: No such file or
61119
# directory`.
62120
# - target: mips64el-unknown-linux-musl
63121
- target: or1k-unknown-linux-gnu
64122
args: --skip-system
123+
gcc: true
124+
llvm: false
65125
- target: or1k-unknown-linux-musl
66126
args: --skip-system
127+
gcc: true
128+
llvm: false
67129
- target: powerpc-unknown-linux-gnu
130+
gcc: true
131+
llvm: false
68132
- target: powerpc-unknown-linux-musl
133+
gcc: true
134+
llvm: false
69135
- target: powerpc64-unknown-linux-gnu
136+
gcc: true
137+
llvm: false
70138
- target: powerpc64-unknown-linux-musl
139+
gcc: true
140+
llvm: false
71141
- target: powerpc64le-unknown-linux-gnu
142+
gcc: true
143+
llvm: false
72144
- target: riscv32-unknown-linux-gnu
145+
gcc: true
146+
llvm: false
73147
# busybox fails to build: `‘SYS_settimeofday’ undeclared`.
74148
# - target: riscv32-unknown-linux-musl
75149
- target: riscv64-unknown-linux-gnu
150+
gcc: true
151+
llvm: false
76152
- target: riscv64-unknown-linux-musl
153+
gcc: true
154+
llvm: true
77155
# glibc fails to build: `no support for pre-v8 sparc`.
78156
# - target: sparc-unknown-linux-gnu
79157
- target: sparc64-unknown-linux-gnu
158+
gcc: true
159+
llvm: false
80160
- target: s390-ibm-linux-gnu
161+
gcc: true
162+
llvm: false
81163
- target: s390x-ibm-linux-gnu
164+
gcc: true
165+
llvm: false
82166
# musl ebuilds don't support s390x. The target is supported upstream,
83167
# we need to fix and test our ebuilds.
84168
# - target: s390x-unknown-linux-musl
@@ -93,30 +177,58 @@ jobs:
93177
# - target: sh4eb-unknown-linux-gnu
94178
# - target: sh4eb-unknown-linux-musl
95179
- target: x86_64-unknown-linux-gnu
180+
gcc: true
181+
llvm: false
96182
- target: x86_64-unknown-linux-musl
183+
gcc: true
184+
llvm: true
97185
# Embedded or otherwise special targets
98186
- target: arm-none-eabi
99187
args: --skip-system
188+
gcc: true
189+
llvm: false
100190
- target: avr
101191
args: --skip-system
192+
gcc: true
193+
llvm: false
102194
- target: nvptx-none
103195
args: --skip-system
196+
gcc: true
197+
llvm: false
104198
- target: bpf-unknown-none
105199
args: --skip-system
200+
gcc: true
201+
llvm: false
106202
stage3:
107-
- latest # `openrc` (glibc+GCC) is tagged as `latest`
108-
- musl
203+
- latest # glibc+GCC
204+
- llvm # glibc+LLVM and GCC as a fallback
205+
- musl # musl+GCC
109206
fail-fast: false
110207
name: crossdev target=${{ matrix.target.target }} stage3=${{ matrix.stage3 }}
208+
env:
209+
CONTAINER_ENGINE: docker
111210
runs-on: ubuntu-latest
112211
steps:
113212
- uses: actions/checkout@v4
114213

115-
- name: Create cross environment
116-
env:
117-
CONTAINER_ENGINE: docker
214+
- name: Create cross environment with GCC
215+
# Building GCC-based sysroots on llvm stage3 should be possible, since
216+
# it contains a fallback GCC toolchain. But in practice, it fails for
217+
# certain architectures. Pull requests welcome!
218+
if: ${{ matrix.target.gcc && !contains(matrix.stage3, 'llvm') }}
118219
run: |
119220
./scripts/container_test.sh \
120221
--tag ${{ matrix.stage3 }} \
121222
--target ${{ matrix.target.target }} \
122223
${{ matrix.target.args }}
224+
225+
- name: Create cross environment with LLVM
226+
# * We need LLVM toolchain to be present in the stage3.
227+
# * Building sysroots with glibc and LLVM is not yet supported.
228+
if: ${{ matrix.target.llvm && contains(matrix.stage3, 'llvm') }}
229+
run: |
230+
./scripts/container_test.sh \
231+
--llvm \
232+
--tag ${{ matrix.stage3 }} \
233+
--target ${{ matrix.target.target }} \
234+
${{ matrix.target.args }}

scripts/container_test.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ print_help() {
66
echo "Usage: $0 [OPTIONS]
77
88
Options:
9+
--llvm Use LLVM/Clang as a cross compiler
910
--skip-system Skip emerging the @system set after setting up crossdev.
1011
--tag <tag> Specify the container tag to use. Default is 'latest'.
1112
--target <target> Specify the target architecture for crossdev. Required.
@@ -54,6 +55,7 @@ CONTAINER_NAME=${CONTAINER_NAME:-"crossdev"}
5455
CONTAINER_URI=${CONTAINER_URI:-"docker.io/gentoo/stage3"}
5556
CONTAINER_TAG="latest"
5657
EMERGE_SYSTEM=1
58+
USE_LLVM=0
5759
TOPDIR=$(git rev-parse --show-toplevel)
5860

5961
remove_container || true
@@ -65,6 +67,10 @@ while [[ $# -gt 0 ]]; do
6567
print_help
6668
exit 0
6769
;;
70+
--llvm)
71+
USE_LLVM=1
72+
shift 1
73+
;;
6874
--skip-system)
6975
EMERGE_SYSTEM=0
7076
shift 1
@@ -85,6 +91,11 @@ while [[ $# -gt 0 ]]; do
8591
esac
8692
done
8793

94+
EXTRA_ARGS=()
95+
if [[ "${USE_LLVM}" -eq 1 ]]; then
96+
EXTRA_ARGS+="--llvm"
97+
fi
98+
8899
"${CONTAINER_ENGINE}" run -d \
89100
--pull always \
90101
--name "${CONTAINER_NAME}" \
@@ -98,7 +109,7 @@ run_in_container getuto
98109
run_in_container emerge --getbinpkg app-eselect/eselect-repository sys-apps/config-site
99110
run_in_container make install
100111
run_in_container eselect repository create crossdev
101-
run_in_container crossdev --show-fail-log --target "${TARGET}"
112+
run_in_container crossdev --show-fail-log "${EXTRA_ARGS[@]}" --target "${TARGET}"
102113
if [[ "${EMERGE_SYSTEM}" -eq 1 ]]; then
103114
run_in_container "${TARGET}-emerge" @system
104115
fi

0 commit comments

Comments
 (0)