[Mesa-dev] [PATCH] configure.ac: fix the --disable-llvm-shared-libs build

Chuck Atkins chuck.atkins at kitware.com
Tue Apr 19 14:47:39 UTC 2016


This still doesn't quite give what you want.  One can also have an llvm
with component shared libs.  So there's three different options for llvm
library configurations: a single shared lib, component shared libs, or
component static libs.  To ensure you're getting just the static libs or
just the shared libs, you'll need to wrap the link lines in -Bstatic or
-Bdynamic.  Something like (in pseudo code, not actual make or autoconf
syntax):

if use_llvm
then
  if use_llvm_shared
  then
    if single_library
    then
      # (whatever logic you need to deal with the different library naming
issues)
      LLVM_LIBS="-lLLVM'" or LLVM_LIBS="-LLVM-3.7"
    else # use llvm component libs
      LLVM_LIBS="-Wl,--push-state,-Bdynamic `$LLVM_CONFIG --libs
$LLVM_COMPONENTS`
-Wl,--pop-state"
    endif
  else # use_llvm_static
    LLVM_LIBS="-Wl,--push-state,-Bstatic `$LLVM_CONFIG --libs $LLVM_COMPONENTS`
-Wl,--pop-state"
  endif

  LLVM_LIBS="-L`$LLVM_CONFIG --libdir` $LLVM_LIBS"
endif

- Chuck

On Mon, Apr 18, 2016 at 11:01 PM, Jonathan Gray <jsg at jsg.id.au> wrote:

> This patch is still required for master.
>
> On Sun, Feb 28, 2016 at 02:47:03PM +1100, Jonathan Gray wrote:
> > When building with --disable-llvm-shared-libs use llvm-config --libfiles
> > instead of of --libs so the full path to the .a files is used instead of
> > -lname.
> >
> > Otherwise at install time gallium_dri.a is installed of gallium_dri.so
> > and the hardlinking of gallium_dri.so to other names fails.
> >
> > Cc: "11.2 11.1" <mesa-stable at lists.freedesktop.org>
> > Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> > ---
> >  configure.ac | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 6f970d7..3e2923f 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -2304,13 +2304,14 @@ if test "x$MESA_LLVM" != x0; then
> >      if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then
> >         AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed])
> >      fi
> > -    LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
> >
> >      dnl llvm-config may not give the right answer when llvm is a built
> as a
> >      dnl single shared library, so we must work the library name out for
> >      dnl ourselves.
> >      dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
> >      if test "x$enable_llvm_shared_libs" = xyes; then
> > +        LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
> > +
> >          dnl We can't use $LLVM_VERSION because it has 'svn' stripped
> out,
> >          LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
> >          AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"],
> [llvm_have_one_so=yes])
> > @@ -2337,6 +2338,8 @@ if test "x$MESA_LLVM" != x0; then
> >             dnl already added all of these objects to LLVM_LIBS.
> >          fi
> >      else
> > +        LLVM_LIBS="`$LLVM_CONFIG --libfiles ${LLVM_COMPONENTS}`"
> > +
> >          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
> > --
> > 2.7.0
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160419/3edb5471/attachment-0001.html>


More information about the mesa-dev mailing list