Subject: bug#17094: Libtool bug with PGI Fortran compiler on OS X

From: "Jeff Squyres (jsquyres)" <[email-masked]>
Date: Tue, 25 Mar 2014 14:43:54 +0000

Matt Thompson (CC'ed), an Open MPI user, posted to the Open MPI list recently stating that he was having trouble installing Open MPI with the PGI compiler on OS X (thread starting here: http://www.open-mpi.org/community/lists/users/2014/03/23888.php).

After some back and forth, we think we may have found a bug in Libtool.

I created a trivial autoconf/automake/libtool package for testing:

    https://github.com/jsquyres/pgi-autotool-bug

The project makes a trivial Fortran library comprised of two .f90 source files.  Here's contents of src/Makefile.am:

-----
lib_LTLIBRARIES = libfortran_stuff.la
libfortran_stuff_la_SOURCES = fortran_foo.f90 fortran_bar.f90
-----

I made two tarballs for Matt and had him try them both.  One tarball was made with the GNU Autotools tuple that we use to make Open MPI 1.7.x tarballs (AC 2.69, AM 1.12.2, LT 2.4.2, m4 1.4.16).  The other tarball was with the most recent Automake (1.14.1), just in case this was an AM issue.  Both tarballs exhibit the same behavior on his OS X machine with the PGI Fortran compiler.

The output from a build seems to indicate a problem with Libtool.  Let me show the problem by contrasting output from "make V=1" on my Linux/gfortran based system vs. Matt's OS X / PGI Fortran compiler system.

Here's (annotated) output from Linux/gfortran "make V=1":

-----
Making all in src
make[1]: Entering directory `/home/jsquyres/git/pgi-autotool-bug/src'

# Compile the fortran_foo.f90 file
/bin/sh ../libtool  --tag=FC   --mode=compile gfortran  -g -O2 -c -o fortran_foo.lo fortran_foo.f90
libtool: compile:  gfortran -g -O2 -c fortran_foo.f90  -fPIC -o .libs/fortran_foo.o

# Compile the fortran_bar.f90 file
/bin/sh ../libtool  --tag=FC   --mode=compile gfortran  -g -O2 -c -o fortran_bar.lo fortran_bar.f90
libtool: compile:  gfortran -g -O2 -c fortran_bar.f90  -fPIC -o .libs/fortran_bar.o

# Link the two into the libfortran_stuff.so library
/bin/sh ../libtool  --tag=FC   --mode=link gfortran  -g -O2   -o libfortran_stuff.la -rpath /usr/local/lib fortran_foo.lo fortran_bar.lo  
libtool: link: gfortran -shared  -fPIC  .libs/fortran_foo.o .libs/fortran_bar.o    -O2   -Wl,-soname -Wl,libfortran_stuff.so.0 -o .libs/libfortran_stuff.so.0.0.0

# Make some handy sym links
libtool: link: (cd ".libs" && rm -f "libfortran_stuff.so.0" && ln -s "libfortran_stuff.so.0.0.0" "libfortran_stuff.so.0")
libtool: link: (cd ".libs" && rm -f "libfortran_stuff.so" && ln -s "libfortran_stuff.so.0.0.0" "libfortran_stuff.so")
libtool: link: ( cd ".libs" && rm -f "libfortran_stuff.la" && ln -s "../libfortran_stuff.la" "libfortran_stuff.la" )
-----

And here's the (annotated) output from his OS X / PGI Fortran compiler system:

-----
Making install in src

# Compile the fortran_foo.f90 file
/bin/sh ../libtool  --tag=FC   --mode=compile pgfortran  -m64 -c -o fortran_foo.lo fortran_foo.f90
libtool: compile:  pgfortran -m64 -c fortran_foo.f90  -o .libs/fortran_foo.o

# Compile the fortran_bar.f90 file
/bin/sh ../libtool  --tag=FC   --mode=compile pgfortran  -m64 -c -o fortran_bar.lo fortran_bar.f90
libtool: compile:  pgfortran -m64 -c fortran_bar.f90  -o .libs/fortran_bar.o

# Link the two into the libfortran_stuff.so library
/bin/sh ../libtool  --tag=FC   --mode=link pgfortran  -m64  -m64 -o libfortran_stuff.la -rpath /Users/fortran/AutomakeBug/autobug14/lib fortran_foo.lo fortran_bar.lo  
******* NOTICE THAT THERE'S NO COMMAND HERE TO MAKE THE LIBRARY!

# Make some handy sym links
libtool: link: (cd ".libs" && rm -f "libfortran_stuff.dylib" && ln -s "libfortran_stuff.0.dylib" "libfortran_stuff.dylib")
libtool: link: ( cd ".libs" && rm -f "libfortran_stuff.la" && ln -s "../libfortran_stuff.la" "libfortran_stuff.la" )
-----

It looks like Libtool is somehow not issuing the link command to pgfortran to actually create the library.  The sym links are created, but they're presumably dangling.

I've attached the following for reference:

- PGI outputs: config.log, configure stdout, make V=1 install stdout
- gfortran outputs: ditto

-- 
Jeff Squyres
[email-masked]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/