[Mesa-dev] [PATCH] configure: Trust LLVM >= 4.0 llvm-config --libs for shared libraries

Michel Dänzer michel at daenzer.net
Tue Aug 15 00:56:15 UTC 2017


On 15/08/17 07:55 AM, Grazvydas Ignotas wrote:
> On Mon, Aug 14, 2017 at 11:13 PM, Andy Furniss <adf.lists at gmail.com> wrote:
>> Michel Dänzer wrote:
>>>
>>> On 11/08/17 01:45 AM, Emil Velikov wrote:
>>>
>>> Thanks, pushed.
>>
>>
>> Don't know if this is expected or not, but llvm built like -
>>
>> cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
>> -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" -DLLVM_ENABLE_ASSERTIONS=ON
>> -DLLVM_APPEND_VC_REV=OFF -DLLVM_BUILD_LLVM_DYLIB=ON
>>
>> now fails to build mesa (I also tried without vulkan and it still fails
>> raseonsi IIRC).
>>
>>  CXXLD    libvulkan_radeon.la
>> /usr/lib/libLLVMSupport.a(Process.cpp.o): In function
>> `llvm::sys::Process::FileDescriptorHasColors(int)':
>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x4d):
>> undefined reference to `setupterm'
>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x78):
>> undefined reference to `tigetnum'
>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x81):
>> undefined reference to `set_curterm'
>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x89):
>> undefined reference to `del_curterm'
>> collect2: error: ld returned 1 exit status
>>
>> Haven't tried llvm with -DLLVM_APPEND_VC_REV=ON yet, mesa still builds OK
>> with this commit reverted.
> 
> Same problem here, using LLVM-6.0 from a week ago, my cmake is just
> -DCMAKE_INSTALL_PREFIX=/opt/xorg -DLLVM_TARGETS_TO_BUILD='AMDGPU;X86'
> -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=TRUE
> 
> llvm-config --libs
> seems to return tons of output like -lLLVMBitWriter -lLLVMAnalysis
> -lLLVMProfileData -lLLVMObject ... which seems to result in static
> linking that's supposedly not supported by mesa? The only .so I see is
> libLLVM.so , all others are .a files.
> 
> Meanwhile
> llvm-config --shared-mode
> returns "static", which implies it wants be statically linked. There
> is BUILD_SHARED_LIBS cmake option, but llvm documentation advices
> against using it and suggests LLVM_BUILD_LLVM_DYLIB instead.
> Confusing...
> 
> Also, llvm-config --version says "6.0.0git-f49c401", which means I had
> to manually hack configure.ac every time to "6.0.0svn" to get mesa
> building too :(

The patch was intended to fix that issue, but it only works if LLVM is
built with -DLLVM_LINK_LLVM_DYLIB=ON.

Thanks for the report, followup patch posted for review.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list