Fix linking failure when cross-compiling
A message that is not in the archive (sent off-list or not yet received): [email protected]
----- Original Message -----
Quoted 18 lines
From: "Adrien Vergé" <[email protected]>
To: [email protected]
Cc: "Adrien Vergé" <[email protected]>
Sent: Friday, April 25, 2014 6:12:24 PM
Subject: [lttng-dev] [PATCH lttng-ust] Fix linking failure when cross-compilingExamples binaries in doc/examples require libs in liblttng-ust/.libs/, and those libs require other libs in the same directory. For instance liblttng-ust.so uses liblttng-ust-tracepoint.so symbols, so the latter is needed to properly link example programs. Currently, ld is given the lib dir only via -rpath (used for linking executables dependencies) but not via -rpath-link (used for linking libs dependencies).
When compiling regularly, this does not seem to be a problem (maybe ld is smart enough). However when cross-compiling with the arm-linux-gnueabihf toolchain, -rpath-link is needed otherwise linking fails with:
Quoted 5 lines
arm-linux-gnueabihf/bin/ld: warning: liblttng-ust-tracepoint.so.0, needed by ../../../liblttng-ust/.libs//liblttng-ust.so, not found (try using -rpath or -rpath-link)
This patch adds -rpath-link to doc/examples/Makefile.am.
Hi Adrien,
I notice that your fix, in addition to add the missing -rpath-link, changes:
-L../../../liblttng-ust/.libs/
into
-L../../../liblttng-ust/.libs
(final / removed)
It should change much things overall, but is there any reason for this change ?
Thanks,
Mathieu
Quoted 41 lines
Signed-off-by Adrien Vergé <[email protected]>--- doc/examples/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)doc/examples/Makefile.am +0
-3@@ -75,7 +75,7 @@ all-local: rel_build_subdir="../"; \ fi; \ for subdir in $(SUBDIRS_PROXY); do \ - (cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)'AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs/ -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/"' LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
doc/examples/Makefile.am +1
-2+ (cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)'AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs
doc/examples/Makefile.am +0
-2-Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"'LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
doc/examples/Makefile.am +0
-1done; \ if [ x"$(SUBDIRS_JUL)" != x"" ]; then \ for subdir in $(SUBDIRS_JUL); do \ --1.9.1
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 8 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
2014-04-26 4:40 GMT-04:00 Mathieu Desnoyers <[email protected]>:
Quoted 7 lines
-L../../../liblttng-ust/.libs/
into
-L../../../liblttng-ust/.libs
(final / removed)It should change much things overall, but is there any reason for this change ?
Hi,
ld already adds a final slash to the passed directory, which results in something like:
../../../liblttng-ust/.libs//liblttng-ust.so (notice the double slash).
If this is a problem (e.g. breaks build with other linkers than ld), the final slash can be set back, it also works.
Adrien
2014-04-26 4:40 GMT-04:00 Mathieu Desnoyers <[email protected]> :
Quoted 3 lines
It should change much things overall, but is there any reason for this change ?
Actually my first plan was to remove all trailing slashes, then I changed my mind to change as little code as possible. But oops... forgot one slash :)
Please tell me if I should resend a v2 patch with (or without) trailing slashes.
Thanks,
Adrien
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): CANsc=4Xh67Jnuy1b9eqirHNVGERa+ugVEdzkU0Yy652a+Nw5PA@mail.gmail.com
----- Original Message -----
Quoted 12 lines
From: "Adrien Vergé" <[email protected]>
To: "Mathieu Desnoyers" <[email protected]>
Cc: [email protected]
Sent: Saturday, April 26, 2014 6:23:09 PM
Subject: Re: [lttng-dev] [PATCH lttng-ust] Fix linking failure when cross-compiling2014-04-26 4:40 GMT-04:00 Mathieu Desnoyers < [email protected]
Quoted 3 lines
:
It should change much things overall, but is there any reason for
Quoted 8 lines
Quoted 1 line
this change ?
Actually my first plan was to remove all trailing slashes, then I changed my mind to change as little code as possible. But oops... forgot one slash :)
Please tell me if I should resend a v2 patch with (or without) trailing slashes.
I asked, because the change was not described in the changelog.
Since it appears that removing the final slash generates a prettier path within the build (no double-slash), I'll keep it as is.
Thanks!
Mathieu
Quoted 3 lines
Thanks,
Adrien
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Mathieu Desnoyers
AppliedMerged, thanks!
Mathieu
----- Original Message -----
Quoted 64 lines
From: "Adrien Vergé" <[email protected]>
To: [email protected]
Cc: "Adrien Vergé" <[email protected]>
Sent: Friday, April 25, 2014 6:12:24 PM
Subject: [lttng-dev] [PATCH lttng-ust] Fix linking failure when cross-compilingExamples binaries in doc/examples require libs in liblttng-ust/.libs/, and those libs require other libs in the same directory. For instance liblttng-ust.so uses liblttng-ust-tracepoint.so symbols, so the latter is needed to properly link example programs. Currently, ld is given the lib dir only via -rpath (used for linking executables dependencies) but not via -rpath-link (used for linking libs dependencies).
When compiling regularly, this does not seem to be a problem (maybe ld is smart enough). However when cross-compiling with the arm-linux-gnueabihf toolchain, -rpath-link is needed otherwise linking fails with:
arm-linux-gnueabihf/bin/ld: warning: liblttng-ust-tracepoint.so.0, needed by ../../../liblttng-ust/.libs//liblttng-ust.so, not found (try using -rpath or -rpath-link)
This patch adds -rpath-link to doc/examples/Makefile.am.
Signed-off-by Adrien Vergé <[email protected]>--- doc/examples/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)doc/examples/Makefile.am +0
-3@@ -75,7 +75,7 @@ all-local: rel_build_subdir="../"; \ fi; \ for subdir in $(SUBDIRS_PROXY); do \ - (cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)'AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs/ -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/"' LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
doc/examples/Makefile.am +1
-2+ (cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/ -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)'AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs
doc/examples/Makefile.am +0
-2-Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"'LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
doc/examples/Makefile.am +0
-1done; \ if [ x"$(SUBDIRS_JUL)" != x"" ]; then \ for subdir in $(SUBDIRS_JUL); do \ --1.9.1
_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 8 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev