Created attachment 517498 [details, diff] pixman-0.34.0-clang5.patch pixman-0.34 and 9999 fails to build with clang-5.0 or later (e.x. gentoo-prefix on macOS or with clang on Linux). Upstream bug: https://bugs.freedesktop.org/show_bug.cgi?id=104886 Short summary: Since clang-5.0 there is no __builtin_shuffle (gcc-specific function), but HAVE_GCC_VECTOR_EXTENSIONS is still defined. There is a substitute function that do the same but with different API (also clang-specific) - __builtin_shufflevector. If you try to build pixman with clang-5.0 or later it will fail with following error: /Users/vsmirnov/gentoo/var/tmp/portage/x11-libs/pixman-0.34.0/work/pixman-0.34.0/test/utils-prng.c:207:27: error: use of unknown builtin '__builtin_shuffle' [-Wimplicit-function-declaration] randdata.vb = __builtin_shuffle (randdata.vb, bswap_shufflemask); ^ /Users/vsmirnov/gentoo/var/tmp/portage/x11-libs/pixman-0.34.0/work/pixman-0.34.0/test/utils-prng.c:207:25: error: assigning to 'uint8x16' (vector of 16 'uint8_t' values) from incompatible type 'int' randdata.vb = __builtin_shuffle (randdata.vb, bswap_shufflemask); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 errors generated $ clang --version clang version 5.0.1 (tags/RELEASE_501/final) Target: x86_64-apple-darwin17.4.0 Thread model: posix InstalledDir: /Users/vsmirnov/gentoo/usr/lib/llvm/5/bin Link to original discussion at LLVM: http://lists.llvm.org/pipermail/cfe-dev/2017-August/055140.html Link to upstream bug: https://bugs.freedesktop.org/show_bug.cgi?id=104886 Proposed patch (workaround) is in attachment.
Created attachment 517500 [details] emerge --info
pximan-0.34.0-clang5.patch works on both gcc and clang5. I can commit the patch by myself, but as I'm not part of X11 I'd like to check up with somebody before doing anything.
Created attachment 517504 [details] build.log
We usually apply patches only after upstream approves them, unless they are for Gentoo specific things. And maybe it is a bug in clang, that it defines HAVE_GCC_VECTOR_EXTENSIONS while supporting only a subset of what is listed here: https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
@x11: please be lenient here, pixman cannot be installed on macOS without a rememedy/patch. You can consider Gentoo Prefix a Gentoo-specific thing, if that makes your decision process easier. If it helps, we can apply conditionally on tc-is-clang or a CHOST check.
I could also live with a blunt hack like this: --- a/pixman-0.34.0.ebuild +++ b/pixman-0.34.0.ebuild @@ -3,7 +3,7 @@ EAPI=5 XORG_MULTILIB=yes -inherit xorg-2 +inherit xorg-2 flag-o-matic toolchain-funcs EGIT_REPO_URI="https://anongit.freedesktop.org/git/pixman.git" DESCRIPTION="Low-level pixel manipulation routines" @@ -15,6 +15,8 @@ IUSE="altivec iwmmxt loongson2f cpu_flags_x86_mmxext neon cpu_flags_x86_sse2 cpu_flags_x86_ssse3" src_configure() { + # workaround bug #646360 + tc-is-clang && append-cppflags -Dvector_size=fooblahblah XORG_CONFIGURE_OPTIONS=( $(use_enable cpu_flags_x86_mmxext mmx) $(use_enable cpu_flags_x86_sse2 sse2)
Thanks. Sorry for not having a look sooner. The patch looks fine to me. I'll give it a commit message and send it upstream. I used to work on pixman, so I can actually push it and make a new release.
I tested clang 5 and 6, and while everything compiles, it fails the test suite: FAIL: combiner-test FAIL: gradient-crash-test FAIL: stress-test I don't feel good about making a release claiming to fix clang support if these tests fail.
This is now fixed upstream by https://gitlab.freedesktop.org/pixman/pixman/commit/bd2b49185b28c5024597a5e530af9fc25de3193a We're investigating the failures when built with clang in https://gitlab.freedesktop.org/pixman/pixman/issues/22
The patch is included in the 0.36.0 pixman release.