This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: systemtap 1.8 build fails
- From: Mark Wielaard <mjw at redhat dot com>
- To: Jiri Slaby <jslaby at suse dot cz>
- Cc: systemtap at sourceware dot org
- Date: Wed, 20 Jun 2012 12:50:04 +0200
- Subject: Re: systemtap 1.8 build fails
- References: <4FE0E61D.6010702@suse.cz>
On Tue, 2012-06-19 at 22:50 +0200, Jiri Slaby wrote:
> I have to add the pthread lib to be linked with stap_serverd to be
> able to build systemtap. Like in this diff:
> https://build.opensuse.org/package/view_file?file=link-with-pthread.patch&package=systemtap&project=devel%3Atools&rev=257b076be8a17310ddf6787741dae3c3
>
> Otherwise a build error occurs:
> CXXLD stap-serverd
> .../ld: stap_serverd-stap-serverd.o: undefined reference to symbol
> 'sem_getvalue@@GLIBC_2.2.5'
> .../ld: note: 'sem_getvalue@@GLIBC_2.2.5' is defined in DSO
> /lib64/libpthread.so.0 so try adding it to the linker command line
> /lib64/libpthread.so.0: could not read symbols: Invalid operation
> collect2: error: ld returned 1 exit status
>
> This is because sem_getvalue needs -lpthread, according to the man page.
You are right. It is better to add that explicitly since we are using
sem_getvalue explicitly in our own code. But normally nss_LIBS will
include that flag. Did something change so that linking against nss
doesn't include that anymore? If nss isn't available stap-serverd
shouldn't be build.
I added the following. Hopefully similar to what you did (the above URL
doesn't work for me).
Thanks,
Mark
commit f7707c311326e241648fa7ec713df4b294dd45ec
Author: Mark Wielaard <mjw@redhat.com>
Date: Wed Jun 20 12:46:14 2012 +0200
Add -lpthread to stap_serverd_LDADD.
Since we use sem_getvalue () in stap-serverd.cxx we should explicitly
link against libpthread.so.
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/Makefile.am b/Makefile.am
index 690684b..a658df2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -184,7 +184,7 @@ stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nssc
stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS)
stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
-stap_serverd_LDADD = $(nss_LIBS)
+stap_serverd_LDADD = $(nss_LIBS) -lpthread
if HAVE_AVAHI
stap_serverd_CFLAGS += $(avahi_CFLAGS)
stap_serverd_CXXFLAGS += $(avahi_CFLAGS)
diff --git a/Makefile.in b/Makefile.in
index 7724831..45adacc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -505,6 +505,7 @@ PHONIES = $(am__append_17) $(am__append_23) runcheck update-po \
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ $(am__append_24)
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_serverd_LDADD = $(nss_LIBS) \
+@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ -lpthread \
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@ $(am__append_26)
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_gen_cert_SOURCES = stap-gen-cert.cxx util.cxx nsscommon.cxx
@BUILD_SERVER_TRUE@@BUILD_TRANSLATOR_TRUE@@HAVE_NSS_TRUE@stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)