Skip to content

Commit 47de037

Browse files
committed
Different attempt at fixing the CI
1 parent f8285e3 commit 47de037

File tree

6 files changed

+148
-57
lines changed

6 files changed

+148
-57
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: |
5050
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
5151
sudo apt update
52-
sudo apt-get install ninja-build ripgrep llvm-14-tools gcc-13 gcc-multilib
52+
sudo apt-get install ninja-build ripgrep llvm-14-tools
5353
5454
- name: Install libgccjit12
5555
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
@@ -67,46 +67,81 @@ jobs:
6767
event: push
6868
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
6969

70+
- name: Download artifact
71+
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
72+
uses: dawidd6/action-download-artifact@v2
73+
with:
74+
workflow: main.yml
75+
name: gcc-13
76+
path: gcc-13
77+
repo: antoyo/gcc
78+
branch: "master"
79+
event: push
80+
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
81+
7082
- name: Setup path to libgccjit
7183
if: matrix.libgccjit_version.gcc == 'libgccjit12.so'
7284
run: echo /usr/lib/gcc/x86_64-linux-gnu/12 > gcc_path
7385

7486
- name: Setup path to libgccjit
7587
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
7688
run: |
77-
78-
echo stddef.h
79-
find / -name stddef.h 2> /dev/null || true
80-
echo "************"
81-
82-
echo lto1
83-
find / -name lto1 2> /dev/null || true
84-
echo "************"
85-
86-
echo lto-wrapper
87-
find / -name lto-wrapper 2> /dev/null || true
88-
echo "************"
89-
90-
echo gcc
91-
find / -name gcc 2> /dev/null || true
92-
echo "************"
93-
94-
echo liblto_plugin.so
95-
find / -name liblto_plugin.so 2> /dev/null || true
96-
echo "************"
97-
98-
echo $(readlink -f gcc-build/build/gcc) > gcc_path
99-
# NOTE: the filename is still libgccjit.so even when the artifact name is different.
100-
ln gcc-build/build/gcc/libgccjit.so gcc-build/build/gcc/libgccjit.so.0
101-
mkdir -p /opt/gcc/libexec/gcc/x86_64-linux-gnu/13 /opt/gcc/libexec/x86_64-linux-gnu/13/
102-
cd gcc-build/build/gcc
103-
chmod +x lto-wrapper lto1
104-
cp *lto* /opt/gcc/libexec/gcc/x86_64-linux-gnu/13/
105-
cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so /opt/gcc/libexec/x86_64-linux-gnu/13/
106-
cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a /opt/gcc/libexec/
107-
cp /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 /opt/gcc/libexec/gcc/cc1
108-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
109-
sudo update-alternatives --all
89+
sudo dpkg --force-overwrite -i gcc-13/gcc-13.deb
90+
echo /usr/lib/ > gcc_path
91+
92+
#echo stddef.h
93+
#find / -name stddef.h 2> /dev/null || true
94+
#echo "************"
95+
96+
#echo lto1
97+
#find / -name lto1 2> /dev/null || true
98+
#echo "************"
99+
# /usr/libexec/gcc/x86_64-linux-gnu/13/lto1
100+
# /usr/lib/gcc/x86_64-linux-gnu/12/lto1
101+
102+
#echo lto-wrapper
103+
#find / -name lto-wrapper 2> /dev/null || true
104+
#echo "************"
105+
# /usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
106+
# /usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
107+
108+
#echo gcc
109+
#find / -name gcc 2> /dev/null || true
110+
#echo "************"
111+
112+
#echo liblto_plugin.so
113+
#find / -name liblto_plugin.so 2> /dev/null || true
114+
#echo "************"
115+
# /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so
116+
# /usr/lib/gcc/x86_64-linux-gnu/12/liblto_plugin.so
117+
# /usr/lib/gcc/x86_64-linux-gnu/13/liblto_plugin.so
118+
119+
#echo $(readlink -f gcc-build/build/gcc) > gcc_path
120+
## NOTE: the filename is still libgccjit.so even when the artifact name is different.
121+
#ln gcc-build/build/gcc/libgccjit.so gcc-build/build/gcc/libgccjit.so.0
122+
##mkdir -p /opt/gcc/libexec/gcc/x86_64-linux-gnu/13 /opt/gcc/libexec/x86_64-linux-gnu/13/
123+
#sudo mkdir -p /usr/lib/gcc/x86_64-pc-linux-gnu/13.0.0/ /usr/libexec/gcc/x86_64-pc-linux-gnu/13.0.0
124+
#sudo cp gcc-build/install/bin/gcc /usr/bin/gcc-13
125+
#cd gcc-build/build/gcc
126+
#chmod +x lto-wrapper lto1
127+
##sudo cp liblto_plugin.so /usr/lib/gcc/x86_64-pc-linux-gnu/13.0.0/liblto_plugin.so # FIXME: might not work.
128+
#sudo cp liblto_plugin.so /usr/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/liblto_plugin.so # TODO: should work.
129+
#sudo cp lto1 /usr/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto1
130+
#sudo cp lto-wrapper /usr/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
131+
132+
# TODO TODO TODO: probably need to build gcc with --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
133+
# TODO TODO TODO: bundle that into a .deb file.
134+
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=gcc11
135+
136+
##cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so /opt/gcc/libexec/x86_64-linux-gnu/13/
137+
## TODO: copy from version 13.
138+
## TODO: understand why it doesn't pick the one from the version 13 automatically.
139+
#sudo cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so /usr/lib/
140+
#sudo cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a /usr/lib
141+
##cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a /opt/gcc/libexec/
142+
##cp /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 /opt/gcc/libexec/gcc/cc1
143+
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
144+
#sudo update-alternatives --all
110145
111146
- name: Set env
112147
run: |
@@ -174,6 +209,9 @@ jobs:
174209
if: ${{ matrix.libgccjit_version.gcc == 'libgccjit12.so' }}
175210
run: cat failing-ui-tests12.txt >> failing-ui-tests.txt
176211

