[blfs-dev] LLVM-Mesa interaction

Ken Moffat zarniwhoop at ntlworld.com
Tue Sep 8 13:58:41 PDT 2015

On Tue, Sep 08, 2015 at 10:24:43PM +0200, Pierre Labastie wrote:
> On 08/09/2015 16:30, Fernando de Oliveira wrote:
> > Em 08-09-2015 10:43, Pierre Labastie escreveu:
> >> Hi,
> >>
> >> If Mesa is built with the r600 gallium driver, it needs that the
> >> r600 target be enabled for LLVM. Currently, the book instructions
> >> have only "--enable-targets=host" in LLVM, while they have
> >> GLL_DRV="nouveau,r300,r600,radeonsi,svga,swrast" in Mesa,
> >> and Mesa build fails.
> >> As noted in the mesa ticket for 10.6.6, and included in the book,
> >> Mesa needs to be patched to build the r600 driver, but this is
> >> another issue.
> >> Removing r600 from this GLL_DRV allows Mesa to build (obviously
> >> without the r600 driver), but I am not sure this is the best
> >> alternative.
> >> First, I think that a note should be added to the command
> >> explanations in LLVM, telling that if the r600 GLL driver is needed,
> >> target r600 should be added.
> >> Then add a note to Mesa telling that r600 GLL driver should be
> >> removed if r600 has not been built in LLVM.
> >>
> >> Please tell me whether it suits you.
> >>
> >> Pierre
> >>
> > 
> > Agreed. I couldn't decide, and forgot to ask Ken if it would be OK to
> > remove form Mesa and let the user decide, when he needed, because Ken
> > explicitly mentioned r600 in two ocasions or more, in our discussion.
> > That made me thinking that I could remove from GLL_DRV, because a user
> > needing it would fill up the steps. Of course, Ken is much more than a
> > user, so, your suggestion is probably the best one. But it would be good
> > to hear Ken's opinion.
> > 
> > Again, I agree with you, but Ken may provide some better alternative.
> > 
> Hope Ken can see this...
> OTOH, here is some added information about LLVM:
> I've looked at llvm configure script:
> --enable-targets=r600 is equivalent to --enable-targets=amdgpu
> --enable-targets=host is equivalent to --enable-targets=x86 on i686 or x86_64
> --enable-targets=cpp has nothing to do with clang++. If you build and use that
> target, you'll generate C++ code obtained from the llvm assembly code
> generated by the compiler. I found this explanation on the internet:
> "The CPP backend creates LLVM API calls to create an AST that represent the
> equivalent of the LLVM assembly." I haven't understood everything, but I think
> that is not something useful for the book...
> Also, the r600/amdgpu target is needed for radeonsi driver, and optional for
> r600 driver, but mesa-10 cannot be built with it/them on llvm-3.7.0 (it needs
> patches at least). OTOH, mesa-11 should be out within a few days (already at
> rc3). I wonder whether updating to mesa-11 could be considered for BLFS-7.8. I
> understand that Mesa impact a lot of other packages, but maybe not so many
> outside "X window system environment" chapter. Note that radeonsi is needed
> for Radeon Southern Islands and later gpu's (I have received all this
> information in a private mail from a former editor).
> Pierre

Sorry, I only skimmed the earlier post and missed a lot of it : saw
that r600 was missing (I have not updated my local copy of the book
at the moment) and thought it would be reinstated.

I blame myself for my comments on the llvm ticket - since (at least)
3.6, llvm builds for all targets by default - I noticed that while I
was watching 3.7 build things I really did not need.  On my current
build (nominally 2nd September BLFS) I built llvm-3.6.2 with
and that seems to have been enough for what I need (llvm only used
for the r600 mesa driver) :
ls -l /usr/lib/dri/*.so
-rwxr-xr-x 1 root root   25048 Sep  5 19:03 /usr/lib/dri/dummy_drv_video.so
-rwxr-xr-x 5 root root 6703128 Sep  5 18:57 /usr/lib/dri/i915_dri.so
-rwxr-xr-x 5 root root 6703128 Sep  5 18:57 /usr/lib/dri/i965_dri.so
-rwxr-xr-x 1 root root 1849144 Sep  5 19:03 /usr/lib/dri/i965_drv_video.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/kms_swrast_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/nouveau_dri.so
-rwxr-xr-x 5 root root 6703128 Sep  5 18:57 /usr/lib/dri/nouveau_vieux_dri.so
-rwxr-xr-x 5 root root 6703128 Sep  5 18:57 /usr/lib/dri/r200_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/r300_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/r600_dri.so
-rwxr-xr-x 5 root root 6703128 Sep  5 18:57 /usr/lib/dri/radeon_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/radeonsi_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/swrast_dri.so
-rwxr-xr-x 7 root root 9296216 Sep  5 18:57 /usr/lib/dri/vmwgfx_dri.so

That restriction to only r600 should probably not be our default
(we want to allow people to build clang if they insist), but I would
like to include it as optional.

ĸen - still checking AV apps for functionality, and will need to
test a bit more in my xfce install (I built xfce4-power-manager, but
lost the 'make install' ine !)
Il Porcupino Nil Sodomy Est! (if you will excuse my latatian)
  aka "The hedgehog song"

More information about the blfs-dev mailing list