reinh-bader / fgsl

Fortran interface to the GNU Scientific Library
https://doku.lrz.de/display/PUBLIC/FGSL+-+A+Fortran+interface+to+the+GNU+Scientific+Library
GNU General Public License v2.0
84 stars 23 forks source link

Usage of __FILE__ leads to truncated lines #36

Closed jsberg-bnl closed 6 months ago

jsberg-bnl commented 1 year ago

For some build scenarios, __FILE__ turns into a very long string, which then results in "Line truncated" error messages. While this can generally be worked around with the appropriate (compiler-dependent) compile flags, it would be better if __FILE__ were replaced with the corresponding hardcoded string so as to keep the build process simple.

reinh-bader commented 1 year ago

As far as the build process is concerned, the macro is automatically generated by autoconf. I do not see how this can be changed. Otherwise - can you supply a simple reproducer?

jsberg-bnl commented 1 year ago

I trip the bug with

/home/jsberg/Software/Bmad/bdl-build/fgsl-1.5.0/configure --prefix=/home/jsberg/Software/Bmad/packages-0 --disable-static

The key here is the full path to configure, which seems to cause it to generate long include paths on the compile line:

gfortran -DHAVE_CONFIG_H -I. -I/home/jsberg/Software/Bmad/bdl-build/fgsl-1.5.0  -I/home/jsberg/Software/Bmad/bdl-build/fgsl-1.5.0 -I.   -g -O2 -c -o fgsl.o /home/jsberg/Software/Bmad/bdl-build/fgsl-1.5.0/fgsl.F90

The __FILE__ macro is actually substituted with the full name of the included file by the C preprocessor (not autoconf), which is invoked due to the .F90 extension, and due to the full path to the included file, generates a long line.

This all happened because I had an automated build process that was building FGSL as a dependency to another package, and it chose to use the full path name for the configure command.

The simple fix would be replacing __FILE__ with the corresponding hardcoded filename (all occurrences are in the api directory, except for one in tests).

reinh-bader commented 6 months ago

The upcoming release 1.6.0 has the FILE removed. Closing the issue.