[ltt-dev] [PATCH] Always link against libm

stefanha at gmail.com stefanha at gmail.com
Sun May 23 12:30:43 EDT 2010


From: Stefan Hajnoczi <stefanha at gmail.com>

This patch makes builds --without-lttv-gui work by linking against libm.

Signed-off-by: Stefan Hajnoczi <stefanha at gmail.com>
---
This patch is my attempt to fix the following build issue:

Building --without-lttv-gui produces linker errors due to missing libm.  The
build works fine when GUI is enabled.

This issue happens with lttv-0.12.31-04072010 and lttv.git:

$ ./configure --without-lttv-gui
$ make
/bin/bash ../../libtool --tag=CC   --mode=link gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -Wall -Wformat -g -O2 -export-dynamic   -o lttv.real batchtest.o main.o module.o option.o hook.o attribute.o iattribute.o state.o stats.o tracecontext.o traceset.o filter.o print.o sync_chain.o sync_chain_lttv.o graph_functions.o data_structures.o event_processing_lttng_common.o event_processing_lttng_standard.o event_processing_lttng_null.o event_matching_broadcast.o event_matching_distributor.o event_matching_tcp.o event_analysis_chull.o event_analysis_eval.o event_analysis_linreg.o factor_reduction_accuracy.o -lpopt   ../../ltt/liblttvtraceread.la -lpthread   -pthread -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0   -Wl,--export-dynamic -pthread -lgmodule-2.0 -lrt -lglib-2.0
libtool: link: gcc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Wformat -g -O2 -o .libs/lttv.real batchtest.o main.o module.o option.o hook.o attribute.o iattribute.o state.o stats.o tracecontext.o traceset.o filter.o print.o sync_chain.o sync_chain_lttv.o graph_functions.o data_structures.o event_processing_lttng_common.o event_processing_lttng_standard.o event_processing_lttng_null.o event_matching_broadcast.o event_matching_distributor.o event_matching_tcp.o event_analysis_chull.o event_analysis_eval.o event_analysis_linreg.o factor_reduction_accuracy.o -pthread -Wl,--export-dynamic -pthread -Wl,--export-dynamic  /usr/lib/libpopt.so ../../ltt/.libs/liblttvtraceread.so -lpthread /usr/lib/libgobject-2.0.so /usr/lib/libgthread-2.0.so /usr/lib/libgmodule-2.0.so -lrt /usr/lib/libglib-2.0.so -pthread
event_analysis_chull.o: In function `calculateFactorsMiddle':
/tmp/lttv/lttv/lttv/sync/event_analysis_chull.c:987: undefined reference to `sqrt'
event_analysis_eval.o: In function `printAnalysisStatsEval':
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:894: undefined reference to `sqrt'
event_analysis_eval.o: In function `analyzeBroadcastEval':
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:751: undefined reference to `sqrt'
event_analysis_eval.o: In function `binNum':
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:1311: undefined reference to `log'
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:1311: undefined reference to `log'
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:1311: undefined reference to `floor'
event_analysis_eval.o: In function `binStart':
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:1343: undefined reference to `pow'
event_analysis_eval.o: In function `binEnd':
/tmp/lttv/lttv/lttv/sync/event_analysis_eval.c:1370: undefined reference to `pow'
event_analysis_linreg.o: In function `finalizeLSA':
/tmp/lttv/lttv/lttv/sync/event_analysis_linreg.c:317: undefined reference to `sqrt'
collect2: ld returned 1 exit status
make[4]: *** [lttv.real] Error 1

System info:
Linux 2.6.32-3-amd64
autoconf (GNU Autoconf) 2.65
gcc (Debian 4.4.4-1) 4.4.4
GNU assembler (GNU Binutils for Debian) 2.20.1-system.20100303

 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 69d3809..b3b86fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,7 +156,7 @@ fi
 pkg_modules="gobject-2.0 >= 2.0.0"
 PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
 
-LIBS="$LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
+LIBS="$LIBS $M_LIBS $GTK_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
 PACKAGE_CFLAGS="$GTK_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -Wall -Wformat"
 MODULE_CFLAGS="$PACKAGE_CFLAGS -fvisibility=hidden"
 MODULE_LDFLAGS="-module -avoid-version"
-- 
1.7.1





More information about the lttng-dev mailing list