From 26ab7b8a79e6c901518d9136d00b79e2905dab58 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Tue, 26 Dec 2017 04:06:40 +0100 Subject: nxagent: implement RPATH/RUNPATH override for libX11. As discussed in ArcticaProject/nx-libs#610, we need a way to load libNX_X11 as a fake version of libX11 into nxagent's address space. For doing so, we have to link against libX11 at build-time and specify a(n) RPATH/RUNPATH to our libX11 -> libNX_X11 compat symlinks. This commit is essentially doing a cross between options 3 and 4 discussed in the provided GH issue. We link libX11 early (before specifying -Lcompat_symlinks_dir), so that the linker finds the "real" libX11 version with the libX11 SONAME. This leads to our binary depending upon both libX11 and libNX_X11 SONAMEs. We already always added RPATH/RUNPATH, but these values are not passed down to dependent libraries. What happens at run-time is that the loader searches for a libX11 SONAME, takes RPATH/RUNPATH into account and loads our libNX_X11 library instead via the compat symlinks. This satisfies the libX11 SONAME and dependent libraries will *not* load the system libX11 version again. Debian's dpkg-shlibdeps isn't quite happy about this mismatching SONAME situation, so instruct to look the other way while we're minding our business. Fixes: ArcticaProject/nx-libs#610 --- nx-X11/programs/Xserver/Imakefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 25ebd73b9..efab0de85 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -319,6 +319,7 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lrt \ + -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ @@ -334,6 +335,7 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ + -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ @@ -349,6 +351,7 @@ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ -lkvm \ + -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ @@ -364,6 +367,7 @@ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -L../../lib/src/.libs \ + -lX11 \ -lXcomp \ -lXcompshad \ -lXrender \ -- cgit v1.2.3 From ffc09a73d3fad32f3765caf62546a3e7cc5b9cd8 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Fri, 29 Dec 2017 21:44:56 +0100 Subject: nx-X11: build programs with a temporary RPATH/RUNPATH value and a relinked version with the system location. While the install target explicitly installs the relinked system-location version of a program, we do not actually use this. Currently, we copy nxagent directly out of the build root. --- nx-X11/programs/Xserver/Imakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index efab0de85..f6dd11521 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -400,7 +400,7 @@ nxagent_static: nxagent else exit 0; fi $(CCLINK) -o nxagent_static -static $(LDOPTIONS) $(NXAGENTOBJS) \ $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \ - $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_LOAD_FLAGS) + $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_INSTALL_LOAD_FLAGS) /* * Hard coded target to build a static nxagent server except for libX11 and libXext. @@ -411,7 +411,7 @@ nxagent_static_nolibs: nxagent else exit 0; fi $(CCLINK) -o nxagent_static_nolibs -Wl,-Bstatic $(LDOPTIONS) $(NXAGENTOBJS) \ $(NXAGENTLIBS) $(LOADABLEEXTS) $(LIBCWRAPPER) $(LDLIBS) \ - $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_X11 -lXext $(EXTRA_LOAD_FLAGS) + $(LDPRELIBS) $(SYSLIBS) -Wl,-Bdynamic -lNX_X11 -lXext $(EXTRA_INSTALL_LOAD_FLAGS) #endif /* NXAgentServer */ #if defined(NXWinServer) && NXWinServer -- cgit v1.2.3 From ecaa13ce6817282c1b9a3a75a2c022876834be83 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Sat, 30 Dec 2017 00:17:57 +0100 Subject: nx-X11: reintroduce creation of libX11 compat symlinks. We need this to be able to execute the resulting nxagent binary from within the build directory. --- nx-X11/programs/Xserver/Imakefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nx-X11/programs/Xserver') diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index f6dd11521..5d86a534d 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -391,6 +391,8 @@ NX_XSHADOWLIBNAME = libXcompshad.so ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \ $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTNXLIBS) $(NXAGENTSYSLIBS) $(NXCOMPEXTSYSLIBS)) +LibX11Links() + /* * Hard coded target to build a static nxagent server. */ -- cgit v1.2.3