Description of problem: Fortran/C interface detection is broken when LTO is enabled under gcc12, which is in rawhide. cmake-based packages using this interface are currently FTBFS in rawhide (e.g.: https://koschei.fedoraproject.org/package/flexiblas?collection=f36). How reproducible: $ cat << EOL > CMakeLists.txt PROJECT(F-C-MWE LANGUAGES C Fortran) include(FortranCInterface) FortranCInterface_HEADER(FCMangle.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_" SYMBOLS mysub mymod:my_sub) FortranCInterface_VERIFY() EOL $ mkdir -p build && cd build $ export FFLAGS='-flto' $ cmake .. Actual results (some lines suppressed for legibility): -- Detecting Fortran/C Interface - Failed to recognize symbols CMake Warning (dev) at /usr/share/cmake/Modules/FortranCInterface.cmake:309 (message): No FortranCInterface mangling known for mysub CMake Warning (dev) at /usr/share/cmake/Modules/FortranCInterface.cmake:295 (message): No FortranCInterface mangling known for mymod:my_sub -- Verifying Fortran/C Compiler Compatibility CMake Warning (dev) at /usr/share/cmake/Modules/FortranCInterface.cmake:309 (message): No FortranCInterface mangling known for VerifyFortran -- Verifying Fortran/C Compiler Compatibility - Failed CMake Error at /usr/share/cmake/Modules/FortranCInterface.cmake:391 (message): /usr/bin/ld: /tmp/cclMYidY.ltrans0.ltrans.o: in function `main': /usr/share/cmake/Modules/FortranCInterface/Verify/main.c:14: undefined reference to `VerifyFortran' collect2: error: ld returned 1 exit status Expected results: Detection succeeds.
Forwarded to upstream: https://gitlab.kitware.com/cmake/cmake/-/issues/23123 Proposed PR to fix: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6879 *** Update with temporary fix for Rawhide is on its way.
Fixed in https://src.fedoraproject.org/rpms/cmake/c/8ae403196d1414744515e925e22134ba723e2dbf.
FEDORA-2022-c4e3921010 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-c4e3921010
FEDORA-2022-c4e3921010 has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report.