URL: <https://savannah.gnu.org/support/?111172>
Summary: AC_FC/F77_LIBRARY_LDFLAGS incorrectly picks up flags from 'llc' Group: Autoconf Submitter: None Submitted: Thu 16 Jan 2025 12:31:49 PM UTC Priority: 5 - Unprioritized Severity: 3 - Normal Status: None Privacy: Public Assigned to: None Originator Email: j.reu...@fz-juelich.de Open/Closed: Open Discussion Lock: Any Operating System: GNU/Linux _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Thu 16 Jan 2025 12:31:49 PM UTC By: Anonymous We recently ran into issues building Score-P (and other software like netCDF) on an aarch64 system using GH200 system when building a compiler toolchain based on NVHPC 24.9. Generally, software using `autoconf`, and Fortran + C/C++ might be affected. The issue boils down to a specific `autoconf` check (`checking for Fortran libraries of [...]`, see [_AC_FC_LIBRARY_LDFLAGS](https://github.com/autotools-mirror/autoconf/blob/1f38316f6af7bf63e5e7dd187ff6456e07ad743e/lib/autoconf/fortran.m4#L636)). On `aarch64`, NVHPC may pass the option `-lsr-complexity-limit=131072` to `llc`. This flag is incorrectly picked up by `autoconf` and treated as a linker flag for all further checks, causing them to fail with `[...]/ld: cannot find -lsr-complexity-limit=131072: No such file or directory`. Configure will then very likely abort soon after, e.g. with `configure: error: linking to Fortran libraries from C fails`. In Score-P, we plan to add the following to one of our `.m4` files, right after the Fortran check picking up this flag: ``` AC_F77_LIBRARY_LDFLAGS + # Remove -lsr-complexity-limit=<some-number> from FLIBS, as it is + # not an actual linker flag, but a flag passed to 'llc'. This flag + # was observed in the FLIBS variable when using the NVHPC compiler + # on aarch64 systems. + FLIBS=`echo ${FLIBS} | sed -e 's/-lsr-complexity-limit=[[0-9]]* //g' -e 's/-lsr-complexity-limit=[[0-9]]*$//g'` ``` with a similar substitution for `FCFLAGS`. This issue might also show up with other compilers, as `llc` is a LLVM tool. I haven't explicitly checked this. The issue can be easily reproduced with this snippet, checked with Autoconf 2.72: ``` AC_PREREQ([2.69]) AC_INIT([autotools-playground], [0.0]) AC_CONFIG_AUX_DIR([build-config]) AC_CONFIG_MACRO_DIRS([build-config/m4]) AM_INIT_AUTOMAKE([1.13.4 -Wall foreign tar-pax]) AM_SILENT_RULES([yes]) AC_PROG_CC AC_PROG_F77 LT_PREREQ([2.4.6]) LT_INIT AC_SUBST([LIBTOOL_DEPS]) AC_F77_LIBRARY_LDFLAGS AC_F77_DUMMY_MAIN([], [], [77])]) AC_F77_WRAPPERS AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ``` The snippet + output is attached. _______________________________________________________ File Attachments: ------------------------------------------------------- Name: reproducer.zip Size: 1MiB <https://file.savannah.gnu.org/file/reproducer.zip?file_id=56775> AGPL NOTICE These attachments are served by Savane. You can download the corresponding source code of Savane at https://savannah.gnu.org/source/savane-04e1be7c5875649835636cff39891da2b16ab95a.tar.gz _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/support/?111172> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature