Last modified: 2013-07-07 17:40:50 UTC
While enabling unit test with --enable-unittest option make test fails with following error. make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/tmp/buildd/zimlib-1.0/include' Making all in test make[2]: Entering directory `/tmp/buildd/zimlib-1.0/test' g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o cluster.o cluster.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o dirent.o dirent.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o header.o header.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o main.o main.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o template.o template.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o zint.o zint.cpp g++ -DHAVE_CONFIG_H -I. -I../src -I../include -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -c -o lzmastream.o lzmastream.cpp /bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -lcxxtools-unit -Wl,-z,relro -o zimlib-test cluster.o dirent.o header.o main.o template.o zint.o lzmastream.o ../src/libzim.la libtool: link: g++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -Wno-long-long -Wall -pedantic -Wl,-z -Wl,relro -o .libs/zimlib-test cluster.o dirent.o header.o main.o template.o zint.o lzmastream.o -lcxxtools-unit ../src/.libs/libzim.so /usr/bin/ld: main.o: undefined reference to symbol '_Z17log_init_cxxtoolsv' /usr/bin/ld: note: '_Z17log_init_cxxtoolsv' is defined in DSO /usr/lib/libcxxtools.so.8 so try adding it to the linker command line /usr/lib/libcxxtools.so.8: could not read symbols: Invalid operation collect2: error: ld returned 1 exit status make[2]: *** [zimlib-test] Error 1 make[2]: Leaving directory `/tmp/buildd/zimlib-1.0/test' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/buildd/zimlib-1.0' make: *** [debian/stamp-makefile-build] Error 2 dpkg-buildpackage: error: debian/rules build gave error exit status 2 This was due to a missing linker flag -lcxxtools. I've fixed this by patching test/Makefile.am. I will attach the patch here please consider merging it in upstream.
Created attachment 12263 [details] Patch for fixing compilation issue
I would prefer to remove the cxxtools dependency if --enable-unittest... or remove unit tests from the tarball.
Hi Kelson, As discussed in IRC this build-dependency is introduced only if one runs configure with --enable-unittest. [with my Debian Hat on] I would like to have the unit tests inside the package because it will be helpful to trap unforeseen bugs on various architecture. Debian builds the package for 12 different architecture and it will be really great to trap the bugs during build time.
*** Bug 47577 has been marked as a duplicate of this bug. ***
Fixed https://git.wikimedia.org/commitdiff/openzim/ab9f6d89ac2ff008d9332bf8b7feaf4bea8bb113