Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 442854 - media-libs/mesa-9.1_rc1[r600-llvm-compiler] and media-libs/mesa-9.1_rc1[video_cards_radeonsi] require changes to sys-devel/llvm-3.2
Summary: media-libs/mesa-9.1_rc1[r600-llvm-compiler] and media-libs/mesa-9.1_rc1[video...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
: 459168 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-12 09:53 UTC by Patrick Lauer
Modified: 2013-05-04 22:03 UTC (History)
16 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
llvm-r600-3.2_pre20121031.ebuild (llvm-r600-3.2_pre20121031.ebuild,6.43 KB, text/plain)
2012-11-13 01:42 UTC, Chí-Thanh Christopher Nguyễn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Lauer gentoo-dev 2012-11-12 09:53:57 UTC
checking for XCB_DRI2... yes
checking for llvm-config... /usr/bin/llvm-config
checking for RADEON... yes
configure: error: LLVM 3.2 or newer with AMDGPU target enabled is required.
                     To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
                     git://people.freedesktop.org/~tstellar/llvm master
                     and build with --enable-experimental-targets=AMDGPU

!!! Please attach the following file when seeking support:
!!! /chroot/build/portage/media-libs/mesa-9999/work/Mesa-9999/config.log
 * ERROR: media-libs/mesa-9999 failed (configure phase):
 *   econf failed
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-11-12 10:09:15 UTC
Ai! It seems that the fork isn't really pulling in changes from LLVM master, so the question is: how do we maintain that?

The cleanest way seems to be introducing 'llvm-amdgpu' package with the forked sources. Make one block the other. Not many packages depend on llvm, so we could probably do with a ||()-dep or just temporarily make users use package.provided.

Let's just hope that the new mesa code won't go into a release until it is merged in llvm upstream.
Comment 2 Chí-Thanh Christopher Nguyễn gentoo-dev 2012-11-12 23:02:03 UTC
Both USE=r600-llvm-compiler and VIDEO_CARDS=radeonsi are disabled by default because they are still under heavy development.
Comment 3 Chí-Thanh Christopher Nguyễn gentoo-dev 2012-11-13 01:42:34 UTC
Created attachment 329424 [details]
llvm-r600-3.2_pre20121031.ebuild

Starting from llvm-9999.ebuild in portage I have created a proof-of-concept snapshot ebuild for the r600 branch. I also had to work around one compile error in AMD code and some wrong #ifdefs in llvm which were exposed by the AMD code and the workaround.
Comment 4 Jeremy Murphy 2012-12-08 13:25:03 UTC
Would it make sense to also change the mesa-9999 ebuild dependencies to be stricter?  At the moment it only depends on >=llvm-3.1 for r600-llvm-compiler.
Comment 5 Bernard Cafarelli gentoo-dev 2012-12-14 09:53:15 UTC
Well, still not sure what to do for llvm 3.2, but for next version, the backend was merged upstream at least :)
http://llvm.org/viewvc/llvm-project?view=rev&revision=169915
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-12-14 14:34:09 UTC
(In reply to comment #5)
> Well, still not sure what to do for llvm 3.2, but for next version, the
> backend was merged upstream at least :)
> http://llvm.org/viewvc/llvm-project?view=rev&revision=169915

Well, maybe the code will be suitable for backporting.
Comment 7 Bernard Cafarelli gentoo-dev 2012-12-14 16:09:52 UTC
After a small fix for targets list and re-apply cleanly on 3.2_rc3:
http://dev.gentoo.org/~voyageur/distfiles/llvm-3.2-r600_backend.patch.gz

With this patch and "--enable-experimental-targets=R600" to CONF_FLAGS, compilation seems OK. Now to see how a radeon card accepts this
Also, does the target name change cause problem? It was AMDGPU in tstellar's branch
Comment 8 Andrian Nord 2012-12-25 16:58:04 UTC
I've successfully compiled sys-devel/llvm-9999 with --enable-experimental-targets=R600 (there is no AMDGPU there).

Yet media-libs/mesa-9999 could not configure itself, as it checks for AMDGPU into `llvm-config --targets-built` list (for radeonsi).

I've hacked configure to check for R600 instead, but it failed to compile due to 
LLVMInitializeAMDGPUTargetInfo, LLVMInitializeAMDGPUTarget, LLVMInitializeAMDGPUTargetMC and LLVMInitializeAMDGPUAsmPrinter symbols undefined. Either llvm merge is not yet completed, either mesa is not yet ported, but it doesn't work in "easy" way.
Comment 9 Andrian Nord 2012-12-25 17:32:11 UTC
Well, actually a little more hacking (next few lines of configure to grab libs for r600 instead of amdgpu + version check removal) and replacing said symbols with R600 equivalents actually allowed me to compile mesa.

