public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] Fix configure scripts for Debian systems
@ 2008-06-13 20:23 Stone, Joshua I
  2008-06-13 23:14 ` David Smith
  2008-06-27 20:52 ` Roland McGrath
  0 siblings, 2 replies; 8+ messages in thread
From: Stone, Joshua I @ 2008-06-13 20:23 UTC (permalink / raw)
  To: systemtap

I found that on Debian systems (or at least Ubuntu Hardy), libdw is
shipped only as a static library.  This causes problems with our current
configure script, because there's apparently a circular link dependency
between libdw and libebl.

I added --enable-staticdw to configure, so it can try the link test in a
different way.  I'm no autoconf expert though, so I'd like others to
check this before I commit.  Or, if anyone knows how to do this without
the explicit option, that would be even better.

Thanks,

Josh


diff --git a/configure.ac b/configure.ac
index b561cf3..5ef44b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,14 +181,30 @@ AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
                                     [cd $with_elfutils && pwd])`)

 if test $build_elfutils = no; then
+  AC_ARG_ENABLE([staticdw],
+    [AS_HELP_STRING([--enable-staticdw], [support distributions with static libdw])])
+
   # Need libdwfl-capable recent elfutils from Fedora
   save_LIBS="$LIBS"
-  AC_CHECK_LIB(dw, dwfl_module_getsym,,[
-    AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])])
-  AC_CHECK_LIB(ebl, ebl_openbackend,,[
-    AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])])
+  AS_IF([test "x$enable_staticdw" != xyes],[
+    AC_CHECK_LIB(dw, dwfl_module_getsym,,[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])])
+    AC_CHECK_LIB(ebl, ebl_openbackend,,[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])])
+
+    stap_LIBS="$LIBS"
+  ],[
+    # Debian ships with a static libdw, which has a circular dependency on libebl
+    AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])],
+      [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
+    dnl  XXX Do we need the ebl check, since it was referenced above?
+    AC_CHECK_LIB(ebl, ebl_openbackend,[],[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])],
+      [-lelf])

-  stap_LIBS="$LIBS"
+    stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
+  ])
   LIBS="$save_LIBS"
 else
   # We built our own and stap_LDFLAGS points at the install.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-13 20:23 [RFC] [PATCH] Fix configure scripts for Debian systems Stone, Joshua I
@ 2008-06-13 23:14 ` David Smith
  2008-06-14  0:58   ` Stone, Joshua I
  2008-06-27 20:52 ` Roland McGrath
  1 sibling, 1 reply; 8+ messages in thread
From: David Smith @ 2008-06-13 23:14 UTC (permalink / raw)
  To: Stone, Joshua I; +Cc: systemtap

Stone, Joshua I wrote:
> I found that on Debian systems (or at least Ubuntu Hardy), libdw is
> shipped only as a static library.  This causes problems with our current
> configure script, because there's apparently a circular link dependency
> between libdw and libebl.
> 
> I added --enable-staticdw to configure, so it can try the link test in a
> different way.  I'm no autoconf expert though, so I'd like others to
> check this before I commit.  Or, if anyone knows how to do this without
> the explicit option, that would be even better.

By looking at your patch it seems like the '--with-elfutils' option and
your new '--enable-staticdw' option couldn't be specified at the same
time.  (Note that I'm not sure they *should* coexist.)

Could there be a situation where a user would want to specify both?

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-13 23:14 ` David Smith
@ 2008-06-14  0:58   ` Stone, Joshua I
  2008-06-14  1:29     ` David Smith
  0 siblings, 1 reply; 8+ messages in thread
From: Stone, Joshua I @ 2008-06-14  0:58 UTC (permalink / raw)
  To: David Smith; +Cc: systemtap

David Smith wrote:
> By looking at your patch it seems like the '--with-elfutils' option
> and your new '--enable-staticdw' option couldn't be specified at the
> same time.  (Note that I'm not sure they *should* coexist.)

This is true -- I was only trying to make it work with the system elfutils libraries.  The Ubuntu source package has a patch to hardcode the configure script in this way, and I just wanted to make that unnecessary.  Plus, now I can test git-HEAD on my Ubuntu machines in addition to Fedora.

> Could there be a situation where a user would want to specify both?

I suppose someone might want to do this.  If there's a option I can pass along to the elfutils configure script for static libdw, then that's easy enough, but I don't know what that option would be.

Josh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-14  0:58   ` Stone, Joshua I
@ 2008-06-14  1:29     ` David Smith
  2008-06-14  3:23       ` Stone, Joshua I
  0 siblings, 1 reply; 8+ messages in thread
From: David Smith @ 2008-06-14  1:29 UTC (permalink / raw)
  To: Stone, Joshua I; +Cc: systemtap

Stone, Joshua I wrote:
> David Smith wrote:
>> By looking at your patch it seems like the '--with-elfutils' option
>> and your new '--enable-staticdw' option couldn't be specified at the
>> same time.  (Note that I'm not sure they *should* coexist.)
> 
> This is true -- I was only trying to make it work with the system elfutils
> libraries.  The Ubuntu source package has a patch to hardcode the
configure
> script in this way, and I just wanted to make that unnecessary.  Plus, now
> I can test git-HEAD on my Ubuntu machines in addition to Fedora.
> 
>> Could there be a situation where a user would want to specify both?
> 
> I suppose someone might want to do this.  If there's a option I can pass
> along to the elfutils configure script for static libdw, then that's easy
> enough, but I don't know what that option would be.

I was thinking (which I didn't explain) that a situation might exist
where a user needed to compile his own elfutils and so grabbed a newer
Ubuntu source package (that had the hardcoded static libdw).  At that
point, he'd want to use both '--with-elfutils' and '--enable-staticdw'.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-14  1:29     ` David Smith
@ 2008-06-14  3:23       ` Stone, Joshua I
  2008-06-28 14:27         ` Roland McGrath
  0 siblings, 1 reply; 8+ messages in thread
From: Stone, Joshua I @ 2008-06-14  3:23 UTC (permalink / raw)
  To: David Smith; +Cc: systemtap

David Smith wrote:
> I was thinking (which I didn't explain) that a situation might exist
> where a user needed to compile his own elfutils and so grabbed a
> newer Ubuntu source package (that had the hardcoded static libdw).
> At that point, he'd want to use both '--with-elfutils' and
> '--enable-staticdw'.

OK, makes sense.  I've updated the patch below, and I tested that it does work with Ubuntu's elfutils sources.

If there are no other objections, I'll commit this.

Thanks,

Josh


(my mutt just broke, so my apologies if Outlook mangles this...)

diff --git a/configure.ac b/configure.ac
index b561cf3..ed09970 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,19 +180,36 @@ AM_CONDITIONAL(BUILD_ELFUTILS, test $build_elfutils = yes)
 AC_SUBST(elfutils_abs_srcdir, `AS_IF([test $build_elfutils = yes],
                                     [cd $with_elfutils && pwd])`)

+AC_ARG_ENABLE([staticdw],
+  [AS_HELP_STRING([--enable-staticdw], [support distributions with static libdw])])
+
 if test $build_elfutils = no; then
   # Need libdwfl-capable recent elfutils from Fedora
   save_LIBS="$LIBS"
-  AC_CHECK_LIB(dw, dwfl_module_getsym,,[
-    AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])])
-  AC_CHECK_LIB(ebl, ebl_openbackend,,[
-    AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])])
+  AS_IF([test "x$enable_staticdw" != xyes],[
+    AC_CHECK_LIB(dw, dwfl_module_getsym,,[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])])
+    AC_CHECK_LIB(ebl, ebl_openbackend,,[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])])
+
+    stap_LIBS="$LIBS"
+  ],[
+    # Debian ships with a static libdw, which has a circular dependency on libebl
+    AC_CHECK_LIB(dw, dwfl_module_getsym,[],[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (dw 0.123+)])],
+      [-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf])
+    dnl  XXX Do we need the ebl check, since it was referenced above?
+    AC_CHECK_LIB(ebl, ebl_openbackend,[],[
+      AC_MSG_ERROR([missing elfutils development headers/libraries (ebl 0.123+)])],
+      [-lelf])

