etomahawk / tstools

Automatically exported from code.google.com/p/tstools
0 stars 0 forks source link

-lm should be at the end of the CC-line in order to avoid linking errors. #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. clone repository
2. run 'make'

What is the expected output? What do you see instead?

gcc obj/esfilter.o -o bin/esfilter -g -lm   -Llib -ltstools 
lib/libtstools.a(misc.o): In function `log2':
/home/stalk/btech/src/tstools/misc.c:227: undefined reference to `log10'
lib/libtstools.a(nalunit.o): In function `read_pic_param_set_data':
/home/stalk/btech/src/tstools/nalunit.c:606: undefined reference to `ceil'
lib/libtstools.a(bitdata.o): In function `read_exp_golomb':
/home/stalk/btech/src/tstools/bitdata.c:223: undefined reference to `pow'
lib/libtstools.a(bitdata.o): In function `read_signed_exp_golomb':
/home/stalk/btech/src/tstools/bitdata.c:244: undefined reference to `pow'
/home/stalk/btech/src/tstools/bitdata.c:244: undefined reference to `ceil'
collect2: ld returned 1 exit status
make: *** [bin/esfilter] Error 1

What version of the product are you using? On what operating system?
changeset:   169:4f450a4884b3
Linux 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 
x86_64 GNU/Linux
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr 
--program-suffix=-4.6 --enable-shared --enable-linker-build-id 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin 
--enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic 
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 

Please provide any additional information below.

This patch seems to solve the problem.

diff -r 4f450a4884b3 Makefile
--- a/Makefile  Thu Oct 20 17:20:14 2011 +0100
+++ b/Makefile  Thu Nov 24 18:05:07 2011 +0100
@@ -80,7 +80,7 @@
 endif

 CFLAGS = $(WARNING_FLAGS) $(OPTIMISE_FLAGS) $(LFS_FLAGS) -I. $(PROFILE_FLAGS) $(ARCH_FLAGS)
-LDFLAGS = -g -lm $(PROFILE_FLAGS) $(ARCH_FLAGS)
+LDFLAGS = -g $(PROFILE_FLAGS) $(ARCH_FLAGS) -lm

 # Target directories
 OBJDIR = obj
@@ -215,82 +215,82 @@
 # be copied around, shared, etc., without having to think about it

 $(BINDIR)/esfilter:    $(OBJDIR)/esfilter.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/esfilter $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/esfilter $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/ts2es:       $(OBJDIR)/ts2es.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/ts2es $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/ts2es $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/es2ts:       $(OBJDIR)/es2ts.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/es2ts $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/es2ts $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/esdots:      $(OBJDIR)/esdots.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/esdots $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/esdots $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/esmerge: $(OBJDIR)/esmerge.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/esmerge $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/esmerge $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/esreport:    $(OBJDIR)/esreport.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/esreport $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/esreport $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/esreverse:   $(OBJDIR)/esreverse.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/esreverse $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/esreverse $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/stream_type: $(OBJDIR)/stream_type.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/stream_type $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/stream_type $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/psreport:    $(OBJDIR)/psreport.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/psreport $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/psreport $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/psdots:  $(OBJDIR)/psdots.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/psdots $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/psdots $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/ps2ts:       $(OBJDIR)/ps2ts.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/ps2ts $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/ps2ts $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/tsinfo:      $(OBJDIR)/tsinfo.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsinfo $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsinfo $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/tsreport:    $(OBJDIR)/tsreport.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsreport $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsreport $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/tsserve: $(OBJDIR)/tsserve.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsserve $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsserve $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/tsplay:  $(OBJDIR)/tsplay.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsplay $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsplay $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/test_ps: $(OBJDIR)/test_ps.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/test_ps $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/test_ps $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/ts2ps:       $(OBJDIR)/ts2ps.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/ts2ps $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/ts2ps $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/ts_packet_insert:    $(OBJDIR)/ts_packet_insert.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/ts_packet_insert $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/ts_packet_insert $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/m2ts2ts:     $(OBJDIR)/m2ts2ts.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/m2ts2ts $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/m2ts2ts $(LIBOPTS) $(LDFLAGS)
 $(BINDIR)/pcapreport:  $(OBJDIR)/pcapreport.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/pcapreport $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/pcapreport $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/tsfilter:    $(OBJDIR)/tsfilter.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsfilter $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsfilter $(LIBOPTS) $(LDFLAGS)
 $(BINDIR)/tsdvbsub:    $(OBJDIR)/tsdvbsub.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/tsdvbsub $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/tsdvbsub $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/test_pes:    $(OBJDIR)/test_pes.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/test_pes $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/test_pes $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/test_printing:   $(OBJDIR)/test_printing.o $(STATIC_LIB)
-       $(CC) $< -o $(BINDIR)/test_printing $(LDFLAGS) $(LIBOPTS)
+       $(CC) $< -o $(BINDIR)/test_printing $(LIBOPTS) $(LDFLAGS)

 $(BINDIR)/test_nal_unit_list:  $(OBJDIR)/test_nal_unit_list.o $(STATIC_LIB)
-           $(CC) $< -o $(BINDIR)/test_nal_unit_list $(LDFLAGS) $(LIBOPTS)
+           $(CC) $< -o $(BINDIR)/test_nal_unit_list $(LIBOPTS) $(LDFLAGS)
 $(BINDIR)/test_es_unit_list:   $(OBJDIR)/test_es_unit_list.o $(STATIC_LIB)
-           $(CC) $< -o $(BINDIR)/test_es_unit_list $(LDFLAGS) $(LIBOPTS)
+           $(CC) $< -o $(BINDIR)/test_es_unit_list $(LIBOPTS) $(LDFLAGS)

 # Some header files depend upon others, so including one requires
 # the others as well

Original issue reported on code.google.com by staal...@gmail.com on 24 Nov 2011 at 5:10

GoogleCodeExporter commented 9 years ago
Observed on Ubuntu 11.10. The patch is an appropriate fix.

Original comment by t...@tibsnjoan.co.uk on 15 Mar 2012 at 2:09

GoogleCodeExporter commented 9 years ago
Fixed in affe4cf2adf0e132c54b54d33dc526f62122be9c

Original comment by t...@tibsnjoan.co.uk on 15 Mar 2012 at 2:11