Repository: spack/spack

Issue:
ImageMagick: Link Problem
@adamjstewart I'm having trouble with ImageMagick; it builds fine but fails almost all its tests.  I see you added `make('check')` recently, do the checks work for you?

[spack-build.txt](https://github.com/LLNL/spack/files/514542/spack-build.txt)



Discussion:
Building now. What compiler are you using? OS? We should probably comment that out if we can't figure out why the tests are failing.

I'm using a Spack-built GCC-4.9.3 on CentOS 7.  My guess is there are some missing dependencies in the ImageMagick package that it picked up off of the system on your machine.  My CentOS 7 is pretty bare-bones.

I temporarily disabled tests and went ahead to see what we get.  As I suspect, it has link problems:

```
$ which convert
~/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/ImageMagick-7.0.2-7-iacnk3itboehvmcd6n2fkwfbfc5d3jj3/bin/convert

$ ldd `which convert` | grep 'not found' | sort | uniq
    libbz2.so.1.0 => not found
    libintl.so.8 => not found
```

The full `ldd` is here:

```
$ ldd `which convert`
    linux-vdso.so.1 =>  (0x00007ffca20b0000)
    libMagickCore-7.Q16HDRI.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/ImageMagick-7.0.2-7-iacnk3itboehvmcd6n2fkwfbfc5d3jj3/lib/libMagickCore-7.Q16HDRI.so.0 (0x00007f38165a8000)
    libMagickWand-7.Q16HDRI.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/ImageMagick-7.0.2-7-iacnk3itboehvmcd6n2fkwfbfc5d3jj3/lib/libMagickWand-7.Q16HDRI.so.0 (0x00007f3816278000)
    libtiff.so.5 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/libtiff-4.0.6-5uop2wn4imkhd77jjzpvdqnvgjddydts/lib/libtiff.so.5 (0x00007f3816003000)
    libjpeg.so.9 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/jpeg-9b-h6wi2mxhgdm62tf35evytb7y4f5ocuy4/lib/libjpeg.so.9 (0x00007f3815dc9000)
    libXt.so.6 => /lib64/libXt.so.6 (0x00007f3815b49000)
    libbz2.so.1.0 => not found
    libpangocairo-1.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/pango-1.40.1-gft7w75bi26uz7cofh623qsa4h24x6ka/lib/libpangocairo-1.0.so.0 (0x00007f381593b000)
    libpangoft2-1.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/pango-1.40.1-gft7w75bi26uz7cofh623qsa4h24x6ka/lib/libpangoft2-1.0.so.0 (0x00007f3815724000)
    libharfbuzz.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/harfbuzz-0.9.37-2vtqlomeb3qwxmbhsieyyah637h4k2sy/lib/libharfbuzz.so.0 (0x00007f38154cd000)
    libpango-1.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/pango-1.40.1-gft7w75bi26uz7cofh623qsa4h24x6ka/lib/libpango-1.0.so.0 (0x00007f3815281000)
    libgthread-2.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/glib-2.49.4-jgbzjiubi4sut3epxlmtri4ivkqwbo2x/lib/libgthread-2.0.so.0 (0x00007f3815080000)
    libcairo.so.2 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/cairo-1.14.0-rmb4vmxwaqunxdtbv566mwbrefzz742k/lib/libcairo.so.2 (0x00007f3814d86000)
    libpixman-1.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/pixman-0.32.6-tyjyg23xyovcs6zemp7tnqrpmyosdl2u/lib/libpixman-1.so.0 (0x00007f3814adb000)
    libfontconfig.so.1 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/fontconfig-2.11.1-ahw6poflqu3xdjak2e34hbhuart73a2f/lib/libfontconfig.so.1 (0x00007f381489e000)
    libfreetype.so.6 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/freetype-2.5.3-65eltcpaxg3orneq6j7qen6b2lmfoxwv/lib/libfreetype.so.6 (0x00007f3814608000)
    libpng16.so.16 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/libpng-1.6.24-ryojsu5woe7e4tyr23jvber3pwyktlgw/lib/libpng16.so.16 (0x00007f38143d7000)
    libXrender.so.1 => /lib64/libXrender.so.1 (0x00007f38141cd000)
    libXext.so.6 => /lib64/libXext.so.6 (0x00007f3813fba000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f3813db2000)
    libgobject-2.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/glib-2.49.4-jgbzjiubi4sut3epxlmtri4ivkqwbo2x/lib/libgobject-2.0.so.0 (0x00007f3813b60000)
    libffi.so.6 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/libffi-3.2.1-dvxkhnahg2qzs2ny27ravo6sdqa24vrd/lib/../lib64/libffi.so.6 (0x00007f3813955000)
    libglib-2.0.so.0 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/glib-2.49.4-jgbzjiubi4sut3epxlmtri4ivkqwbo2x/lib/libglib-2.0.so.0 (0x00007f3813645000)
    libpcre.so.1 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/pcre-8.39-bg6noucddv2mvatcrlfvtqbgkub3ic2t/lib/libpcre.so.1 (0x00007f3813401000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f38131e5000)
    libintl.so.8 => not found
    libxml2.so.2 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/libxml2-2.9.4-wi2nujzykapy7hesipbcrmqym44vqsdz/lib/libxml2.so.2 (0x00007f3812e7f000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f3812c7b000)
    liblzma.so.5 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/xz-5.2.2-xrfipwm7kpcbqcdp2bdreavtoaaerczb/lib/liblzma.so.5 (0x00007f3812a56000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f3812840000)
    libSM.so.6 => /lib64/libSM.so.6 (0x00007f3812637000)
    libICE.so.6 => /lib64/libICE.so.6 (0x00007f381241b000)
    libX11.so.6 => /lib64/libX11.so.6 (0x00007f38120dd000)
    libgomp.so.1 => /home2/rpfische/spack-tools/opt/spack/linux-x86_64/gcc-4.8.5/gcc-4.9.3-jfebnuuusdch34j7pvdnvlxffe2rmoe4/lib64/libgomp.so.1 (0x00007f3811ec6000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f3811bc4000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f3811802000)
    libbz2.so.1.0 => not found
    libintl.so.8 => not found
    libgcc_s.so.1 => /home2/rpfische/spack-tools/opt/spack/linux-x86_64/gcc-4.8.5/gcc-4.9.3-jfebnuuusdch34j7pvdnvlxffe2rmoe4/lib64/libgcc_s.so.1 (0x00007f38115ea000)
    libbz2.so.1.0 => not found
    libintl.so.8 => not found
    libintl.so.8 => not found
    libintl.so.8 => not found
    libintl.so.8 => not found
    libintl.so.8 => not found
    libintl.so.8 => /home2/rpfische/spack3/opt/spack/linux-centos7-x86_64/gcc-4.9.3/gettext-0.19.8.1-w2u4i7b7pjyfnrzgag35onrk3gkpwgnd/lib/libintl.so.8 (0x00007f38113d9000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f3816c69000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f38111d3000)
    libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f3810fb1000)
    libXau.so.6 => /lib64/libXau.so.6 (0x00007f3810dac000)
```

Hmm, looks like it is also missing some X11 packages. If we can merge #1740 I can get started on adding these.

But the X11 packages weren't killing me here.  Also, can they be optional?
I've never used ImageMagick with a GUI...

Either way, I think that ImageMagick should be optional on
`py-matplotlib`.  It's way too bloated, and I've (apparently) never needed
it when using Matplotlib.

On Thu, Oct 6, 2016 at 2:43 PM, Adam J. Stewart notifications@github.com
wrote:

> Hmm, looks like it is also missing some X11 packages. If we can merge
> #1740 https://github.com/LLNL/spack/pull/1740 I can get started on
> adding these.
> 
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> https://github.com/LLNL/spack/issues/1947#issuecomment-252052836, or mute
> the thread
> https://github.com/notifications/unsubscribe-auth/AB1cd_tYpCzZRxdsEQCDbhDxKRGLNzAsks5qxUFdgaJpZM4KQRIB
> .

> But the X11 packages weren't killing me here. Also, can they be optional? I've never used ImageMagick with a GUI...

Who knows. Since it picked them up from your system, it's hard to tell whether or not they would build properly without them being present. I generally err on the side of caution. I'd rather build all of the dependencies and features than risk not having them on my system. Otherwise, we end up with issues like this where a common library wasn't present on one user's system. We can make them optional if you want, but they should probably default to True.

> I generally err on the side of caution. I'd rather build all of the dependencies and features than risk not having them on my system.

@tgamblin 

I agree and disagree at the same time.  Spack adds the most value when it builds things that (a) change a lot, or (b) aren't standard on Linux systems.  I noticed today that Spack was building `tar`.  Hmm...

As we go further down the build DAG, we go down the value chain in terms of what we're adding for users.    But adding them to Spack has real costs:
1. Time to add and maintain these packages (witness the time I spent today on ImageMagick --- a package I had no need for).
2. Additional build time for users --- including headaches if they break.  The system will feel increasingly bloated.  That's one objection to MacPorts... that it builds the "kitchen sink" and is over-bloated for 99% of users.
3. If users don't want (2), they have to add an increasingly long list of entries to `packages.yaml`.

Maybe the right approach is to add these dependencies, but have a default `packages.yaml` in Spack that assumes system versions of some that are pretty safe.  The user can ovverride if needed.

Pretty sure this was broken by #1894, which told Spack to no longer add dependencies of dependencies to RPATH. Can you try `make check` again now that #1954 has been merged to revert this?


Resolving patch:
diff --git a/var/spack/repos/builtin/packages/image-magick/package.py b/var/spack/repos/builtin/packages/image-magick/package.py
--- a/var/spack/repos/builtin/packages/image-magick/package.py
+++ b/var/spack/repos/builtin/packages/image-magick/package.py
@@ -25,7 +25,7 @@
 from spack import *
 
 
-class ImageMagick(Package):
+class ImageMagick(AutotoolsPackage):
     """ImageMagick is a software suite to create, edit, compose,
     or convert bitmap images."""
 
@@ -45,10 +45,9 @@ class ImageMagick(Package):
     depends_on('ghostscript')
     depends_on('ghostscript-fonts')
 
-    def install(self, spec, prefix):
+    def configure_args(self):
+        spec = self.spec
         gs_font_dir = join_path(spec['ghostscript-fonts'].prefix.share, "font")
-        configure('--prefix={0}'.format(prefix),
-                  '--with-gs-font-dir={0}'.format(gs_font_dir))
-        make()
-        make('check')
-        make('install')
+        return [
+            '--with-gs-font-dir={0}'.format(gs_font_dir)
+        ]


Test patch: