[bind10-dev] (was: failed build)

Jeremy C. Reed jreed at isc.org
Tue Jun 29 12:48:32 UTC 2010


On Tue, 29 Jun 2010, Jelte Jansen wrote:

> > So in commit r2316, I did:
> > "
> > I noticed this because libcfgclient's tests only linked with cc/data.o
> > but build using Sunstudio showed it used libcc's session also.
> > So instead of just linking with cc/session.o (which does work),
> > I chose to link with libcc -- and noticed it was not using libtool.
> > "
> > 
> 
> interesting. It only linked to data.o because the Session class here 
> is provided by fake_session.*. I'm a tiny bit surprised it even gets 
> to the linker stage at all, and I'm going to go ahead and guess that 
> your segfault may have to do with the linker picking the wrong one 
> there (did that also happen before you changed the makefile?).

Sorry, before I changed the Makefile, I couldn't check because it didn't 
build at all. Here is the error message:

libtool: link: CC -g -features=tmplife -features=tmplrefstatic -o 
.libs/run_unittests run_unittests-ccsession_unittests.o 
run_unittests-module_spec_unittests.o 
run_unittests-config_data_unittests.o run_unittests-run_unittests.o 
-D_REENTRANT ../../../../src/lib/cc/.libs/data.o  -L/udir/jreed/pkg/lib 
/udir/jreed/opt/sunstudio-built/gtest-1.5.0/lib/libgtest.so -lpthread 
../../../../src/lib/exceptions/.libs/libexceptions.so 
./.libs/libfake_session.so 
../../../../src/lib/config/.libs/libcfgclient.so -library=stlport4 
-lsocket -lnsl -R/udir/jreed/opt/sunstudio-built/gtest-1.5.0/lib 
-R/udir/jreed/sunstudio-test/INSTALL/lib
Undefined                       first referenced
 symbol                             in file
int 
isc::cc::Session::reply(boost::shared_ptr<isc::data::Element>&,boost::shared_ptr<isc::data::Element>&) 
../../../../src/lib/config/.libs/libcfgclient.so
int 
isc::cc::Session::group_sendmsg(boost::shared_ptr<isc::data::Element>,std::string,std::string,std::string 
) ../../../../src/lib/config/.libs/libcfgclient.so
ld: fatal: Symbol referencing errors. No output written to 
.libs/run_unittests
*** Error code 1
make: Fatal error: Command failed for target `run_unittests'

After I made the change, I tested on NetBSD with g++ also.

> > Testing on NetBSD with g++ and Solaris with sunstudio I never noticed.
> > 
> > But the build error above on Debian Linux with g++ is:
> > 
> > ../../../../src/lib/cc/.libs/libcc.so: undefined reference to 
> > `pthread_key_create'
> > ../../../../src/lib/cc/.libs/libcc.so: undefined reference to 
> > `pthread_key_delete'
> > collect2: ld returned 1 exit status
> > make[5]: *** [run_unittests] Error 1
> > 
> > 
> > I will revert this run_unittests_LDADD += 
> > $(top_builddir)/src/lib/cc/libcc.la change but first want to see if 
> > anyone knows of the correct fix for this.
> 
> linking to the 'raw' version also works (.libs/libcc.a), so apparently libtool
> is dropping things in here. We had the same problems with boost and asio, so
> there is, as Nathanael already noticed, the workaround is available because of
> that one;
> 
> Index: Makefile.am
> ===================================================================
> - --- Makefile.am	(revision 2321)
> +++ Makefile.am	(working copy)
> @@ -18,6 +18,7 @@
> 
>  run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
>  run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
> +run_unittests_LDFLAGS += $(PTHREAD_LDFLAGS)

Before adding this... like to understand why needed. Why does
./src/lib/cc/Makefile.am have:

# TODO: remove PTHREAD_LDFLAGS (and from configure too)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) 
$(PTHREAD_LDFLAGS)

What is the context of the above "TODO"?


>  run_unittests_LDADD =  $(GTEST_LDADD)
>  run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
>  run_unittests_LDADD += libfake_session.la
> 
> But, and especially regarding the segfault you saw, perhaps we need 
> another way to replace a class for this specific test (or revert to 
> linking to only data.o)



More information about the bind10-dev mailing list