* autoconf libelf and ARM cross-compilation -lelf linking
@ 2011-08-29 8:37 Turgis, Frederic
2011-09-01 14:22 ` Turgis, Frederic
0 siblings, 1 reply; 4+ messages in thread
From: Turgis, Frederic @ 2011-08-29 8:37 UTC (permalink / raw)
To: systemtap
Hi,
Cross-compilation of staprun/stapio fails on latest commit. ARM linker requests elf lib (-lelf) that my cross-compilation environment does not have:
- commit 5c854d7ca64df766c581c9ed7ff81e04c9d1fa4d has added -lelf in staprun/stapio linking
- commit 60755a94c651362c5cbc324505a9799708770742 has autoconfed elfutils usage in staprun (so linker shall not request to link against elf if not available ?)
After browsing some autoconf manual, I see that configure.ac contains AC_CHECK_HEADERS([libelf.h]) to define HAVE_LIBELF_H for conditional compilation. But few lines after, "staprun_LIBS="$staprun_LIBS -lelf" without specific condition. Is that expected to still have -lelf in command line ?
I tried to do things like AC_CHECK_HEADERS([libelf.h],[staprun_LIBS="$staprun_LIBS -lelf"],[]) but I would probably need to dig more into manual ;-)
Regards
Fred
Frederic Turgis
OMAP Platform Business Unit - OMAP System Engineering - Platform Enablement
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: autoconf libelf and ARM cross-compilation -lelf linking
2011-08-29 8:37 autoconf libelf and ARM cross-compilation -lelf linking Turgis, Frederic
@ 2011-09-01 14:22 ` Turgis, Frederic
2011-09-06 14:45 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Turgis, Frederic @ 2011-09-01 14:22 UTC (permalink / raw)
To: Turgis, Frederic, systemtap
[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]
Well, AC_CHECK_HEADERS([libelf.h],[staprun_LIBS="$staprun_LIBS -lelf"],[]) works fine in fact, I just needed a bit more info to perform the right generation of configure.
With that, cross-linking does not fail if cross environment does not have libelf.
However I was told internally to use AC_CHECK_LIB instead. So 2 points:
- This requires a symbol to test at link so I tried to find something generic in libelf.h -> "elf_begin". Feel free to find more generic
AC_CHECK_LIB(elf, elf_begin, [staprun_LIBS="$staprun_LIBS -lelf"], [])
- only have autoconf 2.67 so I don't have full patch, only modified configure.ac. If someone is interested, patch is attached.
Regards
Fred
Frederic Turgis
OMAP Platform Business Unit - OMAP System Engineering - Platform Enablement
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920
-----Original Message-----
From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org] On Behalf Of Turgis, Frederic
Sent: Monday, August 29, 2011 10:37 AM
To: systemtap@sourceware.org
Subject: autoconf libelf and ARM cross-compilation -lelf linking
Hi,
Cross-compilation of staprun/stapio fails on latest commit. ARM linker requests elf lib (-lelf) that my cross-compilation environment does not have:
- commit 5c854d7ca64df766c581c9ed7ff81e04c9d1fa4d has added -lelf in staprun/stapio linking
- commit 60755a94c651362c5cbc324505a9799708770742 has autoconfed elfutils usage in staprun (so linker shall not request to link against elf if not available ?)
After browsing some autoconf manual, I see that configure.ac contains AC_CHECK_HEADERS([libelf.h]) to define HAVE_LIBELF_H for conditional compilation. But few lines after, "staprun_LIBS="$staprun_LIBS -lelf" without specific condition. Is that expected to still have -lelf in command line ?
I tried to do things like AC_CHECK_HEADERS([libelf.h],[staprun_LIBS="$staprun_LIBS -lelf"],[]) but I would probably need to dig more into manual ;-)
Regards
Fred
Frederic Turgis
OMAP Platform Business Unit - OMAP System Engineering - Platform Enablement
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920
[-- Attachment #2: a.patch --]
[-- Type: application/octet-stream, Size: 619 bytes --]
diff --git a/runtime/staprun/configure.ac b/runtime/staprun/configure.ac
index 79d68ee..8490a42 100644
--- a/runtime/staprun/configure.ac
+++ b/runtime/staprun/configure.ac
@@ -73,11 +73,11 @@ dnl is too tricky to bother with.
AC_CHECK_HEADERS([libelf.h])
+AC_CHECK_LIB(elf, elf_begin, [staprun_LIBS="$staprun_LIBS -lelf"], [])
save_LIBS="$LIBS"
dnl this will only succeed with elfutils 0.142+
AC_CHECK_LIB(elf,elf_getshdrstrndx,[
AC_DEFINE([HAVE_ELF_GETSHDRSTRNDX],[1],[Define to 1 if libelf has elf_getshdrstrndx])])
-staprun_LIBS="$staprun_LIBS -lelf"
LIBS="$save_LIBS"
AC_SUBST(staprun_LIBS)
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: autoconf libelf and ARM cross-compilation -lelf linking
2011-09-01 14:22 ` Turgis, Frederic
@ 2011-09-06 14:45 ` Mark Wielaard
2011-09-06 16:16 ` Turgis, Frederic
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2011-09-06 14:45 UTC (permalink / raw)
To: Turgis, Frederic; +Cc: systemtap
[-- Attachment #1: Type: text/plain, Size: 856 bytes --]
Hi Turgis,
On Thu, 2011-09-01 at 16:22 +0200, Turgis, Frederic wrote:
> Well, AC_CHECK_HEADERS([libelf.h],[staprun_LIBS="$staprun_LIBS -lelf"],[]) works fine in fact, I just needed a bit more info to perform the right generation of configure.
> With that, cross-linking does not fail if cross environment does not have libelf.
>
> However I was told internally to use AC_CHECK_LIB instead. So 2 points:
> - This requires a symbol to test at link so I tried to find something generic in libelf.h -> "elf_begin". Feel free to find more generic
> AC_CHECK_LIB(elf, elf_begin, [staprun_LIBS="$staprun_LIBS -lelf"], [])
That looks sane, but I would like to move assignment into the already
existing AC_CHECK_LIB that tests for the function we actually want to
use (elf_getshdrstrndx). Patch attached. Would that work for you?
Thanks,
Mark
[-- Attachment #2: b.patch --]
[-- Type: text/x-patch, Size: 653 bytes --]
diff --git a/runtime/staprun/configure.ac b/runtime/staprun/configure.ac
index 79d68ee..f449411 100644
--- a/runtime/staprun/configure.ac
+++ b/runtime/staprun/configure.ac
@@ -76,8 +76,9 @@ AC_CHECK_HEADERS([libelf.h])
save_LIBS="$LIBS"
dnl this will only succeed with elfutils 0.142+
AC_CHECK_LIB(elf,elf_getshdrstrndx,[
- AC_DEFINE([HAVE_ELF_GETSHDRSTRNDX],[1],[Define to 1 if libelf has elf_getshdrstrndx])])
-staprun_LIBS="$staprun_LIBS -lelf"
+ AC_DEFINE([HAVE_ELF_GETSHDRSTRNDX],[1],[Define to 1 if libelf has elf_getshdrstrndx])
+ staprun_LIBS="$staprun_LIBS -lelf"
+])
LIBS="$save_LIBS"
AC_SUBST(staprun_LIBS)
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: autoconf libelf and ARM cross-compilation -lelf linking
2011-09-06 14:45 ` Mark Wielaard
@ 2011-09-06 16:16 ` Turgis, Frederic
0 siblings, 0 replies; 4+ messages in thread
From: Turgis, Frederic @ 2011-09-06 16:16 UTC (permalink / raw)
To: Mark Wielaard; +Cc: systemtap
>That looks sane, but I would like to move assignment into the
>already existing AC_CHECK_LIB that tests for the function we
>actually want to use (elf_getshdrstrndx). Patch attached.
>Would that work for you?
That's even better, I didn't check in code that you need -lelf for elf_getshdrstrndx only. So my configuration with elf lib available without elf_getshdrstrndx feature does not make sense (and if it makes in the future, this will change accordingly).
Thanks for having taken care, cross-compilation can resume
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-06 16:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-29 8:37 autoconf libelf and ARM cross-compilation -lelf linking Turgis, Frederic
2011-09-01 14:22 ` Turgis, Frederic
2011-09-06 14:45 ` Mark Wielaard
2011-09-06 16:16 ` Turgis, Frederic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).