[Mesa-dev] [PATCH] targets/opencl: Fix (static) linking with LLVM

Emil Velikov emil.l.velikov at gmail.com
Wed May 28 05:01:26 PDT 2014


On 28/05/14 07:42, Kertesz Laszlo wrote:
>>> Hi,
>>> i too hit the X crashing issue. But i am unable to compile the latest
>>> git (10.2-branchpoint-318-g4c7bf8a according to 'git describe')
>>> Here is the errors i get:
>>>
>>>
>>> make[3]: Entering directory '/compile/mesa/src/gallium/targets/gbm'
>>>   CC       gbm.lo
>>>   CXXLD    gbm_gallium_drm.la
>>> /usr/local/lib/llvm32/lib/libLLVMSupport.a(Process.o): In function
>> Hmm that file is not provide by us, so I'm afraid I cannot help you here.
>> Perhaps the LLVM folks will have a better idea.
>>
> 
> Solved.
> 
> I added LDFLAGS="-ltinfo -lpthread" to the configure options and
> recompiled llvm with the additional "--disable-terminfo --disable-zlib"
> options.
> 
> Seems there were 2 issues, both somewhat trivial:
> 
>>> `llvm::sys::Process::FileDescriptorHasColors(int)':
>>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x67): undefined
>>> reference to `setupterm'
>>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0x92): undefined
>>> reference to `tigetnum'
>>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa0): undefined
>>> reference to `set_curterm'
>>> Process.cpp:(.text._ZN4llvm3sys7Process23FileDescriptorHasColorsEi+0xa8): undefined
>>> reference to `del_curterm'
> 
> The above have to do with some terminal output options (i saw some chat
> about removing it by default but it isnt the case). Solution is to add
> LDFLAGS="-ltinfo" or recompile llvm with "--disable-terminfo" option.
> 
>>> /usr/local/lib/llvm32/lib/libLLVMSupport.a(Compression.o): In function
>>> `llvm::zlib::compress(llvm::StringRef, llvm::SmallVectorImpl<char>&,
>>> llvm::zlib::CompressionLevel)':
>>> Compression.cpp:(.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEENS0_16CompressionLevelE+0x26):
>>> undefined reference to `compressBound'
>>> Compression.cpp:(.text._ZN4llvm4zlib8compressENS_9StringRefERNS_15SmallVectorImplIcEENS0_16CompressionLevelE+0xa7):
>>> undefined reference to `compress2'
> 
> These above are related to zlib. I have zlib headers installed and by
> default llvm will use them, but at least on my system (both my actual
> desktop and my 32 bit chroot) it messes up static linking in mesa. The
> only solution i found was to disable zlib when building llvm, by adding
> "--disable-zlib" to its configure script.
> 
>> Explicitly setting LDFLAGS is a recipe for disaster. Try to avoid that at all
>> cost.
>>
>> Cheers
>> Emil
> 
> Now i have those specified since i was building mesa with shared libs on
> a 64 bit system so i had to install it in another prefix, different from
> that of the 64 bit build.
I would assume that PKG_CONFIG_PATH + --with-llvm-prefix= should be enough.
Perhaps out logic in configure.ac is lacking something ?

> But now static linking works and i dont need it anyway on the 64 bit
> machine.
> 
Glad to hear :)

Thanks for the comprehensive investigation.
-Emil

>>>>
>>>> _______________________________________________
>>>> mesa-dev mailing list
>>>> mesa-dev at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>>>
>>>
>>
> 



More information about the mesa-dev mailing list