Summary: | toolchain-funcs.eclass: tc-get-rtlib change causes failure to build sci-libs/lapack or other Fortran packages with Clang | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | jon R-B <jon.roadleybattin> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | llvm, mgorny, sam, sci |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=883451 https://bugs.gentoo.org/show_bug.cgi?id=908798 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | lapack build log |
Description
jon R-B
2022-11-16 23:28:24 UTC
Your interpretation seems flawed... When no --rtlib was specified anywhere in any way, then --rtlib=libgcc was always default, and it would require --unwindlib=libgcc, so the following error would always occur: > clang-15: error: --rtlib=libgcc requires --unwindlib=libgcc Your second output shows that Clang-specific options were passed to 'gfortran', which obviously cannot work: > x86_64-pc-linux-gnu-gfortran: error: unrecognized command-line option ‘-rtlib=compiler-rt’ Older versions of sys-devel/clang had USE flags such as "default-compiler-rt", "default-libcxx", "default-lld", and I suspect that your were relying on them. You probably had different LDFLAGS configuration at that time. All your current LDFLAGS settings (global, in "compiler-clang_noCompilerRT" and in "compiler-clang") are invalid for 'gfortran'. (Currently it is rather recommended to set --rtlib=... / --unwindlib=... / --stdlib=... through relevant "default-*" USE flags of sys-devel/clang-common, not in CFLAGS / CXXFLAGS / LDFLAGS.) If you want confirmation, you might attach build log of sci-libs/lapack-3.10.1 from 2022-09-10. Try removing -unwindlib from compiler-clang_noCompilerRT. Created attachment 833181 [details]
lapack build log
Thankyou for your replied. Those things were added while converting to > 99% clang and also before said defaults were available.
Stripping back just in case
-- Verifying Fortran/C Compiler Compatibility - Failed
CMake Error at /usr/share/cmake/Modules/FortranCInterface.cmake:400 (message):
The Fortran compiler:
/usr/bin/x86_64-pc-linux-gnu-gfortran
and the C compiler:
/usr/lib/llvm/15/bin/clang
failed to compile a simple test project using both languages. The output
was:
Change Dir: /var/tmp/portage/sci-libs/lapack-3.11/work/lapack-3.11_build/CMakeFiles/FortranCInterface/VerifyC
Run Build Command(s):/usr/bin/ninja VerifyFortranC && [1/7] Building Fortran preprocessed CMakeFiles/VerifyFortran.dir/VerifyFortran.f-pp.f
[2/7] Generating Fortran dyndep file CMakeFiles/VerifyFortran.dir/Fortran.dd
[3/7] Building C object CMakeFiles/VerifyFortranC.dir/VerifyC.c.o
[4/7] Building C object CMakeFiles/VerifyFortranC.dir/main.c.o
[5/7] Building Fortran object CMakeFiles/VerifyFortran.dir/VerifyFortran.f.o
[6/7] Linking Fortran static library libVerifyFortran.a
[7/7] Linking C executable VerifyFortranC
FAILED: VerifyFortranC
: && /usr/lib/llvm/15/bin/clang -O3 -pipe -march=x86-64-v3 -mtune=native -flto=thin -O3 -DNDEBUG -Wl,-O1 -Wl,--as-needed CMakeFiles/VerifyFortranC.dir/main.c.o CMakeFiles/VerifyFortranC.dir/VerifyC.c.o -o VerifyFortranC libVerifyFortran.a -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lgcc_s -lgcc && :
ld.lld: error: undefined symbol: VerifyFortran
>>> referenced by main.c
>>> lto.tmp:(main)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Call Stack (most recent call first):
CBLAS/CMakeLists.txt:9 (FortranCInterface_VERIFY)
########################
grep lapack /etc/portage/package.env
sci-libs/lapack compiler-clang
#################### ie clang with no lto
cat /etc/portage/env/compiler-clang
COMMON_FLAGS="-O3 -pipe -march=x86-64-v3 -mtune=native"# BASELINE
CFLAGS="${COMMON_FLAGS} "
CXXFLAGS="${COMMON_FLAGS}"
#== CLANG GLOBAL
CC="clang"
CXX="clang++"
AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"
#LDFLAGS="${LDFLAGS} -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
#LDFLAGS="${LDFLAGS} -Wl,-O2 -Wl,--as-needed"
lapack just installed as part of a emerge @world. Scipy is the next fortran package in the list commit a3ab8231602c8af892facac582b5770f3834c21f Author: Sam James <sam@gentoo.org> Date: Fri Aug 25 00:14:13 2023 +0100 sci-libs/lapack: use fortran-2.eclass Not strictly related to bug #908798 but noticed while looking at it. Bug: https://bugs.gentoo.org/908798 Signed-off-by: Sam James <sam@gentoo.org> commit 5e5c9d5c524871f5af260557dbd2962b8eec5087 Author: Sam James <sam@gentoo.org> Date: Fri Aug 25 00:13:08 2023 +0100 profiles/features/llvm: drop problematic LDFLAGS clang-common already handles setting these for us, and if we set it in profiles, then it gets passed down to gcc via clang for things like Fortran where clang is just acting as the driver. Closes: https://bugs.gentoo.org/908798 Signed-off-by: Sam James <sam@gentoo.org> |