On Tue, Mar 21, 2017 at 10:33:12AM +0000, Emil Velikov wrote:
> On 21 March 2017 at 09:09, Topi Pohjolainen <topi.pohjolai...@gmail.com> 
> wrote:
> > Recent change to use drmGetDevices2() made me realize that
> > build configured using
> >
> > PKG_CONFIG_PATH=my_drm_lib_path/pkgconfig ./autogen.sh
> >
> > considers the libdrm path gotten from pkgconfig only during
> > make. When invoking "make install" the relink command puts
> > system library ahead of the path gotten from pkgconfig
> > (and starts to fail as system libdrm isn't new enough).
> >
> > This change forces the relink command to respect pkgconfig
> > settings.
> >
> > It looks to me that in
> >
> > https://bugs.freedesktop.org/show_bug.cgi?id=100259
> >
> > Emil et al are discussing similar case with gbm.
> >
> > v2: Reorder existing libarary/dependency lists instead of
> >     introducing duplicates (GL_LIB_DEPS contains DRI_LIB_DEPS).
> >
> > CC: Matt Turner <matts...@gmail.com>
> > CC: Emil Velikov <emil.veli...@collabora.com>
> > Tested-by: Grazvydas Ignotas <nota...@gmail.com> (v1)
> > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
> > ---
> >  src/glx/Makefile.am | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
> > index 79d416a..98c4018 100644
> > --- a/src/glx/Makefile.am
> > +++ b/src/glx/Makefile.am
> > @@ -175,10 +175,10 @@ GL_LIB_VERSION=1:2
> >  endif
> >
> >  GL_LIBS = \
> > +       $(GL_LIB_DEPS) \
> Are you sure this works correctly - afaict it can cause link issues
> since the dependee must be before the dependency in the link chain.
> Either way It still needs a inline comment - just copy small hunk of
> the commit message.

This makes libtool to give gcc:

libtool: relink: gcc -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libglx.a 
../../src/mapi/glapi/.libs/libglapi.a -Wl,--no-whole-archive  -Wl,-rpath 
-Wl,/home/tpohjola/opt/lib -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx 
-lxcb-dri2 -lXxf86vm -L/home/tpohjola/opt/lib -lpthread -ldl 
-L/usr/lib/x86_64-linux-gnu -lexpat -ldrm -lm -lxcb-dri3 -lxcb-present 
-lxcb-randr -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb-sync -lxcb -lxshmfence 
-lglapi  -g -O2 -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined   -pthread 
-Wl,-soname -Wl,libGL.so.1 -o .libs/libGL.so.1.2.0

which looks pretty correct to me. Note that the generated libtool command
re-arranges the arguments given to it before giving them further to gcc.

Important bit there is that the libdrm path gotten from pkgcomfig
(-L/home/tpohjola/opt/lib) precedes -L/usr/lib/x86_64-linux-gnu which is added
by libtool to the given arguments.

Here is the libtool command itself. It gets all the flags first and then the
objects.

/home/tpohjola/work/mesa/libtool  --tag CC --mode=relink gcc -I../../include 
-I../../include/GL/internal -I../../src -I../../src/loader -I../../src/mapi 
-I../../src/mapi -I../../src/mapi/glapi -I../../src/mapi/glapi 
-fvisibility=hidden -DGLX_SHARED_GLAPI -DXF86VIDMODE -D_REENTRANT 
-DDEFAULT_DRIVER_DIR=\\\"/home/tpohjola/opt/lib/dri\\\" 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DDEBUG -DUSE_X86_64_ASM 
-DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP 
-DHAVE_DLOPEN -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM 
-DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS 
-DHAVE_DRI3 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -I/home/tpohjola/opt/include 
-I/home/tpohjola/opt/include/libdrm -DGL_LIB_NAME=\\\"libGL.so.1\\\" -g -O2 
-Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes 
-fno-math-errno -fno-trapping-math -no-undefined -version-number 1:2 
-Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -o libGL.la -rpath 
/home/tpohjola/opt/lib -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx 
-lxcb-dri2 -lxcb -lXxf86vm -L/home/tpohjola/opt/lib -ldrm -lm -lpthread -ldl 
libglx.la ../../src/mapi/glapi/libglapi.la 
../../src/mapi/shared-glapi/libglapi.la
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to