pymake icon indicating copy to clipboard operation
pymake copied to clipboard

gfortran linker - should probably default to "static" option for non-win32

Open ForsteriteFoe opened this issue 8 years ago • 3 comments

The following code in pymake.py (starting at line 373):

    # syslibs
    syslibs = []
    if sys.platform != 'win32':
        syslibs.append('-lc')

Should probably default to:

    syslibs = []
    if sys.platform != 'win32':
        syslibs.append('-static')
        syslibs.append('-lc')

The difference is that without the -static option, the resulting executable does not bundle the "c library", rather it links to where it is installed on the system.

Without the static it means, that in order to run the executable, you have to install the gfortran development files. Which is fine, but adds a step that requires internet access if you are running a live USB version of Linux.

The difference in executable size between the linked (~2.5MB) and static (~5MB) is IMHO not worth it as a default.

ForsteriteFoe avatar May 04 '17 18:05 ForsteriteFoe

Oh yeah, forgot to mention, found out that currently the behavior of the linker with the -l library (-llibarary) and -static is not included in the gfortan documentation .

It is, however, posted in the gcc documentation https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options

ForsteriteFoe avatar May 04 '17 18:05 ForsteriteFoe

Thanks, we'll look into this. We've had problems doing static links with gfortran, so maybe this will clear it up for us. Appreciate the comment.

christianlangevin avatar May 04 '17 19:05 christianlangevin

You are welcome - figured this was the place to put this.

The other seemingly sparsely documented compiler issue that I ran into when compiling is that "list-defined output" means that the formatting is up to the compiler. The gfortran compiler puts all "list-defined output" on the same row, however the ifort compiler apparently puts a newline after every five elements. The result is that the .ftl files from MODFLOW runs are formatted significantly differently, however, this difference doesn't appear to be important for running MT3D-USGS.

ForsteriteFoe avatar May 04 '17 21:05 ForsteriteFoe