[Mesa-dev] [PATCH 1/2 v2] build libgallium shared by default.
maarten.lankhorst at canonical.com
Tue Mar 19 07:49:26 PDT 2013
Op 19-03-13 12:37, Andreas Boll schreef:
> 2013/3/19 Maarten Lankhorst <maarten.lankhorst at canonical.com>:
>> Op 18-03-13 16:28, Andreas Boll schreef:
>>> 2013/3/18 Maarten Lankhorst <maarten.lankhorst at canonical.com>:
>>>> This is one of the 2 patches used in ubuntu for decreasing size of mesa build.
>>>> The other one is more hacky, and links libmesagallium into libgallium,
>>>> and then links libgallium against libdricore too for minimal duplication.
>>>> This might mess up with static llvm, iirc static llvm is built wrong and
>>>> linking libgallium against it will cause it to export all llvm symbols too.
>>>> I believe that this is a bug in llvm though, not in mesa. The static libraries
>>>> should not export all llvm symbols.
>>>> I should probably change the default to not building shared gallium for the
>>>> same reason. :-)
>>>> Meant mostly for discussion purposes, although if there is no objection I'll
>>>> change the default to disabling shared gallium, and just let every distro enable
>>>> shared llvm and libgallium for themselves.
>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -733,6 +733,19 @@
>>>> AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
>>>> + [AS_HELP_STRING([--enable-shared-gallium],
>>>> + [Enable shared gallium core @<:@default=yes@:>@])],
>>>> + [enable_shared_gallium="$enableval"],
>>>> + [enable_shared_gallium=yes])
>>> The following code could be simplified...
>>>> +if test "x$enable_shared_gallium" = xyes; then
>>>> + SHARED_GALLIUM="1"
>>>> +AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
>>> ... to:
>>> AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test "x$enable_shared_gallium" = xyes)
>> Woops you're right, this was a leftover from when the patch was a lot more invasive,
>> and had to touch configs/autoconf.in too.
>> The AM_CONDITIONAL was added later during the transition to 9.0 :-)
>> Any thoughts on making shared gallium default or not? I'm thinking not because
>> of the llvm symbol bug I mentioned above, unless we change the default
>> of llvm shared libs to enabled too.
> I think you should disable it by default since I want to cherry-pick
> this patch to mesa 9.1.
> We could always enable it by default later.
> Additionally you should check if someone wants to build
> enabled-shared-gallium with static llvm.
> Then configure should print an error like this "Please use shared-llvm
> if you want to enable shared-gallium,
> since the combination static-llvm and shared-gallium is not supported"
How does this look?
Not tested with all insane but possible build combinations of shared/static,
if it was up to me those different forms wouldn't mix at all, and either everything
would be built statically, or nothing would be..
I would gladly remove enable_shared_gallium, and let it depend on whether
with_llvm_shared_libs was selected or not.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
diff --git a/configure.ac b/configure.ac
index 4b5b045..e605281 100644
@@ -1591,9 +1591,19 @@ AC_ARG_WITH([llvm-shared-libs],
[link with LLVM shared libraries @<:@default=disabled@:>@])],
-AS_IF([test x$enable_opencl = xyes],
+AS_IF([test x$enable_opencl = xyes -a x$with_llvm_shared_libs != xyes],
- AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries])
+ AC_MSG_WARN([OpenCL requested, forcing LLVM shared libraries])
+ [Enable shared gallium core @<:@default=no@:>@])],
+AS_IF([test x$enable_shared_gallium = xyes -a x$with_llvm_shared_libs != xyes],
+ AC_MSG_WARN([Shared libgallium requested, forcing LLVM shared libraries])
@@ -1928,6 +1938,7 @@ AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
+AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test "x$enable_shared_gallium" = xyes)
if test "x$enable_gallium_loader" = xyes; then
@@ -2263,6 +2274,7 @@ echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
echo " Shared-glapi: $enable_shared_glapi"
+echo " Shared gallium: $enable_shared_gallium"
dnl Compiler options
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index f14279b..a4090d3 100644
@@ -3,14 +3,24 @@ AUTOMAKE_OPTIONS = subdir-objects
-noinst_LTLIBRARIES = libgallium.la
AM_CFLAGS = \
- $(GALLIUM_CFLAGS) \
+lib_LTLIBRARIES = libgallium.la
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+libgallium_la_LIBADD = $(LLVM_LIBS)
+noinst_LTLIBRARIES = libgallium.la
+AM_CFLAGS += $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
libgallium_la_SOURCES = \
More information about the mesa-dev