212+
- name: Add more failing tests because the sysroot is not compiled with LTO
213+
run: cat failing-non-lto-tests.txt >> failing-ui-tests.txt
214+
177215
- name: Run tests
178216
run: |
179217
${{ matrix.libgccjit_version.env_extra }} ./test.sh --release --clean --build-sysroot ${{ matrix.commands }} ${{ matrix.libgccjit_version.extra }}

.github/workflows/release.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,39 @@ jobs:
5050
event: push
5151
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
5252

53+
- name: Download artifact
54+
if: matrix.libgccjit_version.gcc != 'libgccjit12.so'
55+
uses: dawidd6/action-download-artifact@v2
56+
with:
57+
workflow: main.yml
58+
name: gcc-13
59+
path: gcc-13
60+
repo: antoyo/gcc
61+
branch: "master"
62+
event: push
63+
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.
64+
5365
- name: Setup path to libgccjit
5466
run: |
55-
echo $(readlink -f gcc-build/build/gcc) > gcc_path
56-
# NOTE: the filename is still libgccjit.so even when the artifact name is different.
57-
ln gcc-build/build/gcc/libgccjit.so gcc-build/build/gcc/libgccjit.so.0
58-
mkdir -p /opt/gcc/libexec/gcc/x86_64-linux-gnu/13 /opt/gcc/libexec/x86_64-linux-gnu/13/ /opt/gcc/bin
59-
cp gcc-build/install/bin/gcc /opt/gcc/bin/gcc
60-
cd gcc-build/build/gcc
61-
chmod +x lto-wrapper lto1 /opt/gcc/bin/gcc
62-
cp *lto* /opt/gcc/libexec/gcc/x86_64-linux-gnu/
63-
#cp crt*.o /opt/gcc/libexec/x86_64-linux-gnu/13/
64-
cp crt*.o /opt/gcc/libexec/x86_64-linux-gnu/
65-
cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so /opt/gcc/libexec/x86_64-linux-gnu/
66-
cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a /opt/gcc/libexec/
67-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
68-
# TODO: add comment if this fixes the -fno-inline errors.
69-
# TODO: do some tests locally to know which binary needs to be copied from the system installation.
70-
#cp /usr/libexec/gcc/x86_64-linux-gnu/13/lto1 /opt/gcc/libexec/gcc/x86_64-linux-gnu/13/
67+
sudo dpkg --force-overwrite -i gcc-13/gcc-13.deb
68+
echo /usr/lib/ > gcc_path
69+
70+
#echo $(readlink -f gcc-build/build/gcc) > gcc_path
71+
## NOTE: the filename is still libgccjit.so even when the artifact name is different.
72+
#ln gcc-build/build/gcc/libgccjit.so gcc-build/build/gcc/libgccjit.so.0
73+
#mkdir -p /opt/gcc/libexec/gcc/x86_64-linux-gnu/13 /opt/gcc/libexec/x86_64-linux-gnu/13/ /opt/gcc/bin
74+
#cp gcc-build/install/bin/gcc /opt/gcc/bin/gcc
75+
#cd gcc-build/build/gcc
76+
#chmod +x lto-wrapper lto1 /opt/gcc/bin/gcc
77+
#cp *lto* /opt/gcc/libexec/gcc/x86_64-linux-gnu/
78+
##cp crt*.o /opt/gcc/libexec/x86_64-linux-gnu/13/
79+
#cp crt*.o /opt/gcc/libexec/x86_64-linux-gnu/
80+
#cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc_s.so /opt/gcc/libexec/x86_64-linux-gnu/
81+
#cp /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a /opt/gcc/libexec/
82+
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13
83+
## TODO: add comment if this fixes the -fno-inline errors.
84+
## TODO: do some tests locally to know which binary needs to be copied from the system installation.
85+
##cp /usr/libexec/gcc/x86_64-linux-gnu/13/lto1 /opt/gcc/libexec/gcc/x86_64-linux-gnu/13/
7186
7287
- name: Set env
7388
run: |
@@ -106,7 +121,7 @@ jobs:
106121
run: |
107122
./prepare_build.sh
108123
./build.sh --release --release-sysroot
109-
GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu cargo test
124+
cargo test
110125
./clean_all.sh
111126
112127
- name: Prepare dependencies
@@ -122,6 +137,9 @@ jobs:
122137
command: build
123138
args: --release
124139

