Skip to content

[taped] Build issue while linking with ZLIB library

Building the current main branch fails on my testsystem. It seems, that the ZLIB library isn't used in linking stage.

Sample commands for reproducing the problem:

mkdir build
cd build
cmake3 -DCTA_USE_PGSCHED=1 -DENABLE_CCACHE=1 -DDISABLE_ORACLE_SUPPORT=1 ../
make -j32 2>stderr.log

The content of stderr.log is:

/usr/bin/ld: castor/tape/tapeserver/daemon/libctaTapeServerDaemon.a(TapeReadSingleThread.cpp.o): undefined reference to symbol 'adler32'
/usr/bin/ld: /usr/lib64/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [tapeserver/CMakeFiles/cta-taped.dir/build.make:124: tapeserver/cta-taped] Error 1
make[1]: *** [CMakeFiles/Makefile2:4032: tapeserver/CMakeFiles/cta-taped.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: CMakeFiles/cta-readtp.dir/ReadtpCmd.cpp.o: undefined reference to symbol 'adler32'
/usr/bin/ld: /usr/lib64/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [tapeserver/readtp/CMakeFiles/cta-readtp.dir/build.make:221: tapeserver/readtp/cta-readtp] Error 1
make[1]: *** [CMakeFiles/Makefile2:4929: tapeserver/readtp/CMakeFiles/cta-readtp.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Adding ZLIB::ZLIB to the target_link_libraries will fix the problem.