omniosorg / omnios-extra

Packages for OmniOS extra
https://omnios.org
Other
26 stars 58 forks source link

151046 clang-16 package missing gcc dependency #1352

Closed rmustacc closed 1 year ago

rmustacc commented 1 year ago

I have a system based on 151046 (heliosv2) and was trying to install the clang package to test something. After installation a basic C and C++ program failed to build in similar ways with:

rm@beowulf:~$ clang++ -std=c++11 tst.cpp 
ld: fatal: file crtbegin.o: open failed: No such file or directory
ld: fatal: library -lgcc: not found
ld: fatal: file crtend.o: open failed: No such file or directory
ld: fatal: file processing errors. No output written to a.out
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
rm@beowulf:~$ clang test.c 
ld: fatal: file crtbegin.o: open failed: No such file or directory
ld: fatal: library -lgcc: not found
ld: fatal: file crtend.o: open failed: No such file or directory
ld: fatal: file processing errors. No output written to a.out
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
rm@beowulf:~$ clang -v test.c 
Helios/2 clang version 16.0.6 (github:oxidecomputer/helios 3a05cb311d32d2d7f83f292cf3d02b229ee1d18a)
Target: x86_64-pc-solaris2.11
Thread model: posix
InstalledDir: /opt/ooce/bin
 "/opt/ooce/llvm-16/bin/clang-16" -cc1 -triple x86_64-pc-solaris2.11 -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/rm -resource-dir /opt/ooce/llvm-16/lib/clang/16 -internal-isystem /opt/ooce/llvm-16/lib/clang/16/include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/rm -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/tmp/test-109bdc.o -x c test.c
clang -cc1 version 16.0.6 based upon LLVM 16.0.6 default target x86_64-pc-solaris2.11
#include "..." search starts here:
#include <...> search starts here:
 /opt/ooce/llvm-16/lib/clang/16/include
 /usr/include
End of search list.
 "/usr/bin/ld" -C -e _start -Bdynamic -o a.out /usr/lib/amd64/crt1.o /usr/lib/amd64/crti.o /usr/lib/amd64/values-Xa.o /usr/lib/amd64/values-xpg6.o crtbegin.o -L/opt/ooce/llvm-16/bin/../lib -L/usr/lib/amd64 /var/tmp/test-109bdc.o -lc -lgcc crtend.o /usr/lib/amd64/crtn.o
ld: fatal: file crtbegin.o: open failed: No such file or directory
ld: fatal: library -lgcc: not found
ld: fatal: file crtend.o: open failed: No such file or directory
ld: fatal: file processing errors. No output written to a.out
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

I received a hint to install the gcc-12 package from @citrus-it which did fix it. I suspect this clang package (and possibly others) are missing a dependency upon which to get the gcc crt and standard library files.

hadfl commented 1 year ago

Yes, software built with clang require the gcc runtime library objects at build-time since we don't ship/use the clang specific compiler-rt libraries. I'll take care of this. Thank you very much for the report