diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2017-06-21 18:36:18 +0200 |
---|---|---|
committer | Adam J. Stewart <ajstewart426@gmail.com> | 2017-06-21 11:36:18 -0500 |
commit | 59b66b0d27d29f4c7c1db256389331a36ca9fa10 (patch) | |
tree | bbe127802f2fbc153567b9cda8291e773cd227b1 | |
parent | 1f2e56e1f3452fdc9b6dde349a67efc217292b04 (diff) | |
download | spack-59b66b0d27d29f4c7c1db256389331a36ca9fa10.tar.gz spack-59b66b0d27d29f4c7c1db256389331a36ca9fa10.tar.bz2 spack-59b66b0d27d29f4c7c1db256389331a36ca9fa10.tar.xz spack-59b66b0d27d29f4c7c1db256389331a36ca9fa10.zip |
mumps: fixed compilation issues due to scotch not found at link time (#4567)
4 files changed, 38 insertions, 7 deletions
diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index 5bddeaba5d..55aac441f0 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -92,14 +92,9 @@ class Mumps(Package): orderings = ['-Dpord'] if '+ptscotch' in self.spec or '+scotch' in self.spec: - join_lib = ' -l%s' % ('pt' if '+ptscotch' in self.spec else '') makefile_conf.extend([ "ISCOTCH = -I%s" % self.spec['scotch'].prefix.include, - "LSCOTCH = -L%s %s%s" % (self.spec['scotch'].prefix.lib, - join_lib, - join_lib.join(['esmumps', - 'scotch', - 'scotcherr'])) + "LSCOTCH = {0}".format(self.spec['scotch'].libs.ld_flags) ]) orderings.append('-Dscotch') diff --git a/var/spack/repos/builtin/packages/scotch/esmumps-ldflags-6.0.4.patch b/var/spack/repos/builtin/packages/scotch/esmumps-ldflags-6.0.4.patch new file mode 100644 index 0000000000..e22ba17b34 --- /dev/null +++ b/var/spack/repos/builtin/packages/scotch/esmumps-ldflags-6.0.4.patch @@ -0,0 +1,11 @@ +--- a/src/esmumps/Makefile 2017-06-21 10:53:31.595758201 +0200 ++++ b/src/esmumps/Makefile 2017-06-21 10:54:30.811757141 +0200 +@@ -44,7 +44,7 @@ + $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -c $(<) -o $(@) + + %$(EXE) : %.c +- $(CC) $(CFLAGS) -I$(includedir) $(<) -o $(@) -L$(libdir) $(LDFLAGS) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit -lm ++ $(CC) $(CFLAGS) -I$(includedir) $(<) -o $(@) -L$(libdir) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit -lm $(LDFLAGS) + + ## + ## Project rules. diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py index 89d1f8e568..6129db104a 100644 --- a/var/spack/repos/builtin/packages/scotch/package.py +++ b/var/spack/repos/builtin/packages/scotch/package.py @@ -58,6 +58,7 @@ class Scotch(Package): # Version-specific patches patch('nonthreaded-6.0.4.patch', when='@6.0.4') + patch('esmumps-ldflags-6.0.4.patch', when='@6.0.4') # NOTE: In cross-compiling environment parallel build # produces weird linker errors. @@ -74,6 +75,23 @@ class Scotch(Package): url = "http://gforge.inria.fr/frs/download.php/latestfile/298/scotch_{0}_esmumps.tar.gz" return url.format(version) + @property + def libs(self): + + shared = '+shared' in self.spec + libraries = ['libscotch', 'libscotcherr'] + + if '+mpi' in self.spec: + libraries = ['libptscotch', 'libptscotcherr'] + libraries + if '+esmumps' in self.spec: + libraries = ['libptesmumps'] + libraries + elif '~mpi+esmumps' in self.spec: + libraries = ['libesmumps'] + libraries + + return find_libraries( + libraries, root=self.prefix, recurse=True, shared=shared + ) + def patch(self): self.configure() @@ -146,7 +164,7 @@ class Scotch(Package): if '+compression' in self.spec: cflags.append('-DCOMMON_FILE_COMPRESS_GZ') - ldflags.append('-L%s -lz' % (self.spec['zlib'].prefix.lib)) + ldflags.append(' {0} '.format(self.spec['zlib'].libs.joined())) cflags.append('-DCOMMON_PTHREAD') diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py index 43d24c61d1..8971cc0b1b 100644 --- a/var/spack/repos/builtin/packages/zlib/package.py +++ b/var/spack/repos/builtin/packages/zlib/package.py @@ -48,6 +48,13 @@ class Zlib(Package): patch('w_patch.patch', when="@1.2.11%cce") + @property + def libs(self): + shared = '+shared' in self.spec + return find_libraries( + ['libz'], root=self.prefix, recurse=True, shared=shared + ) + def setup_environment(self, spack_env, run_env): if '+pic' in self.spec: spack_env.set('CFLAGS', self.compiler.pic_flag) |