aguinet / dragonffi

C Foreign Function Interface and JIT using Clang/LLVM
Apache License 2.0
548 stars 23 forks source link

crt1.o: ABI version 1 is not supported , on ppc64 #55

Closed advancedwebdeveloper closed 3 years ago

advancedwebdeveloper commented 3 years ago

Hello. Here is what I have on

$ uname -a Linux debian 5.9.0-1-powerpc64 #1 SMP Debian 5.9.1-1 (2020-10-17) ppc64 GNU/Linux

with

$ ld.lld --version LLD 11.0.1 (compatible with GNU linkers)

and

$ clang --version Debian clang version 11.0.1-+rc2-1 :

$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_FLAGS=' -fuse-ld=lld ' .. -G Ninja -- The C compiler identification is Clang 11.0.1 -- The CXX compiler identification is Clang 11.0.1 -- Detecting C compiler ABI info make: *** [Makefile:103: all] Error 2 -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - failed -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ - broken CMake Error at /usr/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message): The C++ compiler

"/usr/bin/clang++"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/oceanfish81/dragonffi/release/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/local/bin/ninja cmTC_45259 && [1/2] Building CXX object CMakeFiles/cmTC_45259.dir/testCXXCompiler.cxx.o
clang: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[2/2] Linking CXX executable cmTC_45259
FAILED: cmTC_45259
: && /usr/bin/clang++ -fuse-ld=lld  CMakeFiles/cmTC_45259.dir/testCXXCompiler.cxx.o -o cmTC_45259   && :
ld.lld: error: /usr/bin/../lib/gcc/powerpc64-linux-gnu/10/../../../powerpc64-linux-gnu/crt1.o: ABI version 1 is not supported
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
aguinet commented 3 years ago

This is because lld doesn't support big endian ELF for PPC (aka ABI 1). It only supports PPC ABI2 (aka little endian PPC). See https://github.com/llvm/llvm-project/blob/5b7aef6eb4b2930971029b984cb2360f7682e5a5/lld/ELF/Arch/PPC64.cpp#L628.

This is not a Dragonffi specific issie, but a C++ toolchain issue on your own. Please verifh you can actually build a C++ hello world binary for your target before opening such issues.