But it's not working anyway (server segfault on opening nearly-fullscreen window), so it's definitly no need to rush with that one.
Comment 10 Thomas Capricelli 2013-01-06 16:23:28 UTC
no news on this one ? Since mesa upstream started to require llvm with r600 support, we are not able to install mesa-9999 anymore...  ;-(
Comment 11 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-06 16:25:14 UTC
r600 has no special requirements.
Only if you enable USE="r600-llvm-compiler" or VIDEO_CARDS="radeonsi", both which are disabled by default, there will be problems.
Comment 12 Thomas Capricelli 2013-01-26 02:23:57 UTC
(In reply to comment #11)
> r600 has no special requirements.
> Only if you enable USE="r600-llvm-compiler" or VIDEO_CARDS="radeonsi", both
> which are disabled by default, there will be problems.

er... yes, that's what we are talking about. This bug is about media-libs/mesa-9999[r600-llvm-compiler]
(?)
Comment 13 Patrick Lauer gentoo-dev 2013-02-12 02:50:43 UTC
media-libs/mesa-9.1_rc1::gentoo-x86 now exposes this problem too.

Please fix :)
Comment 14 Duncan 2013-02-13 11:39:59 UTC
I'm seeing the problem with mesa-9.1-rc1 as well.  It's in ~arch but won't build. =:^(

Is the recommended course of action building mesa-9.1-rc1 with USE=-r600-llvm-compiler but WITH VIDEO_CARDS="radeon r600", or is keeping 9.0.1 with USE=r600-lvm-compiler better, masking mesa-9.1-rc1 until this is resolved?

(I saw this mentioned a few weeks ago on phoronix, but hoped either upstream or the gentoo mesa maintainers would have it straightened out and at least an llvm snapshot with the required target and USE flag available by the time an affected mesa hit ~arch.  Guess not.  Guess if I wanted stale^H^Hble there's a keyword for that, tho.)
Comment 15 Matt Turner gentoo-dev 2013-02-13 21:16:17 UTC
I'm thinking masking r600-llvm-compiler is the best way to go until the LLVM situation is sorted out.
Comment 16 ota 2013-02-19 14:57:58 UTC
On forums I was advised to file my problem as a bug but since this one deals with the underlying problem I am posting it here (sorry if it's not the right way to proceed).

I am trying to emerge media-libs/mesa-9.1_rc2 with USE="-r600-llvm-compiler llvm" and VIDEO_CARDS="radeon radeonsi" (on Radeon HD 7750 - Cape Verde). I have llvm-3.2 without any special flags. I get the following configuration error (the same is with +r600-llvm-compiler):
-----
configure: error: LLVM R600 Target not enabled.  You can enable it when building the LLVM
                      sources with the --enable-experimental-targets=R600
                      configure flag
-----
In forums I got the suggestion to reemerge mesa with -llvm but then I get:
-----
The following REQUIRED_USE flag constraints are unsatisfied:
    video_cards_radeonsi? ( llvm )
-----
So is there a way to have mesa 9.1 on radeonsi card without using experimental stuff (overlay/9999 ebuilds) ? I suppose I need radeonsi with my card. Or should I rather wait for the new llvm?

Thanks.
Comment 17 Thomas Capricelli 2013-02-20 13:46:25 UTC
For the record, llvm-9999 can actually be compiled with the r600 backend : http://www.freehackers.org/thomas/2013/02/19/amd-r600-gpu-backend-on-gentoo/
Comment 18 jospezial 2013-02-21 08:46:26 UTC
(In reply to comment #17)
> For the record, llvm-9999 can actually be compiled with the r600 backend :
> http://www.freehackers.org/thomas/2013/02/19/amd-r600-gpu-backend-on-gentoo/

Yes.
With llvm-9999 with the
--enable-experimental-targets=R600
entry in llvm-9999.ebuild mesa-9999 compiled fine yesterday.

I took a snapshot from
http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=tree;f=media-libs/mesa;hb=HEAD
for the mesa-9999.ebuild

media-libs/mesa-9999 was built with the following:
USE="classic egl gallium llvm nptl r600-llvm-compiler shared-glapi vdpau xa xorg xvmc -bindist -debug -gbm -gles1 -gles2 -openvg -osmesa -pax_kernel -pic (-selinux) -wayland" VIDEO_CARDS="r600 radeon radeonsi -i915 -i965 -intel -nouveau -r100 -r200 -r300 -vmware"

But no luck with mesa-9.1_rc2 :

radeon_llvm_emit.cpp:28:30: fatal error: llvm/LLVMContext.h: No such file or directory
compilation terminated.
gmake[4]: *** [radeon_llvm_emit.lo] Fehler 1
Comment 19 Thomas Capricelli 2013-02-21 11:06:16 UTC
(In reply to comment #18)
> (In reply to comment #17)
> But no luck with mesa-9.1_rc2 :
> 
> radeon_llvm_emit.cpp:28:30: fatal error: llvm/LLVMContext.h: No such file or
> directory
> compilation terminated.
> gmake[4]: *** [radeon_llvm_emit.lo] Fehler 1

I guess the compilation fix mentionned in my blog was done after rc2.
Comment 20 Ivan Iraci 2013-02-23 09:21:08 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > (In reply to comment #17)
> > But no luck with mesa-9.1_rc2 :
> > 
> > radeon_llvm_emit.cpp:28:30: fatal error: llvm/LLVMContext.h: No such file or
> > directory
> > compilation terminated.
> > gmake[4]: *** [radeon_llvm_emit.lo] Fehler 1


Same problem here with mesa-9.1,
Comment 21 Paolo Pedroni 2013-02-26 10:02:05 UTC
sys-devel/llvm-3.2 compiled and installed for me after adding CONF_FLAGS="--enable-experimental-targets=R600" and the patch in comment #7 to the ebuild.

media-libs/mesa-9.1 then compiles fine (I have yet to check if it works) but for this warning repeated twice:

Package libclc was not found in the pkg-config search path.
Perhaps you should add the directory containing `libclc.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libclc' found

libclc appears to be an LLVM library for OpenCL, does it need to be downloaded and installed separately (there is no ebuild for it in portage) or is it something that can be enabled from the llvm ebuild?
Comment 22 Paolo Pedroni 2013-02-26 12:41:36 UTC
Sadly, it does not work: X crashes as soon as KDE starts loading. It looks like the error is in KWin but I don't have the time to dig in further.
Comment 23 Duncan 2013-02-26 17:46:05 UTC
(In reply to comment #22)
> Sadly, it does not work: X crashes as soon as KDE starts loading. It looks
> like the error is in KWin but I don't have the time to dig in further.

Yes, kwin, as a compositing window manager, is kde's major opengl and thus mesa consumer.

FWIW, if you go into your kde config at $KDEHOME/share/config/kwinrc ($KDEHOME defaulting to ~/.kde if the var is unset), find section [Compositing], and change the line Enabled=true to Enabled=false, that'll turn off compositing at kde/kwin startup.  You can then get into kde, run kde settings (the application formerly known as kcontrol, now incorrectly known as systemsettings, incorrectly since with a few exceptions, it's user-specific kde settings, NOT global system settings) or kcmshell4 kwincompositing, switch to the advanced tab, and set XRender instead of OpenGL, or try OpenGL but without opengl2 shaders (checkbox).

Then you should be able to enable effects.

XRender should work, but only a few of the effects work with it as most require OpenGL.  OpenGL without opengl2 shaders might or might not work.

But of course that simply kills use of OpenGL (or at least opengl2 shaders), so you'd simply not be using it then.  That might be the best currently available for RadeonSI users, but for r600 thru NI users, USE=-r600-llvm-compiler appears to continue to be the best current alternative (and what I'm using now, with 9.1).
Comment 24 Eugene Shalygin 2013-02-26 18:03:49 UTC
If you have this problem --- https://bugs.freedesktop.org/show_bug.cgi?id=61182, you can try kwin_gles. It works without crashes
Comment 25 Patrick McMunn 2013-02-26 18:51:24 UTC
(In reply to comment #21)
> sys-devel/llvm-3.2 compiled and installed for me after adding
> CONF_FLAGS="--enable-experimental-targets=R600" and the patch in comment #7
> to the ebuild.
> 
> media-libs/mesa-9.1 then compiles fine (I have yet to check if it works) but
> for this warning repeated twice:
> 
> Package libclc was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libclc.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'libclc' found
> 
> libclc appears to be an LLVM library for OpenCL, does it need to be
> downloaded and installed separately (there is no ebuild for it in portage)
> or is it something that can be enabled from the llvm ebuild?

I have an ebuild for dev-libs/libclc on paddymac overlay if that would be convenient for you to use.
Comment 26 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-02-26 22:05:49 UTC
Please keep this bug strictly about necessary package/ebuild changes. All other issues better discuss in a separate bug report.
Comment 27 Ivan Iraci 2013-03-08 10:23:34 UTC
media-libs/mesa-9999 from x11 overlay compiles fine with USE flag r600-llvm-compiler enabled if llvm-9999 is compiled with --enable-experimental-targets=R600.

Please, fix llvm-9999 ebuild as to enable "--enable-experimental-targets=R600" option with a dedicated use flag.
Comment 28 Bernard Cafarelli gentoo-dev 2013-03-14 09:03:46 UTC
Yes, backporting to 3.2 may make a mess (clang for example is sensitive to changes in llvm itself), but adding a flag in -9999 (and upcoming 3.3) is easy
Comment 29 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-03-19 13:09:43 UTC
* llvm-9999 now has uses VIDEO_CARDS="radeon" to toggle the r600 shader compiler
* >=mesa-9.1[r600-llvm-compiler and >=mesa-9.1[video_cards_radeonsi] now depend on llvm[video_cards_radeon]
* USE="r600-llvm-compiler" and VIDEO_CARDS="radeonsi" flags will remain masked for mesa-9.1 until llvm-3.3 (or a prerelease/snapshot) enters ~arch
Comment 30 Thomas Capricelli 2013-03-21 02:10:30 UTC
Yeps, i can confirm it all works with r600/gallium on ~amd64. Thanks a lot!
Comment 31 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-05-04 22:03:00 UTC
*** Bug 459168 has been marked as a duplicate of this bug. ***