Estou tentando atravessar a compilação libzip-1.5.1 tendo cumprido com sucesso zlib-1.2.11 (estes são requeridos pela libzip e eu instalei em um local caminho de casa), mas estou tendo problemas com o processo do cmake.
O script que uso para compilar e compilar (de um diretório de compilação para a pasta de fontes da libzip) é o seguinte:
#!/bin/sh
PREFIX=${PWD}/install
CCPATH=/opt/arm64/gcc-linaro-6.3.1-2017.02-rc2-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf
ZLIBPATH=${PWD}/../../zlib-1.2.11/
# here is where zlib is installed
# ZLIBINSTALLEDPATH contains include, lib, share directories
ZLIBINSTALLEDPATH=${ZLIBPATH}/build_armhf64/install/
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ZLIBINSTALLEDPATH}/lib/pkgconfig/"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ZLIBINSTALLEDPATH}/lib/"
export CMAKE_AR=${CCPATH}-ar
export CC=${CCPATH}-gcc
export CXX=${CCPATH}-g++
export CMAKE_LINKER=${CCPATH}-ld
export CMAKE_RANLIB=${CCPATH}-ranlib
export CMAKE_OBJDUMP=${CCPATH}-objdump
export CMAKE_OBJCOPY=${CCPATH}-objcopy
export CMAKE_STRIP=${CCPATH}-strip
#export CMAKE_READELF=${CCPREFIX}-readelf
export CMAKE_NM=${CCPATH}-nm
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DZLIB_INCLUDE_DIR=${ZLIBINSTALLEDPATH}/include/ \
-DZLIB_LIBRARY=${ZLIBINSTALLEDPATH}/lib/ \
../
make -j 8
Mas com 94% do processo de construção, recebo os seguintes erros:
[ 92%] Building C object regress/CMakeFiles/tryopen.dir/tryopen.c.o
[ 94%] Building C object src/CMakeFiles/zipcmp.dir/zipcmp.c.o
[ 94%] Linking C executable add_from_filep
[ 94%] Linking C executable fopen_unchanged
[ 94%] Linking C executable tryopen
[ 94%] Building C object regress/CMakeFiles/hole.dir/source_hole.c.o
[ 94%] Linking C executable zipmerge
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
regress/CMakeFiles/add_from_filep.dir/build.make:95: recipe for target 'regress/add_from_filep' failed
make[2]: *** [regress/add_from_filep] Error 1
CMakeFiles/Makefile2:726: recipe for target 'regress/CMakeFiles/add_from_filep.dir/all' failed
make[1]: *** [regress/CMakeFiles/add_from_filep.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
regress/CMakeFiles/tryopen.dir/build.make:95: recipe for target 'regress/tryopen' failed
make[2]: *** [regress/tryopen] Error 1
CMakeFiles/Makefile2:800: recipe for target 'regress/CMakeFiles/tryopen.dir/all' failed
make[1]: *** [regress/CMakeFiles/tryopen.dir/all] Error 2
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
regress/CMakeFiles/fopen_unchanged.dir/build.make:95: recipe for target 'regress/fopen_unchanged' failed
make[2]: *** [regress/fopen_unchanged] Error 1
CMakeFiles/Makefile2:615: recipe for target 'regress/CMakeFiles/fopen_unchanged.dir/all' failed
make[1]: *** [regress/CMakeFiles/fopen_unchanged.dir/all] Error 2
[ 94%] Building C object regress/CMakeFiles/ziptool_regress.dir/source_hole.c.o
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
src/CMakeFiles/zipmerge.dir/build.make:95: recipe for target 'src/zipmerge' failed
make[2]: *** [src/zipmerge] Error 1
CMakeFiles/Makefile2:432: recipe for target 'src/CMakeFiles/zipmerge.dir/all' failed
make[1]: *** [src/CMakeFiles/zipmerge.dir/all] Error 2
[ 94%] Linking C executable zipcmp
[ 94%] Linking C executable ziptool
[ 96%] Linking C executable hole
CMakeFiles/zipcmp.dir/zipcmp.c.o.:. /Inlib /functionlibzip.so.5.0 :' compute_crcundefined' :reference
zipcmp.cto: ('.inflatetext'+
0x4a0.).:/ libundefined/ libzip.so.5.0reference: toundefined 'referencecrc32 'to
zipcmp.c':crc32('.
text.+.0x53e/)lib:/ libzip.so.5.0undefined: referenceundefined toreference 'tocrc32 ''
zErrorCMakeFiles'/
zipcmp.dir./.zipcmp.c.o/:lib /Inlibzip.so.5.0 :function undefined' test_filereference':
zipcmp.cto: ('.deflatetext'+
0x1494.).:/ libundefined/ libzip.so.5.0reference: toundefined 'referencecrc32'
zipcmp.c:(.text+0x14fe): undefined reference to 'crc32'
.. /tolib /'libzip.so.5.0deflateInit2_:'
undefined. .reference/ libto/ libzip.so.5.0':inflate 'undefined
.reference. /tolib /'libzip.so.5.0inflateEnd:'
undefined. .reference/ libto/ libzip.so.5.0':zError 'undefined
.reference. /tolib /'libzip.so.5.0deflateEnd:' undefined reference to 'deflate'
.
../.lib//liblibzip.so.5.0/:libzip.so.5.0 :undefined undefinedreference referenceto to' deflateInit2_''inflateInit2_
'.
./lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'collect2: error: ld returned 1 exit status
inflateInit2_'
collect2: error: ld returned 1 exit status
src/CMakeFiles/ziptool.dir/build.make:95: recipe for target 'src/ziptool' failed
make[2]: *** [src/ziptool] Error 1
src/CMakeFiles/zipcmp.dir/build.make:95: recipe for target 'src/zipcmp' failed
make[2]: *** [src/zipcmp] Error 1
CMakeFiles/Makefile2:469: recipe for target 'src/CMakeFiles/ziptool.dir/all' failed
make[1]: *** [src/CMakeFiles/ziptool.dir/all] Error 2
CMakeFiles/Makefile2:395: recipe for target 'src/CMakeFiles/zipcmp.dir/all' failed
make[1]: *** [src/CMakeFiles/zipcmp.dir/all] Error 2
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
[ 98%] Linking C executable ziptool_regress
regress/CMakeFiles/hole.dir/build.make:121: recipe for target 'regress/hole' failed
make[2]: *** [regress/hole] Error 1
CMakeFiles/Makefile2:652: recipe for target 'regress/CMakeFiles/hole.dir/all' failed
make[1]: *** [regress/CMakeFiles/hole.dir/all] Error 2
../lib/libzip.so.5.0: undefined reference to 'inflate'
../lib/libzip.so.5.0: undefined reference to 'crc32'
../lib/libzip.so.5.0: undefined reference to 'zError'
../lib/libzip.so.5.0: undefined reference to 'deflate'
../lib/libzip.so.5.0: undefined reference to 'deflateInit2_'
../lib/libzip.so.5.0: undefined reference to 'inflateEnd'
../lib/libzip.so.5.0: undefined reference to 'deflateEnd'
../lib/libzip.so.5.0: undefined reference to 'inflateInit2_'
collect2: error: ld returned 1 exit status
regress/CMakeFiles/ziptool_regress.dir/build.make:121: recipe for target 'regress/ziptool_regress' failed
make[2]: *** [regress/ziptool_regress] Error 1
CMakeFiles/Makefile2:689: recipe for target 'regress/CMakeFiles/ziptool_regress.dir/all' failed
make[1]: *** [regress/CMakeFiles/ziptool_regress.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Parece que o cmake não pode encontrar as bibliotecas zlib compiladas, mesmo que os caminhos pareçam estar bem configurados (ou não?).
Algum experimentou problemas semelhantes com o libzip? Existe alguma macro adicional de cmake que resolva este problema?
Eu realmente me livrei desse erro suprimindo a tarefa de construção de zipcmp , zipmerge e ziptool (já que não preciso deles) comentando as linhas:
#ADD_EXECUTABLE(zipcmp zipcmp.c ${SRC_EXTRA_FILES})
#TARGET_LINK_LIBRARIES(zipcmp zip)
#INSTALL(TARGETS zipcmp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
#ADD_EXECUTABLE(zipmerge zipmerge.c ${SRC_EXTRA_FILES})
#TARGET_LINK_LIBRARIES(zipmerge zip)
#INSTALL(TARGETS zipmerge RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
#ADD_EXECUTABLE(ziptool ziptool.c ${SRC_EXTRA_FILES})
#TARGET_LINK_LIBRARIES(ziptool zip)
#INSTALL(TARGETS ziptool RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
em src/CMakeLists.txt
.
Então eu compilei as bibliotecas usando make -j 8 zip
e, em seguida, make install/fast
.
Ainda retorna o erro
Install the project...
-- Install configuration: ""
-- Installing: /home/simo/adtdev/Var_libs/libzip-1.5.1/build_armhf64/install/lib/pkgconfig/libzip.pc
-- Installing: /home/simo/adtdev/Var_libs/libzip-1.5.1/build_armhf64/install/include/zipconf.h
-- Installing: /home/simo/adtdev/Var_libs/libzip-1.5.1/build_armhf64/install/include/zip.h
-- Installing: /home/simo/adtdev/Var_libs/libzip-1.5.1/build_armhf64/install/lib/libzip.a
CMake Error at man/cmake_install.cmake:36 (file):
file INSTALL cannot find
"/home/simo/adtdev/Var_libs/libzip-1.5.1/build_armhf64/man/ZIP_SOURCE_GET_ARGS.3".
Call Stack (most recent call first):
cmake_install.cmake:46 (include)
Makefile:89: recipe for target 'install/fast' failed
make: *** [install/fast] Error 1
mas eu não me importo com isso, já que tenho as libs e cabeçalhos instalados no diretório de instalação, e é isso que eu preciso.