[Mesa-dev] [Mesa-stable] [PATCH 3/7] configure.ac: rework llvm libs handling for 3.9+

Andres Gomez agomez at igalia.com
Wed Oct 25 22:53:12 UTC 2017


Emil, this patch series introduces a lot of changes on how we treat
LLVM's dependency.

After applying this patch in the stable queue, I get these errors:

For the "make Gallium Drivers SWR" and "make Gallium Drivers Other"
targets:

"
...
  CXXLD    gallium_dri.la
/usr/bin/ld: /usr/lib/llvm-3.9/lib/libLLVMX86CodeGen.a(X86FloatingPoint.cpp.o): unrecognized relocation (0x2a) in section `.text._ZNK12_GLOBAL__N_13FPS16getAnalysisUsageERN4llvm13AnalysisUsageE'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
...
"

While, for the "make Vulkan" target:

"
...
  CXXLD    libvulkan_radeon.la
/usr/bin/ld: /usr/lib/llvm-3.9/lib/libLLVMAMDGPUCodeGen.a(R600OptimizeVectorRegisters.cpp.o): unrecognized relocation (0x2a) in section `.text._ZNK12_GLOBAL__N_119R600VectorRegMerger16getAnalysisUsageERN4llvm13AnalysisUsageE'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
...
"

Bumping to binutils 2.26 with the subsequent patch of the series
doesn't seem to help. You can take a look at:

https://travis-ci.org/Igalia/release-mesa/builds/292370423


So, although, if I'm understanding correctly, this seems to be a
problem in LLVM/binutils rather than in Mesa, I'm weary of applying
this whole series.

What do you think?

Thanks.


On Thu, 2017-10-05 at 11:19 +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Earlier versions need different quirks, but as of LLVM 3.9 llvm-config
> provides --link-shared/link-static toggles.
> 
> The output of which seems to be reliable - looking at LLVM 3.9, 4.0 and
> 5.0.
> 
> Note that there are earlier code will be used for pre LLVM 3.9 and is
> unchanged.
> 
> This effectively fixes LLVM static linking, while providing a clearer
> and more robust solution for future versions.
> 
> Mildly interesting side notes:
> 
>  - build-mode (introduced with 3.8) was buggy with 3.8
> It shows "static" when build with -DLLVM_LINK_LLVM_DYLIB=ON, yet it was
> consistent with --libs. The latter shows the static libraries.
> 
>  - libnames and libfiles are broken with LVM 3.9
> The library prefix and extension is printed twice liblibLLVM-3.9.so.so
> 
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Dieter Nützel <Dieter at nuetzel-hh.de>
> Cc: Michel Dänzer <michel.daenzer at amd.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  configure.ac | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 308938a5a88..dbaa6569e4e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2684,18 +2684,27 @@ if test "x$enable_llvm" = xyes; then
>      dnl this was causing the same libraries to be appear multiple times
>      dnl in LLVM_LIBS.
>  
> -    LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
> -
> -    if test "x$enable_llvm_shared_libs" = xyes; then
> -        if test $LLVM_VERSION_MAJOR -lt 4 -o "`$LLVM_CONFIG --shared-mode ${LLVM_COMPONENTS}`" = static; then
> -            detect_old_buggy_llvm
> +    if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 9; then
> +        if test "x$enable_llvm_shared_libs" = xyes; then
> +            LLVM_LIBS="`$LLVM_CONFIG --link-shared --libs ${LLVM_COMPONENTS}`"
> +        else
> +            LLVM_LIBS="`$LLVM_CONFIG --link-static --libs ${LLVM_COMPONENTS} --system-libs`"
> +            dnl llvm-config lists the system libs on a separate line. While
> +            dnl invoking --system-libs without --link-static assumes shared link.
> +            dnl Everybody now, say - Thank you LLVM developers
> +            LLVM_LIBS="`echo $LLVM_LIBS | $SED 's/\n//g'`"
>          fi
>      else
> -        AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
> -        dnl We need to link to llvm system libs when using static libs
> -        dnl However, only llvm 3.5+ provides --system-libs
> -        if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
> -            LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
> +        LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
> +        if test "x$enable_llvm_shared_libs" = xyes; then
> +            detect_old_buggy_llvm
> +        else
> +            AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
> +            dnl We need to link to llvm system libs when using static libs
> +            dnl However, only llvm 3.5+ provides --system-libs
> +            if test $LLVM_VERSION_MAJOR -ge 4 -o $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
> +                LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
> +            fi
>          fi
>      fi
>  fi
-- 
Br,

Andres
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171026/bc9e3dfc/attachment.sig>


More information about the mesa-dev mailing list