140+
- name: Add more failing tests because of undefined symbol errors
141+
run: cat failing-lto-tests.txt >> failing-ui-tests.txt
142+
125143
- name: Run tests
126144
run: |
127145
./test.sh --release --clean --release-sysroot --build-sysroot ${{ matrix.commands }}

build_sysroot/build_sysroot.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ rm -r sysroot/ 2>/dev/null || true
1919
export RUSTFLAGS="$RUSTFLAGS -Z force-unstable-if-unmarked"
2020
if [[ "$1" == "--release" ]]; then
2121
sysroot_channel='release'
22-
# To avoid the -fno-inline errors, use /opt/gcc/bin/gcc instead of cc.
23-
LIBRARY_PATH=gcc-build GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3 -Clinker=/opt/gcc/bin/gcc" cargo build --target $TARGET_TRIPLE --release
22+
# To avoid the -fno-inline errors, use /opt/gcc/bin/gcc instead of cc. With:
23+
# -Clinker=/opt/gcc/bin/gcc
24+
#LIBRARY_PATH=gcc-build GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu
25+
RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
2426
#CG_GCCJIT_DUMP_TREE_ALL=1 CG_GCCJIT_KEEP_INTERMEDIATES=1 RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
2527
else
2628
sysroot_channel='debug'

failing-lto-tests.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
tests/ui/lint/unsafe_code/forge_unsafe_block.rs
2+
tests/ui/lint/unused-qualification-in-derive-expansion.rs
3+
tests/ui/macro-quote-test.rs
4+
tests/ui/macros/proc_macro.rs
5+
tests/ui/panic-runtime/lto-unwind.rs
6+
tests/ui/resolve/derive-macro-1.rs
7+
tests/ui/resolve/derive-macro-2.rs
8+
tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-pretty.rs
9+
tests/ui/rfcs/rfc-2565-param-attrs/issue-64682-dropping-first-attrs-in-impl-fns.rs
10+
tests/ui/rfcs/rfc-3348-c-string-literals/edition-spans.rs
11+
tests/ui/rust-2018/suggestions-not-always-applicable.rs
12+
tests/ui/rust-2021/reserved-prefixes-via-macro.rs
13+
tests/ui/underscore-imports/duplicate.rs
14+
tests/ui/async-await/issues/issue-60674.rs
15+
tests/ui/attributes/main-removed-2/main.rs
16+
tests/ui/cfg/assume-incomplete-release/assume-incomplete.rs
17+
tests/ui/crate-loading/cross-compiled-proc-macro.rs
18+
tests/ui/derives/derive-marker-tricky.rs
19+
tests/ui/diagnostic_namespace/existing_proc_macros.rs
20+
tests/ui/fmt/format-args-capture-issue-106408.rs
21+
tests/ui/fmt/indoc-issue-106408.rs
22+
tests/ui/hygiene/issue-77523-def-site-async-await.rs
23+
tests/ui/inherent-impls-overlap-check/no-overlap.rs

failing-non-lto-tests.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests/ui/issues/issue-44056.rs
2+
tests/ui/lto/fat-lto.rs
3+
tests/ui/lto/debuginfo-lto.rs
4+
tests/ui/lto/lto-many-codegen-units.rs
5+
tests/ui/lto/issue-100772.rs
6+
tests/ui/lto/lto-rustc-loads-linker-plugin.rs
7+
tests/ui/panic-runtime/lto-unwind.rs
8+
tests/ui/sanitize/issue-111184-generator-witness.rs
9+
tests/ui/sepcomp/sepcomp-lib-lto.rs

test.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ function clean() {
151151

152152
function mini_tests() {
153153
echo "[BUILD] mini_core"
154-
GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu $RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
154+
#GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu
155+
$RUSTC example/mini_core.rs --crate-name mini_core --crate-type lib,dylib --target $TARGET_TRIPLE
155156

156157
echo "[BUILD] example"
157158
$RUSTC example/example.rs --crate-type lib --target $TARGET_TRIPLE
@@ -174,7 +175,7 @@ function std_tests() {
174175
echo "[AOT] alloc_system"
175176
$RUSTC example/alloc_system.rs --crate-type lib --target "$TARGET_TRIPLE"
176177

177-
# FIXME: it seems gcc will run lto1 unless -fno-lto is added.
178+
# FIXME(antoyo): it seems gcc will run lto1 unless -fno-lto is added.
178179
echo "[AOT] alloc_example"
179180
# TODO: -Clink-arg=-lgcc_s
180181
# TODO: -Cdefault-linker-libraries also fixes the issue.
@@ -396,8 +397,8 @@ function test_rustc() {
396397
fi
397398

398399
echo "[TEST] rustc test suite"
399-
ls ../gcc-build/build/gcc
400-
LIBRARY_PATH=$(pwd)/../gcc-build/build/gcc GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu COMPILETEST_FORCE_STAGE0=1 strace -f ./x.py test --run always --stage 0 tests/ui/ --rustc-args "$RUSTC_ARGS"
400+
#LIBRARY_PATH=$(pwd)/../gcc-build/build/gcc GCC_EXEC_PREFIX=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu
401+
COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 tests/ui/ --rustc-args "$RUSTC_ARGS"
401402
}
402403

403404
function test_failing_rustc() {

0 commit comments

Comments
 (0)