Bug 59877

Summary: Build fail since r600g: Don't build llvm_wrapper.cpp when we aren't using LLVM
Product: Mesa Reporter: Andy Furniss <adf.lists>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: lonewolf, lordheavym
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Possible fix
Possible fix v2
Right attempt to fix it on current master
v2: Right attempt to fix it on current master
v3: Right attempt to fix it on current master

Description Andy Furniss 2013-01-26 01:08:32 UTC
make -k distclean
git clean -dfx

./autogen.sh --prefix=/usr --disable-egl --enable-texture-float --enable-gallium-g3dvl --enable-r600-llvm-compiler --with-gallium-drivers=r600,swrast --with-dri-drivers= && make -j5

Making all in r600
make[4]: Entering directory `/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium/drivers/r600'
  CC       r600_asm.lo
In file included from r600_pipe.h:33:0,
                 from r600_formats.h:5,
                 from r600_asm.c:25:
r600_llvm.h:7:25: fatal error: radeon_llvm.h: No such file or directory
compilation terminated.
make[4]: *** [r600_asm.lo] Error 1
make[4]: Leaving directory `/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium/drivers/r600'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium/drivers'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/mnt/sdb1/Src64/Mesa-git/mesa/src/gallium'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/sdb1/Src64/Mesa-git/mesa/src'
make: *** [all-recursive] Error 1

andy [ /mnt/sdb1/Src64/Mesa-git/mesa ]$ find ./ -name radeon_llvm.h
./src/gallium/drivers/radeon/radeon_llvm.h

Reverting 
264e6dad28e64755dc1580abdbb4e339c3439883
r600g: Don't build llvm_wrapper.cpp when we aren't using LLVM

will build OK (but not work due to undefined symbol)
Comment 1 Tom Stellard 2013-01-26 01:49:35 UTC
Created attachment 73664 [details]
Possible fix

Does this patch help?
Comment 2 Tom Stellard 2013-01-26 08:05:21 UTC
*** Bug 59887 has been marked as a duplicate of this bug. ***
Comment 3 Tom Stellard 2013-01-26 08:42:41 UTC
Created attachment 73672 [details] [review]
Possible fix v2

This patch should fix it.
Comment 4 Andy Furniss 2013-01-26 10:30:00 UTC
(In reply to comment #3)
> Created attachment 73672 [details] [review] [review]
> Possible fix v2
> 
> This patch should fix it.

Yes, it builds and loads OK with this.
Comment 5 Laurent carlier 2013-01-26 12:18:55 UTC
Yes, it fix the problem
Comment 6 Johannes Obermayr 2013-01-28 19:32:15 UTC
Created attachment 73792 [details] [review]
Right attempt to fix it on current master
Comment 7 Tom Stellard 2013-01-28 20:17:50 UTC
(In reply to comment #6)
> Created attachment 73792 [details] [review] [review]
> Right attempt to fix it on current master

This patch is very similar to how it was before, and I think it wii(In reply to comment #6)
> Created attachment 73792 [details] [review] [review]
> Right attempt to fix it on current master

With this patch, the build will fail if you configure --enable-r600-llvm-compiler without --enable-opencl

Anyway, this bug has been fixed by commit 	91a160b19f5954fad6b1282880b843e8b1f15df4 If you have a better solution, please send a patch to the mailing list.
Comment 8 Johannes Obermayr 2013-01-28 21:13:25 UTC
Created attachment 73796 [details] [review]
v2: Right attempt to fix it on current master

It shouldn't fail because of:

if USE_R600_LLVM_COMPILER
if HAVE_GALLIUM_COMPUTE
[...]
endif
AM_CFLAGS += \
        -I$(top_srcdir)/src/gallium/drivers/radeon/ \
        $(LLVM_CFLAGS) \
        -DR600_USE_LLVM
endif


So the compiler should find radeon_llvm.h on configure --enable-r600-llvm-compiler without --enable-opencl.

I moved $(LLVM_CFLAGS). So the compiler should also find $(LLVM_INCLUDEDIR)/llvm-c/Core.h.

On this version I also changed configure.ac to set USE_R600_LLVM_COMPILER also for --enable-opencl without --enable-r600-llvm-compiler to reflect the dependency (if) here.

@Tom: You as developer should know it is hard to fix things if you cannot reproduce issues and people don't tell what happened ...

Because it has not been fixed the right way (maybe only my opinion) the discussion should be where the bug was reported. (I hate jumping between various places to get information for one topic/issue ...)
Comment 9 Tom Stellard 2013-01-28 21:41:57 UTC
(In reply to comment #8)
> Created attachment 73796 [details] [review] [review]
> v2: Right attempt to fix it on current master
> 
> It shouldn't fail because of:
> 
> if USE_R600_LLVM_COMPILER
> if HAVE_GALLIUM_COMPUTE
> [...]
> endif
> AM_CFLAGS += \
>         -I$(top_srcdir)/src/gallium/drivers/radeon/ \
>         $(LLVM_CFLAGS) \
>         -DR600_USE_LLVM
> endif
> 
> 
> So the compiler should find radeon_llvm.h on configure
> --enable-r600-llvm-compiler without --enable-opencl.
> 
> I moved $(LLVM_CFLAGS). So the compiler should also find
> $(LLVM_INCLUDEDIR)/llvm-c/Core.h.
> 
> On this version I also changed configure.ac to set USE_R600_LLVM_COMPILER
> also for --enable-opencl without --enable-r600-llvm-compiler to reflect the
> dependency (if) here.
> 
> @Tom: You as developer should know it is hard to fix things if you cannot
> reproduce issues and people don't tell what happened ...
> 
> Because it has not been fixed the right way (maybe only my opinion) the
> discussion should be where the bug was reported. (I hate jumping between
> various places to get information for one topic/issue ...)

The updated version of this patch still fails with --enable-r600-llvm-compiler without --enable-opencl

gmake[3]: Entering directory `/home/tstellar/mesa/src/gallium/targets/egl-static'
  CC     egl.lo
  CC     egl_st.lo
  CC     egl_pipe.lo
  CXXLD  egl_gallium.la
../../../../src/gallium/drivers/r600/.libs/libr600.a(r600_shader.o): In function `r600_shader_from_tgsi':
/home/tstellar/mesa/src/gallium/drivers/r600/r600_shader.c:1424: undefined reference to `r600_tgsi_llvm'
/home/tstellar/mesa/src/gallium/drivers/r600/r600_shader.c:1428: undefined reference to `r600_llvm_compile'

Also --enable-opencl should not set USE_R600_LLVM_COMPILER, because it has to be possible to build opencl without forcing the graphics driver to use the LLVM compiler.
Comment 10 Johannes Obermayr 2013-01-29 16:21:33 UTC
Created attachment 73847 [details] [review]
v3: Right attempt to fix it on current master

Next try. Removed the dependency from v2.

Why can't this silly automake simply understand conditionals like "if X || Y"?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.