Goddard-Fortran-Ecosystem / pFUnit

Parallel Fortran Unit Testing Framework
Other
173 stars 45 forks source link

Failure to build with gfortran 14.x? #466

Open d7919 opened 4 months ago

d7919 commented 4 months ago

I build pFUnit (v4.8.0) as part of a project's CI on gitlab and in attempting to update from Fedora 39 to Fedora 40, which updates gcc/gfortran from v13.x to v14.x I have started to encounter some failures.

Prior to Fedora 40's release this brought in gfortran v 14.0.1 and pFUnit would fail to build during fargparse with an internal compiler error (link to CI log)

[ 76%] Building Fortran object extern/fArgParse/src/CMakeFiles/fargparse.dir/ArgParser.F90.o
/builds/gyrokinetics/gs2/externals/pFUnit-v4.8.0/extern/fArgParse/src/ArgParser.F90:725:23:
  725 | end module fp_ArgParser
      |                       1
internal compiler error: Segmentation fault
Please submit a full bug report, with preprocessed source (by using -freport-bug).

With the release of Fedora 40 we now get gfortran v14.1.1 and the internal compiler error has gone away but I now get a problem when trying to link project's tests into the pfunit_test_suite (link to CI log) :

Compiling   : pFUnit tests  
/usr/bin/ld: /builds/gyrokinetics/gs2/cache/pfunit/PFUNIT-4.8/lib/libfunit.a(FUnit.F90.o): in function `__funit_MOD_generic_run':
/builds/gyrokinetics/gs2/externals/pFUnit-v4.8.0/src/funit/FUnit.F90:119:(.text+0x5367): undefined reference to `__gftl1_stringunlimitedmap_MOD___vtab__STAR'
collect2: error: ld returned 1 exit status
make: *** [/builds/gyrokinetics/gs2/tests/pfunit_tests/Makefile:111: pfunit_test_suite] Error 1

Given that the exact same setup works with a Fedora 39 image it seems likely that it is something to do with the change in system library / tool versions which is leading to the issue.

I note that pFUnit's github actions do not test with gfortran 14 yet.

I will attempt to diagnose the source of the issue and report back here if I find anything, but I thought I should flag this now in case this is something which necessitates a common workaround.

d7919 commented 4 months ago

A more verbose attempt at building is at CI log which shows the actual command which fails. Note this includes

-L/builds/gyrokinetics/gs2/cache/pfunit/PFUNIT-4.8/lib -lpfunit -lfunit -L/builds/gyrokinetics/gs2/cache/pfunit/FARGPARSE-1.6/lib -lfargparse -L/builds/gyrokinetics/gs2/cache/pfunit/GFTL_SHARED-1.7/lib -lgftl-shared-v2

where

-L/builds/gyrokinetics/gs2/cache/pfunit/FARGPARSE-1.6/lib -lfargparse -L/builds/gyrokinetics/gs2/cache/pfunit/GFTL_SHARED-1.7/lib -lgftl-shared-v2

comes from FARGPARSE_LIBRARIES provided by

include $(PFUNIT_DIR)/PFUNIT-${PFUNIT_VERSION_MAJOR}.${PFUNIT_VERSION_MINOR}/include/PFUNIT.mk

in my code's makefile. Note here we have -lgftl-shared-v2 whilst the undefined reference refers to __gftl1_stringunlimitedmap_MOD___vtab__STAR, which seems to suggest gftl v1 is needed?

d7919 commented 4 months ago

I can confirm that adding -lgftl-shared-v1 to the end of FARGPARSE_LIBRARIES allows my CI build to complete, CI log

d7919 commented 4 months ago

Possibly related to https://github.com/Goddard-Fortran-Ecosystem/pFUnit/issues/463?

tclune commented 3 months ago

I agree. Probably related to #463. Hopefully that merge goes through in the next couple of days and I'll get a new release out.