-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
Problem
With a freshly-compiled libgccjit.so
and following the instructions in the Building section of the README.md, my rustc
gets stuck at building the sysroot
with the following error (invoked with cargo build -v
):
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$ ./test.sh --release
Finished release [optimized] target(s) in 0.03s
[BUILD] mini_core
[BUILD] example
[AOT] mini_core_hello_world
./target/out/mini_core_hello_world
abc
bcd
Hello printf
Hello
World!
abc
Boxed outer got dropped!
Inner got dropped!
Inner got dropped!
Inner got dropped!
TLS works!
[BUILD] sysroot
Updating crates.io index
Compiling core v0.0.0 (/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot_src/library/core)
Fresh cc v1.0.68
Fresh autocfg v1.0.1
Compiling compiler_builtins v0.1.45
Running `rustc --crate-name core --edition=2018 sysroot_src/library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e063c7bddda6fe07 -C extra-filename=-e063c7bddda6fe07 --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort`
Compiling libc v0.2.97
Running `/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/build/compiler_builtins-2759047e8e5760ee/build-script-build`
Running `/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/build/libc-7e3dc487b4357978/build-script-build`
Compiling unwind v0.0.0 (/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot_src/library/unwind)
Compiling miniz_oxide v0.4.4
Compiling std v0.0.0 (/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot_src/library/std)
Running `/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/build/unwind-610dfb8f39c4878a/build-script-build`
Running `/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/build/miniz_oxide-713c8c4c6d9b1cdb/build-script-build`
Running `/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/build/std-1e5d80d9271fccf3/build-script-build`
Compiling rustc-std-workspace-core v1.99.0 (/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot_src/library/rustc-std-workspace-core)
Running `rustc --crate-name rustc_std_workspace_core --edition=2018 sysroot_src/library/rustc-std-workspace-core/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=59ed975568390d45 -C extra-filename=-59ed975568390d45 --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps --extern core=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/libcore-e063c7bddda6fe07.rmeta -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort`
Running `rustc --crate-name compiler_builtins /home/william/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.45/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=17b0aa9941b1c5cf -C extra-filename=-17b0aa9941b1c5cf --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps --extern core=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_core-59ed975568390d45.rmeta --cap-lints allow -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort --cfg 'feature="unstable"'`
libgccjit.so: error: type mismatch in binary expression
unsigned long
signed int
signed int
_21 = _16 & _20;
libgccjit.so: error: type mismatch in binary expression
unsigned long
signed int
unsigned long
_22 = _13 + _21;
libgccjit.so: error: ‘verify_gimple’ failed
0x7f9a3eadceb4 verify_gimple_in_seq(gimple*)
../../../gcc/gcc/tree-cfg.c:5161
0x7f9a3e7c2aa5 gimplify_body(tree_node*, bool)
../../../gcc/gcc/gimplify.c:15383
0x7f9a3e7c2c1c gimplify_function_tree(tree_node*)
../../../gcc/gcc/gimplify.c:15454
0x7f9a3e541e8e gcc::jit::playback::function::postprocess()
../../../gcc/gcc/jit/jit-playback.c:1727
0x7f9a3e542b5e gcc::jit::playback::context::replay()
../../../gcc/gcc/jit/jit-playback.c:3063
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
error: could not compile `compiler_builtins`
Caused by:
process didn't exit successfully: `rustc --crate-name compiler_builtins /home/william/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.45/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=17b0aa9941b1c5cf -C extra-filename=-17b0aa9941b1c5cf --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps --extern core=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_core-59ed975568390d45.rmeta --cap-lints allow -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort --cfg 'feature="unstable"'` (exit status: 4)
warning: build failed, waiting for other jobs to finish...
libgccjit.so: error: type mismatch in binary expression
unsigned long
signed int
signed int
_34 = _28 & _33;
libgccjit.so: error: type mismatch in binary expression
unsigned long
signed int
unsigned long
_35 = _24 + _34;
libgccjit.so: error: ‘verify_gimple’ failed
0x7f646f068eb4 verify_gimple_in_seq(gimple*)
../../../gcc/gcc/tree-cfg.c:5161
0x7f646ed4eaa5 gimplify_body(tree_node*, bool)
../../../gcc/gcc/gimplify.c:15383
0x7f646ed4ec1c gimplify_function_tree(tree_node*)
../../../gcc/gcc/gimplify.c:15454
0x7f646eacde8e gcc::jit::playback::function::postprocess()
../../../gcc/gcc/jit/jit-playback.c:1727
0x7f646eaceb5e gcc::jit::playback::context::replay()
../../../gcc/gcc/jit/jit-playback.c:3063
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
error: build failed
real 0m11.133s
user 0m12.593s
sys 0m0.514s
Debugger Info
Unfortunately, running gdb
doesn't give me any useful information; loc
is a NULL
pointer by the time we reach add_error
:
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$ LD_LIBRARY_PATH=$(cat gcc_path) gdb --args rustc --crate-name compiler_builtins /home/william/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.45/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=17b0aa9941b1c5cf -C extra-filename=-17b0aa9941b1c5cf --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps --extern core=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_core-59ed975568390d45.rmeta --cap-lints allow -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort --cfg 'feature="unstable"'
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from rustc...
(gdb) b add_error
Function "add_error" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (add_error) pending.
(gdb) c
The program is not being run.
(gdb) r
Starting program: /home/william/.cargo/bin/rustc --crate-name compiler_builtins /home/william/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.45/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg feature=\"compiler-builtins\" --cfg feature=\"core\" --cfg feature=\"default\" --cfg feature=\"rustc-dep-of-std\" -C metadata=17b0aa9941b1c5cf -C extra-filename=-17b0aa9941b1c5cf --out-dir /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/debug/deps --extern core=/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/librustc_std_workspace_core-59ed975568390d45.rmeta --cap-lints allow -Cpanic=abort -Cdebuginfo=2 -Zpanic-abort-tests -Zcodegen-backend=/home/william/Projects/toolchains/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so --sysroot /home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/sysroot -Z force-unstable-if-unmarked -Cpanic=abort --cfg feature=\"unstable\"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 517958 is executing new program: /home/william/.rustup/toolchains/nightly-2021-06-14-x86_64-unknown-linux-gnu/bin/rustc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffee3ff700 (LWP 517962)]
{"artifact":"/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/compiler_builtins-17b0aa9941b1c5cf.d","emit":"dep-info"}
{"artifact":"/home/william/Projects/toolchains/rustc_codegen_gcc/build_sysroot/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-17b0aa9941b1c5cf.rmeta","emit":"metadata"}
[New Thread 0x7fffe678a700 (LWP 517963)]
[New Thread 0x7fffe6589700 (LWP 517964)]
[New Thread 0x7fffe59ff700 (LWP 517965)]
[New Thread 0x7fffe4a8f700 (LWP 517966)]
[New Thread 0x7fffe3fff700 (LWP 517967)]
[New Thread 0x7fffe37ff700 (LWP 517968)]
[New Thread 0x7fffe25ff700 (LWP 517969)]
[New Thread 0x7fffe1dff700 (LWP 517970)]
[New Thread 0x7fffe15ff700 (LWP 517971)]
[New Thread 0x7fffe0b7f700 (LWP 517972)]
[New Thread 0x7fffe03ff700 (LWP 517973)]
[New Thread 0x7fffdfbff700 (LWP 517974)]
[New Thread 0x7fffdf3ff700 (LWP 517975)]
[New Thread 0x7fffdebff700 (LWP 517976)]
[New Thread 0x7fffde1ff700 (LWP 517977)]
[New Thread 0x7fffdd9ff700 (LWP 517978)]
[New Thread 0x7fffdd1ff700 (LWP 517979)]
[New Thread 0x7fffdc9ff700 (LWP 517980)]
[Detaching after vfork from child process 517981]
[Thread 0x7fffe59ff700 (LWP 517965) exited]
[Detaching after vfork from child process 517982]
[Thread 0x7fffe4a8f700 (LWP 517966) exited]
--Type <RET> for more, q to quit, c to continue without paging--
[Switching to Thread 0x7fffe3fff700 (LWP 517967)]
Thread 7 "opt compiler_bu" hit Breakpoint 1, gcc::jit::recording::context::add_error (
this=0x7fffe8886300, loc=0x0, fmt=fmt@entry=0x7fffecbf822d "%s")
at ../../../gcc/gcc/jit/jit-recording.c:1457
1457 {
(gdb) p loc->m_line
Cannot access memory at address 0x28
(gdb) p loc
$1 = (gcc::jit::recording::location *) 0x0
(gdb) p loc->m_line
Cannot access memory at address 0x28
(gdb)
I am unsure how to proceed, so opening this issue to see whether I found an actual bug, or I'm doing something wrong.
Additional Info
One thing I noticed... despite me passing --release
to test.sh
, the cargo
command actually invoked in build_sysroot.sh
is the debug invocation (I have added -v
):
sysroot_channel='debug'
cargo build -v --target $TARGET_TRIPLE
System Information
OS:
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$ uname -a
Linux xubuntu-dtrain 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
GCC version:
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$
libgccjit
configure
invocation:
../../gcc/configure --prefix=/usr --enable-languages=jit,c++ --disable-multilib --disable-bootstrap --enable-host-shared --enable-checking=release
gcc-path
contents:
/home/william/Projects/toolchains/build-gcc-toolchain/destdir-libgccjit/usr/lib
rustc
version (matches expected):
william@xubuntu-dtrain:~/Projects/toolchains/rustc_codegen_gcc$ rustc -V
rustc 1.55.0-nightly (f586d79d1 2021-06-13)
Metadata
Metadata
Assignees
Labels
No labels