Bug 216944 - restrict llvm dependency to only archs that support it in graphics/libGL/Makefile.common
Summary: restrict llvm dependency to only archs that support it in graphics/libGL/Make...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Matthew Rezny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-09 17:53 UTC by Mark Linimon
Modified: 2017-03-29 19:35 UTC (History)
1 user (show)

See Also:


Attachments
patch to Makefile.common version 1 (918 bytes, patch)
2017-02-09 17:53 UTC, Mark Linimon
no flags Details | Diff
patch to Makefile.common version 2 (6.72 KB, patch)
2017-02-09 17:55 UTC, Mark Linimon
no flags Details | Diff
patch to Makefile.common version 2 (without _all_ of my WIP) (1.63 KB, patch)
2017-02-09 18:01 UTC, Mark Linimon
no flags Details | Diff
disable Gallium and EGL on platforms without working LLVM (sparc64, ia64) (2.07 KB, patch)
2017-03-03 13:58 UTC, Matthew Rezny
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Linimon freebsd_committer freebsd_triage 2017-02-09 17:53:49 UTC
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.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2017-02-09 17:55:23 UTC
Created attachment 179802 [details]
patch to Makefile.common version 2

Patch with some refactoring added (optional).  May need -exp run.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2017-02-09 17:58:55 UTC
Comment on attachment 179802 [details]
patch to Makefile.common version 2

wrong diff.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2017-02-09 18:01:42 UTC
Created attachment 179803 [details]
patch to Makefile.common version 2 (without _all_ of my WIP)

corrected diff
Comment 4 Matthew Rezny freebsd_committer freebsd_triage 2017-02-27 17:17:35 UTC
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?
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2017-03-01 02:29:24 UTC
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.
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2017-03-01 23:07:40 UTC
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
Comment 7 Matthew Rezny freebsd_committer freebsd_triage 2017-03-03 13:58:20 UTC
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?
Comment 8 commit-hook freebsd_committer freebsd_triage 2017-03-29 18:40:06 UTC
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