-  stap_LIBS="$LIBS"
+    stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"
+  ])
   LIBS="$save_LIBS"
 else
   # We built our own and stap_LDFLAGS points at the install.
-  stap_LIBS="-ldw -lebl"
+  AS_IF([test "x$enable_staticdw" != xyes],[stap_LIBS="-ldw -lebl"],
+       [stap_LIBS="-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf"])
 fi

 AC_SUBST(stap_LIBS)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-13 20:23 [RFC] [PATCH] Fix configure scripts for Debian systems Stone, Joshua I
  2008-06-13 23:14 ` David Smith
@ 2008-06-27 20:52 ` Roland McGrath
  2008-06-29 23:56   ` Stone, Joshua I
  1 sibling, 1 reply; 8+ messages in thread
From: Roland McGrath @ 2008-06-27 20:52 UTC (permalink / raw)
  To: Stone, Joshua I; +Cc: systemtap

Systemtap does not use libebl directly any more, so there is really no need
to have the AC_CHECK_LIB for it at all.

I would argue that packagers of elfutils providing only static libraries
ought to do something like provide a libdw.so file containing:

GROUP ( libdw.a libebl.a libelf.so )

so that -ldw works for programs that use dwarf_* and dwfl_* entry points,
as it does in the normal arrangement where libdw.so is a shared library.

That said, it should do no harm to link stap with
-Wl,--start-group -ldw -lebl -Wl,--end-group -lelf
when the normal DSOs are there.  libebl.a will be 
consulted but having nothing to supply.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-14  3:23       ` Stone, Joshua I
@ 2008-06-28 14:27         ` Roland McGrath
  0 siblings, 0 replies; 8+ messages in thread
From: Roland McGrath @ 2008-06-28 14:27 UTC (permalink / raw)
  To: Stone, Joshua I; +Cc: David Smith, systemtap

No, it should be done so that it works on either sort of system without a
special option.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [RFC] [PATCH] Fix configure scripts for Debian systems
  2008-06-27 20:52 ` Roland McGrath
@ 2008-06-29 23:56   ` Stone, Joshua I
  0 siblings, 0 replies; 8+ messages in thread
From: Stone, Joshua I @ 2008-06-29 23:56 UTC (permalink / raw)
  To: Roland McGrath; +Cc: systemtap

Roland McGrath wrote:
> That said, it should do no harm to link stap with
> -Wl,--start-group -ldw -lebl -Wl,--end-group -lelf
> when the normal DSOs are there.  libebl.a will be
> consulted but having nothing to supply.

In that case, I'll remove --enable-staticdw and set it to always use the
link groups.  That's much easier than trying to convince a distro to
change their ways...

Josh

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-27 23:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13 20:23 [RFC] [PATCH] Fix configure scripts for Debian systems Stone, Joshua I
2008-06-13 23:14 ` David Smith
2008-06-14  0:58   ` Stone, Joshua I
2008-06-14  1:29     ` David Smith
2008-06-14  3:23       ` Stone, Joshua I
2008-06-28 14:27         ` Roland McGrath
2008-06-27 20:52 ` Roland McGrath
2008-06-29 23:56   ` Stone, Joshua I

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).