Rust-GCC / gccrs

GCC Front-End for Rust
https://rust-gcc.github.io/
GNU General Public License v2.0
2.38k stars 155 forks source link

Some torture tests fail on x86_64-apple-darwin20.1.0 #500

Closed thomasyonug closed 3 years ago

thomasyonug commented 3 years ago
                === rust Summary ===

# of expected passes            2398
# of unexpected failures        29
# of expected failures          8
# of unresolved testcases       28

Platform

macos big sur version 11.0.1

Code

Failures are from:

Meta

Error output

ative configuration is x86_64-apple-darwin20.1.0

                === rust tests ===

Schedule of variations:
    unix

Running target unix
Using /usr/local/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/local/share/dejagnu/config/unix.exp as generic interface file for target.
Using /Users/yangwenzhang/workspace/gsoc/gccrs/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /Users/yangwenzhang/workspace/gsoc/gccrs/gcc/testsuite/rust/compile/compile.exp ...
FAIL: rust/compile/allow_dead_code.rs (test for excess errors)
Running /Users/yangwenzhang/workspace/gsoc/gccrs/gcc/testsuite/rust/compile/torture/compile.exp ...
Running /Users/yangwenzhang/workspace/gsoc/gccrs/gcc/testsuite/rust/compile/xfail/xfail.exp ...
Running /Users/yangwenzhang/workspace/gsoc/gccrs/gcc/testsuite/rust/execute/torture/execute.exp ...
FAIL: rust/execute/torture/block_expr1.rs   -O0  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -O1  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -O2  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -O3 -g  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -Os  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: rust/execute/torture/block_expr1.rs   -O2 -flto  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O0  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O1  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O2  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O3 -g  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -Os  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: rust/execute/torture/empty_main.rs   -O2 -flto  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O0  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O1  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O2  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O3 -g  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -Os  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: rust/execute/torture/exit_error.rs   -O2 -flto  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O0  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O1  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O2  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O3 -g  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -Os  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O2 -flto -flto-partition=none  (test for excess errors)
FAIL: rust/execute/torture/func1.rs   -O2 -flto  (test for excess errors)

                === rust Summary ===

# of expected passes            2398
# of unexpected failures        29
# of expected failures          8
# of unresolved testcases       28
thomasyonug commented 3 years ago

Actually, I do not know what "ICE" means.

Can anyone tell me about that? I had google it but got nothing. :)

philberty commented 3 years ago

ICE means "internal compiler error" which could be a variety of reasons from crash or an assertion was hit.

It would be interesting to see what the errors are here, there should be a gccrs-build/gcc/testsuite/rust/rust.log to find more information.

philberty commented 3 years ago

I think we could spin a github automation for this for free.

philberty commented 3 years ago

Since they are all execute tests it could be some configuration thing.

thomasyonug commented 3 years ago

ICE means "internal compiler error" which could be a variety of reasons from crash or an assertion was hit.

It would be interesting to see what the errors are here, there should be a gccrs-build/gcc/testsuite/rust/rust.log to find more information.

Got it. Then this is not a ICE issue, LOL. Let me change the title.

thomasyonug commented 3 years ago

Thanks @philberty , I see the rust.log. It's my env issue about ld.

philberty commented 3 years ago

I think it still thinks it's valuable to keep this issue open until the issue is resolved. Was there a fix you were able to do?

thomasyonug commented 3 years ago

I'm trying to reconfigure the project for macos. It seems like I miss some flag about the library location. The root cause of all these errors is gccrs cannot find the libSystem.B.dylib.

Here is the verbose about gccrs ./xx.rs -B ./gcc/

Reading specs from ./gcc/specs
COLLECT_GCC=./gcc/gccrs
COLLECT_LTO_WRAPPER=./gcc/lto-wrapper
Target: x86_64-apple-darwin20.1.0
Configured with: ../gccrs/configure --prefix=/Users/yangwenzhang/gccrs-install --disable-bootstrap --disable-multilib --enable-languages=rust --with-native-system-header-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include : (reconfigured) ../gccrs/configure --prefix=/Users/yangwenzhang/gccrs-install --disable-bootstrap --enable-multilib --enable-languages=rust --with-native-system-header-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.1 20210325 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-B' './gcc' '-v' '-mmacosx-version-min=11.0.0' '-asm_macosx_version_min=11.0' '-shared-libgcc' '-mtune=core2' '-dumpdir' 'a-'
 ./gcc/rust1 ../gccrs/gcc/testsuite/rust/execute/torture/block_expr1.rs -fPIC -quiet -dumpdir a- -dumpbase block_expr1.rs -dumpbase-ext .rs -mmacosx-version-min=11.0.0 -mtune=core2 -version -L./gcc -o /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccwx78jP.s
GNU Rust (GCC) version 11.0.1 20210325 (experimental) (x86_64-apple-darwin20.1.0)
        compiled by GNU C version Apple LLVM 12.0.5 (clang-1205.0.22.9), GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Rust (GCC) version 11.0.1 20210325 (experimental) (x86_64-apple-darwin20.1.0)
        compiled by GNU C version Apple LLVM 12.0.5 (clang-1205.0.22.9), GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-B' './gcc' '-v' '-mmacosx-version-min=11.0.0'  '-shared-libgcc' '-mtune=core2' '-dumpdir' 'a-'
 ./gcc/as -arch x86_64 -v -force_cpusubtype_ALL -mmacosx-version-min=11.0 -o /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccpHGSdi.o /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccwx78jP.s
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1as -triple x86_64-apple-macosx11.0.0 -filetype obj -main-file-name ccwx78jP.s -target-cpu penryn -fdebug-compilation-dir /Users/yangwenzhang/workspace/gsoc/macbuild -dwarf-debug-producer "Apple clang version 12.0.5 (clang-1205.0.22.9)" -dwarf-version=4 -mrelocation-model pic -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccpHGSdi.o /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccwx78jP.s
COMPILER_PATH=./gcc/
LIBRARY_PATH=./gcc/

COLLECT_GCC_OPTIONS='-B' './gcc' '-v' '-mmacosx-version-min=11.0.0'  '-shared-libgcc' '-mtune=core2' '-dumpdir' 'a.'
 ./gcc/collect2 -dynamic -arch x86_64 -macosx_version_min 11.0.0 -weak_reference_mismatches non-weak -o a.out -L./gcc /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccpHGSdi.o -lSystem -lgcc_ext.10.5 -lgcc -lSystem -no_compact_unwind -v

collect2 version 11.0.1 20210325 (experimental)
./gcc/collect-ld -dynamic -arch x86_64 -macosx_version_min 11.0.0 -weak_reference_mismatches non-weak -o a.out -L./gcc /var/folders/m_/hsfwlg911nx39msyyw0tyvcc0000gn/T//ccpHGSdi.o -lSystem -lgcc_ext.10.5 -lgcc -lSystem -no_compact_unwind -v
@(#)PROGRAM:ld  PROJECT:ld64-650.9
BUILD 00:19:30 Mar 17 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
        ./gcc
        /usr/lib
        /usr/local/lib
Framework search paths:
        /Library/Frameworks/
        /System/Library/Frameworks/
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
thomasyonug commented 3 years ago

I think I got it.

../gccrs/configure --prefix=$HOME/gccrs-install --disable-bootstrap --enable-multilib --enable-languages=rust --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Configure project with above command can solve this issue. Should we change the README with a mac version building command?

philberty commented 3 years ago

Nice detective work :D, yes please if you create a PR to update the README you can link against this issue the PR can close this issue at the same time.