Created attachment 179801 [details] patch to Makefile.common version 1 libGL and other ports that reference Makefile.common grew a dependency on llvm via gallium as of r397198. However, various tier-2 archs do not yet support llvm, in particular, sparc64 and mips64. (work for support on aarch64 is ongoing). This patch (version 1) conditionalizes the dependency to only certain archs. I also tested version 2 which includes some refactoring. I merely include it as WIP. Both patches have been tested on armv6 and amd64 and seem to DTRT.
Created attachment 179802 [details] patch to Makefile.common version 2 Patch with some refactoring added (optional). May need -exp run.
Comment on attachment 179802 [details] patch to Makefile.common version 2 wrong diff.
Created attachment 179803 [details] patch to Makefile.common version 2 (without _all_ of my WIP) corrected diff
At first glance this looked like a good idea, just the list of architectures with LLVM needs to be expended. I know LLVM ports build on PowerPC in addition to x86 and ARM, so I assumed that only MIPS and Sparc64 would need to be excluded, but when I checked the LLVM ports to confirm that, I found that the only architecture excluded is IA64. Do the LLVM ports fail to build on MIPS and Sparc64, in which case those arches should be added to the NOT_FOR_ARCH list in the LLVM ports, or is it just that Mesa ports fail to build with Gallium enabled on these platforms?
The fact that there are backends for an arch does not guarantee that the compiler generates usable code. I know that there is active work on aarch64 to make clang usable, but it is not quite there yet. I vaguely recall this being the case for mips/mips64 as well, but I'm not sure. It has been months since I even tried to build llvm38/39 on sparc64. I have gone ahead and fired up a build to see what the status is. The problem I'm trying to solve is that we would like to have mesa available on all archs, even if llvm does not (yet) work on them.
Both llvm38 and llvm39 fail on sparc64: real memory = 17179869184 (16384 MB) avail memory = 16822845440 (16043 MB) cpu0: Sun Microsystems UltraSparc-IIIi Processor (1504.00 MHz CPU) cpu1: Sun Microsystems UltraSparc-IIIi Processor (1504.00 MHz CPU) FreeBSD v215-2 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 08:00:05 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/sparc64.sparc64/usr/src/sys/GENERIC sparc64 1 llvm39-3.9.1_1 devel/llvm39 build 0 ??? 2 llvm38-3.8.1_5 devel/llvm38 build/runaway 1 runaway_process
Created attachment 180463 [details] disable Gallium and EGL on platforms without working LLVM (sparc64, ia64) If it were just that LLVM produced bad code on Sparc64 or MIPS then no change would be needed, just the gallium drivers (llvmpipe) would not work but the classic drivers (swrast) would still be available. Since LLVM was not blocked on Sparc64, I assumed at worst the Mesa build would fail with Gallium enable, requiring disabling Gallium and thus also EGL. Since LLVM fails to build, it should be marked broken on Sparc in addition to not using it in Mesa. The attached patch should take care of Sparc64. Should MIPS be added to the exclusion?
A commit references this bug: Author: rezny Date: Wed Mar 29 16:57:54 UTC 2017 New revision: 437215 URL: https://svnweb.freebsd.org/changeset/ports/437215 Log: Update to 13.0.6 - Allow use of newer LLVM, i.e. llvm40, via MESA_LLVM_VER in make.conf [1] - Disable use of LLVM on platforms where it's known not to be available [2] PR: [1] 217016, [2] 216944 Reported by: [1] greenreaper@hotmail.com, [2] linimon Approved by: swills (mentor) Differential Revision: https://reviews.freebsd.org/D10183 Changes: head/graphics/gbm/Makefile head/graphics/libEGL/Makefile head/graphics/libGL/Makefile.common head/graphics/libGL/Makefile.targets head/graphics/libGL/distinfo head/graphics/libglapi/Makefile