Open satmandu opened 1 year ago
This is the cmake error log:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/local/bin/clang++
Build flags:
Id flags:
The output was:
1
/usr/local/bin/ld: error: cannot open Scrt1.o: No such file or directory
/usr/local/bin/ld: error: cannot open crti.o: No such file or directory
/usr/local/bin/ld: error: cannot open crtn.o: No such file or directory
/usr/local/bin/ld: error: cannot open /usr/lib/libc_nonshared.a: No such file or directory
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: /usr/local/tmp/crew/openmp.20221006150538.dir/openmp-15.0.2.src/builddir/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/local/bin/ninja cmTC_a1857 && [1/2] Building C object CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o
clang version 15.0.1 (https://github.com/llvm/llvm-project.git b73d2c8c720a8c8e6e73b11be4e27afa6cb75bdf)
Target: i686-cros-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12
Selected GCC installation: /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12
Candidate multilib: .;@m32
Selected multilib: .;@m32
(in-process)
"/usr/local/bin/clang-15" -cc1 -triple i686-cros-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu i686 -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/usr/local/tmp/crew/openmp.20221006150538.dir/openmp-15.0.2.src/builddir/CMakeFiles/CMakeTmp -resource-dir /usr/local/lib/clang/15.0.1 -dependency-file CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o.d -MT CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o -sys-header-deps -internal-isystem /usr/local/lib/clang/15.0.1/include -internal-isystem /usr/local/include -internal-isystem /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12/../../../../i686-cros-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/usr/local/tmp/crew/openmp.20221006150538.dir/openmp-15.0.2.src/builddir/CMakeFiles/CMakeTmp -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o -x c /usr/local/share/cmake-3.24/Modules/CMakeCCompilerABI.c
clang -cc1 version 15.0.1 based upon LLVM 15.0.1 default target i686-cros-linux-gnu
ignoring nonexistent directory "/usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12/../../../../i686-cros-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/clang/15.0.1/include
/usr/local/include
/usr/include
End of search list.
[2/2] Linking C executable cmTC_a1857
FAILED: cmTC_a1857
: && /usr/local/bin/clang --target=i686-cros-linux-gnu -march=i686 -v CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o -o cmTC_a1857 && :
clang version 15.0.1 (https://github.com/llvm/llvm-project.git b73d2c8c720a8c8e6e73b11be4e27afa6cb75bdf)
Target: i686-cros-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12
Selected GCC installation: /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12
Candidate multilib: .;@m32
Selected multilib: .;@m32
"/usr/local/bin/ld" -pie --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o cmTC_a1857 Scrt1.o crti.o /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12/crtbeginS.o -L/usr/local/bin/../lib/i686-cros-linux-gnu -L/usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12 -L/lib -L/usr/lib CMakeFiles/cmTC_a1857.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/bin/../lib/gcc/i686-cros-linux-gnu/12/crtendS.o crtn.o
/usr/local/bin/ld: error: cannot open Scrt1.o: No such file or directory
/usr/local/bin/ld: error: cannot open crti.o: No such file or directory
/usr/local/bin/ld: error: cannot open crtn.o: No such file or directory
/usr/local/bin/ld: error: cannot open /usr/lib/libc_nonshared.a: No such file or directory
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Determining if the C compiler works failed with the following output:
Change Dir: /usr/local/tmp/crew/openmp.20221006150538.dir/openmp-15.0.2.src/builddir/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/local/bin/ninja cmTC_8ac88 && [1/2] Building C object CMakeFiles/cmTC_8ac88.dir/testCCompiler.c.o
[2/2] Linking C executable cmTC_8ac88
FAILED: cmTC_8ac88
: && /usr/local/bin/clang --target=i686-cros-linux-gnu -march=i686 CMakeFiles/cmTC_8ac88.dir/testCCompiler.c.o -o cmTC_8ac88 && :
/usr/local/bin/ld: error: cannot open Scrt1.o: No such file or directory
/usr/local/bin/ld: error: cannot open crti.o: No such file or directory
/usr/local/bin/ld: error: cannot open crtn.o: No such file or directory
/usr/local/bin/ld: error: cannot open /usr/lib/libc_nonshared.a: No such file or directory
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
@llvm/issue-subscribers-clang-driver
Looks like this issue cropped up a while ago on ubuntu? https://bugs.launchpad.net/ubuntu/+source/clang/+bug/792146
I've had this problem, too. I added 2 lines of code as you said, but it didn't work. Lines 317 and 318
308 Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
309
310 // The deprecated -DLLVM_ENABLE_PROJECTS=libcxx configuration installs
311 // libc++.so in D.Dir+"/../lib/". Detect this path.
312 // TODO Remove once LLVM_ENABLE_PROJECTS=libcxx is unsupported.
313 if (StringRef(D.Dir).startswith(SysRoot) &&
314 D.getVFS().exists(D.Dir + "/../lib/libc++.so"))
315 addPathIfExists(D, D.Dir + "/../lib", Paths);
316
317 addPathIfExists(D, concat(SysRoot, "/usr/local/lib"), Paths);
318 addPathIfExists(D, concat(SysRoot, "/usr/lib64"), Paths);
319 addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
320 addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
The version of llvm is also 15.0.4.
FAILED: contrib/protobuf-cmake/protoc
: &&
/usr1/ckbuild/ck-llvm-15.0.4-new/bin/clang++ --target=x86_64-linux-gnu --sysroot=/usr1/github-22.8.11.15/ClickHouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -fPIE -pie -s --gcc-toolchain=/usr1/github-22.8.11.15/ClickHouse/cmake/linux/../../contrib/sysroot/linux-x86_64 -std=c++20 -fdiagnostics-color=always -Xclang -fuse-ctor-homing -fsized-deallocation -gdwarf-aranges -pipe -mssse3 -msse4.1 -msse4.2 -mpclmul -mpopcnt -fasynchronous-unwind-tables -ffile-prefix-map=/usr1/github-22.8.11.15/ClickHouse=. -falign-functions=32 -mbranches-within-32B-boundaries -fdiagnostics-absolute-paths -fstrict-vtable-pointers -fexperimental-new-pass-manager -w -O2 -g -DNDEBUG -O3 -g -gdwarf-4 -Wno-unused-but-set-variable -Wno-reserved-identifier -Wno-deprecated-copy -Wno-unused-command-line-argument -Wno-unused-function --gcc-toolchain=/usr1/github-22.8.11.15/ClickHouse/cmake/linux/../../contrib/sysroot/linux-x86_64 --ld-path=/usr1/ckbuild/ck-llvm-15.0.4-new/bin/ld.lld -rdynamic -Wl,--gdb-index -Wl,--build-id=sha1 -Xlinker --no-undefined contrib/protobuf-cmake/CMakeFiles/protoc.dir/__/protobuf/src/google/protobuf/compiler/main.cc.o -o contrib/protobuf-cmake/protoc contrib/protobuf-cmake/lib_libprotoc.a contrib/protobuf-cmake/lib_libprotobuf.a -lpthread contrib/zlib-ng-cmake/lib_zlib.a -Wl,--start-group base/glibc-compatibility/libglibc-compatibility.a base/glibc-compatibility/memcpy/libmemcpy.a contrib/libcxx-cmake/libcxx.a contrib/libcxxabi-cmake/libcxxabi.a contrib/libunwind-cmake/libunwind.a -Wl,--end-group -nodefaultlibs /usr1/ckbuild/ck-llvm-15.0.4-new/lib/clang/15.0.4/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a -lc -lm -lrt -lpthread -ldl
&& :ld.lld: error: cannot open Scrt1.o: No such file or directory
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
[3326/9873] Building CXX object contrib/grpc/CMakeFiles/grpc.dir/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc.o
ninja: build stopped: subcommand failed.
+++ CheckCommand package
and The Scrt1.o file is stored in /usr/lib64.
@satmandu can you help me?
I'd note that you have a sysroot=/usr1/github-22.8.11.15/ClickHouse/cmake/linux/../../contrib/sysroot/linux-x86_64/x86_64-linux-gnu/libc
in your command line... and so I think using addPathIfExists(D, concat(SysRoot, "/usr/lib64"), Paths);
will add that PLUS /usr/lib64
to Paths
since it is concatenating the strings.
You probably want to avoid concatenating SysRoot to /usr/lib64
when adding to Paths
...
(I've been able to use my patch in Chromebrew on i686 in llvm 16.0.1 too.)
i.e., do this:
addPathIfExists(D, "/usr/lib64", Paths);
Thank you for reminding me. I copied the Scrt1.o file from /usr/lib64 to the sysroot directory and it was fine. @satmandu I'm going to ask the ClickHouse community this question. Not sure if they missed the file.
Trying to build openmp 15.0.2 with clang 15.0.1, but this happens whenever clang built on i686 is used. This isn't an issue on x86_64 or armv7l.
The build succeeds with clang 14.0.6,.