[Mesa-dev] [PATCH 2/3] configure.ac: Force use of LLVM shared libs with --enable-opencl

Johannes Obermayr johannesobermayr at gmx.de
Mon Jan 21 09:32:04 PST 2013


Am Freitag, 18. Januar 2013, 17:58:27 schrieben Sie:
> From: Tom Stellard <thomas.stellard at amd.com>
> 
> If we build clover with LLVM static libraries, then clover and also each
> pipe_*.so driver that is built will contain their own static copy of
> LLVM.  The recent automake changes have uncovered a problem where
> the pipe_*.so drivers try to use clover's LLVM symbols.  This causes
> LLVM's static registry objects to be initialized each time
> a pipe_*.so driver is loaded by clover.  Initializing these objects
> multiple times is not allowed and leads to assertion failures in the
> LLVM code.
> 
> We can avoid all these problems by having clover and all the pipe_*.so
> drivers link against the same LLVM shared library.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=59334
> https://bugs.freedesktop.org/show_bug.cgi?id=59534
> ---
>  configure.ac | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index c85c836..4b93f22 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -609,8 +609,10 @@ AC_ARG_ENABLE([vdpau],
>     [enable_vdpau=auto])
>  AC_ARG_ENABLE([opencl],
>     [AS_HELP_STRING([--enable-opencl],
> -         [enable OpenCL library @<:@default=no@:>@])],
> -   [enable_opencl="$enableval"],
> +         [enable OpenCL library NOTE: Enabling this option will also enable
> +          --with-llvm-shared-libs
> +          @<:@default=no@:>@])],
> +   [enable_opencl="$enableval" with_llvm_shared_libs="$enableval"],
>     [enable_opencl=no])
>  AC_ARG_ENABLE([xlib_glx],
>      [AS_HELP_STRING([--enable-xlib-glx],
> @@ -1903,7 +1905,22 @@ dnl in LLVM_LIBS.
>  
>  if test "x$with_llvm_shared_libs" = xyes; then
>      dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
> -    LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
> +    LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
> +    AC_CHECK_FILE("$LLVM_LIBDIR/lib$LLVM_SO_NAME.so",,
> +                AC_MSG_ERROR([Could not find llvm shared library: lib$LLVM_SO_NAME.so :
> +	Please make sure you have built llvm with the --enable-shared option
> +	and that your llvm libraries are installed in $LLVM_LIBDIR
> +	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 because you have
> +	passed one of the following options to configure:
> +		--with-llvm-shared-libs
> +		--enable-opencl
> +	If you do not want to build with llvm shared libraries and instead want to
> +	use llvm static libraries then remove these options from your configure
> +	invocation and reconfigure.]))
> +
> +    LLVM_LIBS="-l$LLVM_SO_NAME"
>  else
>      LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
>  fi
> 

I am against this patch because it breaks Mesa with my cmake build of LLVM which generates shared instead of static libraries:

$ ls /usr/lib64/*LLVM*
/usr/lib64/libLLVMAnalysis.so           /usr/lib64/libLLVMInstCombine.so         /usr/lib64/libLLVMMipsInfo.so           /usr/lib64/libLLVMSparcCodeGen.so
/usr/lib64/libLLVMArchive.so            /usr/lib64/libLLVMInstrumentation.so     /usr/lib64/libLLVMMSP430AsmPrinter.so   /usr/lib64/libLLVMSparcDesc.so
/usr/lib64/libLLVMARMAsmParser.so       /usr/lib64/libLLVMInterpreter.so         /usr/lib64/libLLVMMSP430CodeGen.so      /usr/lib64/libLLVMSparcInfo.so
/usr/lib64/libLLVMARMAsmPrinter.so      /usr/lib64/libLLVMipa.so                 /usr/lib64/libLLVMMSP430Desc.so         /usr/lib64/libLLVMSupport.so
/usr/lib64/libLLVMARMCodeGen.so         /usr/lib64/libLLVMipo.so                 /usr/lib64/libLLVMMSP430Info.so         /usr/lib64/libLLVMTableGen.so
/usr/lib64/libLLVMARMDesc.so            /usr/lib64/libLLVMJIT.so                 /usr/lib64/libLLVMNVPTXAsmPrinter.so    /usr/lib64/libLLVMTarget.so
/usr/lib64/libLLVMARMDisassembler.so    /usr/lib64/libLLVMLinker.so              /usr/lib64/libLLVMNVPTXCodeGen.so       /usr/lib64/libLLVMTransformUtils.so
/usr/lib64/libLLVMARMInfo.so            /usr/lib64/libLLVMMBlazeAsmParser.so     /usr/lib64/libLLVMNVPTXDesc.so          /usr/lib64/libLLVMVectorize.so
/usr/lib64/libLLVMAsmParser.so          /usr/lib64/libLLVMMBlazeAsmPrinter.so    /usr/lib64/libLLVMNVPTXInfo.so          /usr/lib64/libLLVMX86AsmParser.so
/usr/lib64/libLLVMAsmPrinter.so         /usr/lib64/libLLVMMBlazeCodeGen.so       /usr/lib64/libLLVMObject.so             /usr/lib64/libLLVMX86AsmPrinter.so
/usr/lib64/libLLVMBitReader.so          /usr/lib64/libLLVMMBlazeDesc.so          /usr/lib64/libLLVMOption.so             /usr/lib64/libLLVMX86CodeGen.so
/usr/lib64/libLLVMBitWriter.so          /usr/lib64/libLLVMMBlazeDisassembler.so  /usr/lib64/libLLVMPowerPCAsmPrinter.so  /usr/lib64/libLLVMX86Desc.so
/usr/lib64/libLLVMCodeGen.so            /usr/lib64/libLLVMMBlazeInfo.so          /usr/lib64/libLLVMPowerPCCodeGen.so     /usr/lib64/libLLVMX86Disassembler.so
/usr/lib64/libLLVMCore.so               /usr/lib64/libLLVMMCDisassembler.so      /usr/lib64/libLLVMPowerPCDesc.so        /usr/lib64/libLLVMX86Info.so
/usr/lib64/libLLVMCppBackendCodeGen.so  /usr/lib64/libLLVMMCJIT.so               /usr/lib64/libLLVMPowerPCInfo.so        /usr/lib64/libLLVMX86Utils.so
/usr/lib64/libLLVMCppBackendInfo.so     /usr/lib64/libLLVMMCParser.so            /usr/lib64/libLLVMR600AsmPrinter.so     /usr/lib64/libLLVMXCoreAsmPrinter.so
/usr/lib64/libLLVMDebugInfo.so          /usr/lib64/libLLVMMC.so                  /usr/lib64/libLLVMR600CodeGen.so        /usr/lib64/libLLVMXCoreCodeGen.so
/usr/lib64/libLLVMExecutionEngine.so    /usr/lib64/libLLVMMipsAsmParser.so       /usr/lib64/libLLVMR600Desc.so           /usr/lib64/libLLVMXCoreDesc.so
/usr/lib64/libLLVMHexagonAsmPrinter.so  /usr/lib64/libLLVMMipsAsmPrinter.so      /usr/lib64/libLLVMR600Info.so           /usr/lib64/libLLVMXCoreDisassembler.so
/usr/lib64/libLLVMHexagonCodeGen.so     /usr/lib64/libLLVMMipsCodeGen.so         /usr/lib64/libLLVMRuntimeDyld.so        /usr/lib64/libLLVMXCoreInfo.so
/usr/lib64/libLLVMHexagonDesc.so        /usr/lib64/libLLVMMipsDesc.so            /usr/lib64/libLLVMScalarOpts.so         /usr/lib64/LLVMHello.so
/usr/lib64/libLLVMHexagonInfo.so        /usr/lib64/libLLVMMipsDisassembler.so    /usr/lib64/libLLVMSelectionDAG.so


More information about the mesa-dev mailing list