Bug 102247

Summary: Mesa failing to compile
Product: Mesa Reporter: Chris Rankin <rankincj>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Chris Rankin 2017-08-16 10:38:22 UTC
Building on Fedora 26, and configuring Mesa as:

CFLAGS='-O2 -g -gdwarf-2' ./autogen.sh --prefix=/home/chris/Programs/local-mesa --libdir=/home/chris/Programs/local-mesa/lib64 --with-vdpau-libdir=/home/chris/Programs/local-mesa/lib64/vdpau --with-gallium-drivers=radeonsi,swrast --with-egl-platforms=drm,x11 --with-llvm-prefix=/home/chris/Programs/local-llvm --enable-llvm-shared-libs --with-dri-drivers= --enable-texture-float --enable-64-bit --enable-nine --enable-omx

However, the build fails with:

  CXXLD    gallium_dri.la
/home/chris/Programs/local-llvm/lib/libLLVMSupport.a(Process.cpp.o): In function `llvm::sys::Process::FileDescriptorHasColors(int)':
Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x67): undefined reference to `setupterm'
Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x90): undefined reference to `tigetnum'
Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x99): undefined reference to `set_curterm'
Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa1): undefined reference to `del_curterm'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:964: gallium_dri.la] Error 1
make[4]: Leaving directory '/home/chris/Programs/mesa/src/gallium/targets/dri'
make[3]: *** [Makefile:601: all-recursive] Error 1
make[3]: Leaving directory '/home/chris/Programs/mesa/src/gallium'
make[2]: *** [Makefile:853: all-recursive] Error 1
make[2]: Leaving directory '/home/chris/Programs/mesa/src'
make[1]: *** [Makefile:644: all] Error 2
make[1]: Leaving directory '/home/chris/Programs/mesa/src'
make: *** [Makefile:649: all-recursive] Error 1

I've tried updating my local LLVM installation twice, to no avail.

The missing symbols seem to be from libncurses.
Comment 1 Michel Dänzer 2017-08-16 14:58:05 UTC
https://patchwork.freedesktop.org/patch/171990/ should fix this.
Comment 2 Chris Rankin 2017-08-16 20:45:01 UTC
No, I now get:

configure: error: Could not find llvm shared libraries:
                       Please make sure you have built llvm with the --enable-shared option
                       and that your llvm libraries are installed in /home/chris/Programs/local-llvm/lib
                       If you have installed your llvm libraries to a different directory you
                       can use the --with-llvm-prefix= configure flag to specify this directory.
                       NOTE: Mesa is attempting to use llvm shared libraries by default.
                       If you do not want to build with llvm shared libraries and instead want to
                       use llvm static libraries then add --disable-llvm-shared-libs to your configure
                       invocation and rebuild.

For some reason, I think Mesa is expecting my LLVM installation to contain libLLVMTarget.so rather than libLLVM.so.
Comment 3 Michel Dänzer 2017-08-17 01:17:09 UTC
That's a different, pre-existing issue. To avoid it, build LLVM with either -DLLVM_LINK_LLVM_DYLIB=ON or -DLLVM_APPEND_VC_REV=OFF.
Comment 4 Michel Dänzer 2017-08-17 01:19:56 UTC
BTW, -DLLVM_LINK_LLVM_DYLIB=ON should avoid this bug as well.
Comment 5 Michel Dänzer 2017-08-17 06:21:30 UTC
Thanks for the report, fixed in Git:

Module: Mesa
Branch: master
Commit: 2c5717a4de2a2406a7e155de641921571a3910c7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c5717a4de2a2406a7e155de641921571a3910c7

Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 15 09:41:57 2017 +0900

configure: Check llvm-config --shared-mode

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.