Repository: spack/spack

Issue:
Install fail on hdf5 linux-ubuntu14-x86_64/gcc-6.2.0

>   FCLD     libhdf5_fortran.la
> /usr/bin/ld: cannot find -l-L/nfs/software/linux-ubuntu_trusty_amd64/apps/packages/gcc/gcc-6.2.0/bin/../lib/gcc/x86_64-pc-linux-gnu/6.2.0
> collect2: error: ld returned 1 exit status

[spack-build.env.txt](https://github.com/LLNL/spack/files/650822/spack-build.env.txt)


[spack-build.out.txt.gz](https://github.com/LLNL/spack/files/650824/spack-build.out.txt.gz)





Discussion:
@tgamblin I know your dream is that spack installs all the dependencies to insure consistent compilers, versions  etc and this is why spack does not care much about allowing one to use "system" installs of some packages (in fact that functionality is pretty much broken now). Unfortunately, some packages such as hdf5, are so damn temperamental that their spack builds will often fail which leaves the user unable to build the packages they actually care about with spack that depend on hdf5, for example. If spack was "friendly" with "system" installed packages then when something like hdf5 won't build for me with spack I can just bypass it and use the system one, instead I have to mark this machine as off limits for spack which is super annoying.
@tgamblin this is real blocker for xSDK now. Multiple people trying to install xSDK never get there because they get stopped by this.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -22,7 +22,6 @@
 # License along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##############################################################################
-
 from spack import *
 import shutil
 
@@ -48,6 +47,7 @@ class Hdf5(AutotoolsPackage):
     version('1.8.17', '7d572f8f3b798a628b8245af0391a0ca')
     version('1.8.16', 'b8ed9a36ae142317f88b0c7ef4b9c618')
     version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24')
+    version('1.8.14', 'a482686e733514a51cde12d6fe5c5d95')
     version('1.8.13', 'c03426e9e77d7766944654280b467289')
     version('1.8.12', 'd804802feb99b87fc668a90e6fa34411')
 
@@ -156,6 +156,20 @@ def configure_args(self):
 
         return ["--with-zlib=%s" % spec['zlib'].prefix] + extra_args
 
+    def configure(self, spec, prefix):
+        # Run the default autotools package configure
+        super(Hdf5, self).configure(spec, prefix)
+
+        if '@:1.8.14' in spec:
+            # On Ubuntu14, HDF5 1.8.12 (and maybe other versions)
+            # mysteriously end up with "-l -l" in the postdeps in the
+            # libtool script.  Patch this by removing the spurious -l's.
+            filter_file(
+                r'postdeps="([^"]*)"',
+                lambda m: 'postdeps="%s"' % ' '.join(
+                    arg for arg in m.group(1).split(' ') if arg != '-l'),
+                'libtool')
+
     @AutotoolsPackage.sanity_check('install')
     def check_install(self):
         # Build and run a small program to test the installed HDF5 library


Test patch: