[Mesa-dev] [PATCH] scons: Use LLVM shared library if found.

Vinson Lee vlee at freedesktop.org
Fri May 17 12:23:54 PDT 2013


On Fri, May 17, 2013 at 7:44 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
> Vinson,
>
> Why is this necessary?
>
> (I'd prefer that LLVM is statically linked by default. )
>
> Jose

The SCons build fails on systems that only provide a LLVM shared
library. 'llvm-config --libs' always enumerates the libraries instead
of providing the shared library on such systems.

$ cat /etc/redhat-release
Fedora release 18 (Spherical Cow)
$ llvm-config --libs
-lLLVMAsmParser -lLLVMInstrumentation -lLLVMLinker -lLLVMArchive
-lLLVMBitReader -lLLVMDebugInfo -lLLVMJIT -lLLVMipo -lLLVMVectorize
-lLLVMBitWriter -lLLVMTableGen -lLLVMHexagonCodeGen -lLLVMHexagonDesc
-lLLVMHexagonAsmPrinter -lLLVMHexagonInfo -lLLVMNVPTXCodeGen
-lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter
-lLLVMMBlazeDisassembler -lLLVMMBlazeAsmParser -lLLVMMBlazeCodeGen
-lLLVMMBlazeDesc -lLLVMMBlazeInfo -lLLVMMBlazeAsmPrinter
-lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen
-lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter
-lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo
-lLLVMCellSPUCodeGen -lLLVMCellSPUDesc -lLLVMCellSPUInfo
-lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen
-lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter
-lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen
-lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMPowerPCCodeGen
-lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter
-lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86AsmParser
-lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info
-lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMR600CodeGen
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMR600Desc -lLLVMR600Info
-lLLVMR600AsmPrinter -lLLVMMCDisassembler -lLLVMMCParser
-lLLVMInterpreter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine
-lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT
-lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC
-lLLVMObject -lLLVMCore -lLLVMSupport
$ ls `llvm-config --libdir`
BugpointPasses.so  libclang.so  libLLVM-3.2svn.so  libLTO.so
libprofile_rt.so  LLVMgold.so




>
> ----- Original Message -----
>> This patch fixes SCons builds on Fedora 18.
>>
>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>> ---
>>  scons/llvm.py | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/scons/llvm.py b/scons/llvm.py
>> index 7cd609c..432ece6 100644
>> --- a/scons/llvm.py
>> +++ b/scons/llvm.py
>> @@ -198,7 +198,15 @@ def generate(env):
>>              if llvm_version >= distutils.version.LooseVersion('3.2'):
>>                  env.Append(CXXFLAGS = ('-fno-rtti',))
>>
>> -            env.ParseConfig('llvm-config --libs ' + ' '.join(components))
>> +            llvm_shared_library = os.path.join(
>> +                env.backtick('llvm-config --libdir').strip(),
>> +                'libLLVM-%s%s' % (llvm_version, env['SHLIBSUFFIX'])
>> +            )
>> +            if os.path.exists(llvm_shared_library):
>> +                env.Append(LIBS = ['LLVM-%s' % llvm_version])
>> +            else:
>> +                env.ParseConfig('llvm-config --libs ' + '
>> '.join(components))
>> +
>>              env.ParseConfig('llvm-config --ldflags')
>>          except OSError:
>>              print 'scons: llvm-config version %s failed' % llvm_version
>> --
>> 1.8.2.1
>>
>> _______________________________________________
>> 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