Repository: spack/spack

Issue:
Pixman build fails 
Summary
Building gnuplot on macOS High Sierra, the build of dependency pixman failed due the removal of __builtin_shuffle from clang 5.0, as reported here: https://bugs.freedesktop.org/show_bug.cgi?id=104886. I've manually applied the patch given there, and then pixman built.

### Expected Result
Build pixman.

### Actual Result
Build failed with:
```console
==> Installing pixman
==> Using cached archive: /Applications/Spack/spack/var/spack/cache/pixman/pixman-0.34.0.tar.gz
==> Staging archive: /Applications/Spack/spack/var/spack/stage/pixman-0.34.0-2rhnonvnl6rshlcan4jgpfdiwo2a3avg/pixman-0.34.0.tar.gz
==> Created stage in /Applications/Spack/spack/var/spack/stage/pixman-0.34.0-2rhnonvnl6rshlcan4jgpfdiwo2a3avg
==> No patches needed for pixman
==> Building pixman [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j4'

5 errors found in build log:
     595      CC       infinite-loop.o
     596      CC       trap-crasher.o
     597      CC       fence-image-self-test.o
     598      CC       region-translate-test.o
     599      CC       fetch-test.o
     600      CC       a1-trap-test.o
   601    utils-prng.c:207:27: error: use of unknown builtin '__builtin_shuffle' [-Wimplicit-function-declaration]
     602                randdata.vb = __builtin_shuffle (randdata.vb, bswap_shufflemask);
     603                              ^
   604    utils-prng.c:207:25: error: assigning to 'uint8x16' (vector of 16 'uint8_t' values) from incompatible type 'int'
     605                randdata.vb = __builtin_shuffle (randdata.vb, bswap_shufflemask);
     606                            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     607    2 errors generated.
   608    make[2]: *** [utils-prng.lo] Error 1
     609    make[2]: *** Waiting for unfinished jobs....
   610    make[1]: *** [all-recursive] Error 1
   611    make: *** [all] Error 2
```

### Steps to reproduce the issue

```console
$ spack install gnuplot
```

### Information on your system
macOS High Sierra 10.13.4
```console
$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
```
### Solution
Apply patch https://bugs.freedesktop.org/show_bug.cgi?id=104886
-----


Discussion:
@anne-glerum would you like to contribute a patch? see https://spack.readthedocs.io/en/latest/packaging_guide.html#patches 
Sure! Will do so asap. 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/pixman/package.py b/var/spack/repos/builtin/packages/pixman/package.py
--- a/var/spack/repos/builtin/packages/pixman/package.py
+++ b/var/spack/repos/builtin/packages/pixman/package.py
@@ -40,6 +40,13 @@ class Pixman(AutotoolsPackage):
     depends_on('pkgconfig', type='build')
     depends_on('libpng')
 
+    # As discussed here:
+    # https://bugs.freedesktop.org/show_bug.cgi?id=104886
+    # __builtin_shuffle was removed in clang 5.0.
+    # From version 9.1 apple-clang is based on clang 5.0.
+    # Patch is obtained from above link.
+    patch('clang.patch', when='%clang@9.1.0-apple:')
+
     def configure_args(self):
         args = [
             '--enable-libpng',


Test patch: