swift-riscv / swift-riscv64

Building swift for riscv64 platforms
Apache License 2.0
18 stars 1 forks source link

CMake Error - /usr/bin/ld: cannot find Scrt1.o: No such file or directory #3

Open futurejones opened 1 year ago

futurejones commented 1 year ago

Build Failure:- https://ci.swiftlang.xyz/job/swift-5.8-ubuntu-jammy-riscv64/4/console

OS = Ubuntu Release = 22.04 / Jammy Swift Branch = release/5.8

[4330/4710][ 91%][5755.989s] Performing configure step for 'compiler-rt'
-- The C compiler identification is Clang 13.0.0
-- The CXX compiler identification is Clang 13.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/build-user/build/buildbot_linux/llvm-linux-riscv64/./bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/build-user/build/buildbot_linux/llvm-linux-riscv64/./bin/clang
-- Check for working C compiler: /home/build-user/build/buildbot_linux/llvm-linux-riscv64/./bin/clang - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/home/build-user/build/buildbot_linux/llvm-linux-riscv64/./bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/build-user/build/buildbot_linux/llvm-linux-riscv64/tools/clang/runtime/compiler-rt-bins/CMakeFiles/CMakeTmp

    Run Build Command(s):/home/build-user/build/buildbot_linux/ninja-build/ninja cmTC_dd942 && [1/2][ 50%][0.898s] Building C object CMakeFiles/cmTC_dd942.dir/testCCompiler.c.o
    [2/2][100%][1.359s] Linking C executable cmTC_dd942
    FAILED: cmTC_dd942 
    : && /home/build-user/build/buildbot_linux/llvm-linux-riscv64/./bin/clang   CMakeFiles/cmTC_dd942.dir/testCCompiler.c.o -o cmTC_dd942  -latomic && :
    /usr/bin/ld: cannot find Scrt1.o: No such file or directory
    clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
futurejones commented 1 year ago

error.log

finagolfin commented 12 months ago

It is trying to build compiler-rt with the freshly-built Swift-forked clang and failing to link a simple C executable. I suggest you try to run that failing clang command manually with the verbose flag -v and see where it is looking for the C runtime and why it fails. You may need to patch the Swift-forked clang to add some system directory that the Ubuntu clang already knows about.