Bug 13659

Summary: libopenraw-0.0.3: test ljpegtest fails with boost 1.34.1
Product: libopenraw Reporter: Samuli Suominen <drac>
Component: GeneralAssignee: Hubert Figuiere <hub>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: [release:0.0.4]
i915 platform: i915 features:

Description Samuli Suominen 2007-12-14 10:15:21 UTC
ljpegtest.c doesn't have a main() and if BOOST_TEST_DYN_LINK and BOOST_TEST_MAIN are defined it expects one.. boost should provide it, but it doesn't.

unique test # make ljpegtest
/bin/sh ../libtool --tag=CXX   --mode=link g++  -g -O2 -Wextra -ansi -pedantic -g -Wall -Wshadow -static  -o ljpegtest ljpegtest.o ../lib/libopenraw.la -lboost_unit_test_framework -lboost_unit 
g++ -g -O2 -Wextra -ansi -pedantic -g -Wall -Wshadow -o ljpegtest ljpegtest.o  ../lib/.libs/libopenraw.a /usr/lib64/libjpeg.so -lboost_unit_test_framework -lboost_unit  
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.2/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lboost_unit
collect2: ld returned 1 exit status
make: *** [ljpegtest] Error 1

reproducing:

- install boost 1.34.1
- ./configure, make, make check
Comment 1 Samuli Suominen 2007-12-14 10:19:19 UTC
(In reply to comment #0)
> unique test # make ljpegtest
> /bin/sh ../libtool --tag=CXX   --mode=link g++  -g -O2 -Wextra -ansi -pedantic
> -g -Wall -Wshadow -static  -o ljpegtest ljpegtest.o ../lib/libopenraw.la
> -lboost_unit_test_framework -lboost_unit 
> g++ -g -O2 -Wextra -ansi -pedantic -g -Wall -Wshadow -o ljpegtest ljpegtest.o 
> ../lib/.libs/libopenraw.a /usr/lib64/libjpeg.so -lboost_unit_test_framework
> -lboost_unit  
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.2.2/../../../../x86_64-pc-linux-gnu/bin/ld:
> cannot find -lboost_unit
> collect2: ld returned 1 exit status
> make: *** [ljpegtest] Error 1

^ Please. Ignore this. Wrong paste, was experimenting.

Correct output:

x86_64-pc-linux-gnu-g++ -O2 -pipe -march=k8 -Wextra -ansi -pedantic -g -Wall -Wshadow -o .libs/ljpegtest 
              ljpegtest.o  ../lib/.libs/libopenraw.so -lboost_unit_test_framework 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Comment 2 Hubert Figuiere 2007-12-14 10:22:25 UTC
boost 1.34 seems to have broken the unit testing.

I have yet to figure out how to fix this.
Comment 3 Hubert Figuiere 2007-12-22 12:51:45 UTC
replaced the boost macro to allow linking unit-test statically. this fixes this bug.
(the .so does no longer provide main() in boost 1.34)
Comment 4 Samuli Suominen 2008-01-20 06:45:11 UTC
libopenraw-0.0.4 still fails,

x86_64-pc-linux-gnu-g++ -O2 -pipe -march=k8 -Wextra -ansi -pedantic -g -Wall -Wshadow -Wl,-O1 -Wl,--as-needed -o ljpegtest ljpegtest.o  -L/usr/lib ../lib/.libs/libopenraw.a /usr/lib64/libjpeg.so -lboost_unit_test_framework-mt   -Wl,--rpath -Wl,/usr/lib
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Comment 5 Hubert Figuiere 2008-01-20 10:25:43 UTC
do you have libboost_unit_test_framework-mt.a ?
Comment 6 Samuli Suominen 2008-01-20 13:48:42 UTC
(In reply to comment #5)
> do you have libboost_unit_test_framework-mt.a ?
> 

I do but correct me if I'm wrong, you can't link non-fpic (static) 
libs together with fpic (shared) libs on amd64 so it's picking
shared no matter what.. or else it would fail with x86_32 relocation
error..
Comment 7 Samuli Suominen 2008-01-20 13:57:20 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > do you have libboost_unit_test_framework-mt.a ?

hmm actually it's libboost_unit_test_framework-mt-s.a

-rw-r--r-- 1 root 793K Dec 25 09:55 /usr/lib64/libboost_unit_test_framework-mt-s.a
-rwxr-xr-x 1 root 276K Dec 25 09:55 /usr/lib64/libboost_unit_test_framework-mt.so

(just in case..

-rw-r--r-- 1 root 214K Oct 31 21:25 /usr/lib64/libjpeg.a
-rw-r--r-- 1 root  792 Oct 31 21:25 /usr/lib64/libjpeg.la
lrwxrwxrwx 1 root   17 Oct 31 21:25 /usr/lib64/libjpeg.so -> libjpeg.so.62.0.0
lrwxrwxrwx 1 root   17 Oct 31 21:25 /usr/lib64/libjpeg.so.62 -> libjpeg.so.62.0.0
-rwxr-xr-x 1 root 139K Oct 31 21:25 /usr/lib64/libjpeg.so.62.0.0)
Comment 8 Hubert Figuiere 2008-01-20 16:01:06 UTC
(In reply to comment #6)

> I do but correct me if I'm wrong, you can't link non-fpic (static) 
> libs together with fpic (shared) libs on amd64 so it's picking
> shared no matter what.. or else it would fail with x86_32 relocation
> error..

I have no problem on Suse x86_64, and it use the static one, because the dynamic one does not provide main(). It is a known design issue of libboost-unit-test-framework
Comment 9 Hubert Figuiere 2008-04-04 19:58:37 UTC
if you have any further idea or information, feel free to reopen.
Comment 10 Hubert Figuiere 2008-12-25 11:28:37 UTC
reopening
Comment 11 Hubert Figuiere 2008-12-25 11:51:24 UTC
switching to use boost minimal test instead. Not library dependency. Problem solved.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.