libzip Linux cross-compile configurationlinux static compilation issueSqueeze/Lenny compilation : Library...

Should I leave the first authourship of our paper to the student who did the project whereas I solved it?

Random point on a sphere

My research paper filed as a patent in China by my Chinese supervisor without me as inventor

How can I locate a missing person abroad?

Why does F + F' = 1?

How do email clients "send later" without storing a password?

Why should I always enable compiler warnings?

How to stabilise the bicycle seatpost and saddle when it is all the way up?

How do you build a Dominant 7th chord?

Were Roman public roads build by private companies?

Is there a standard terminology for female equivalents of terms such as 'Kingdom' and if so, what are the most common terms?

Will replacing a fake visa with a different fake visa cause me problems when applying for a legal study permit?

Do any aircraft carry boats?

Can the UK veto its own extension request?

The case of the pranking snowplow

Gas pipes - why does gas burn "outwards?"

How can I maximize the impact of my charitable donations?

Georgian capital letter “Ⴒ” (“tar”) in pdfLaTeX

Why would "an mule" be used instead of "a mule"?

Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?

Exact Brexit date and consequences

How to help my 2.5-year-old daughter take her medicine when she refuses to?

A medieval fantasy adventurer lights a torch in a 100% pure oxygen room. What happens?



libzip Linux cross-compile configuration


linux static compilation issueSqueeze/Lenny compilation : Library Link errorHow to install QGIS from source into user space?Cross compile for ARM without installing anythingHow do I install NTP from source on CentOS v7? (/bin/ld: cannot find -lcap)FTDI driver installation problem Linux 64bitgcc build error : cannot find -lssl






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I am trying to cross compile libzip-1.5.1 having previously successfully complied zlib-1.2.11 (these are required by libzip and I have installed in a local home path), but I am experiencing problems with the cmake's process.



The script I use to build and compile (from a build directory into the libzip's sources folder) is the following:



#!/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


But at 94 % of building process, I get the following errors:



[ 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


It seems that cmake cannot find the compiled zlib libraries, even if the paths seems to be well configured (or not ?).



Do some has experienced similar issues with libzip ?
Is there any addition cmake's macro that would solve this issue ?



---- UPDATE ----



I actually get rid of this error suppressing building task for zipcmp, zipmerge and ziptool (since I don't need them) commenting the lines:



#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})


into src/CMakeLists.txt.
Then I compiled the libs using make -j 8 zip and then make install/fast.
It still returns the error



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


but I don't care about it since I have the libs and headers installed in the install dir, and this is what I need.










share|improve this question

































    1















    I am trying to cross compile libzip-1.5.1 having previously successfully complied zlib-1.2.11 (these are required by libzip and I have installed in a local home path), but I am experiencing problems with the cmake's process.



    The script I use to build and compile (from a build directory into the libzip's sources folder) is the following:



    #!/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


    But at 94 % of building process, I get the following errors:



    [ 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


    It seems that cmake cannot find the compiled zlib libraries, even if the paths seems to be well configured (or not ?).



    Do some has experienced similar issues with libzip ?
    Is there any addition cmake's macro that would solve this issue ?



    ---- UPDATE ----



    I actually get rid of this error suppressing building task for zipcmp, zipmerge and ziptool (since I don't need them) commenting the lines:



    #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})


    into src/CMakeLists.txt.
    Then I compiled the libs using make -j 8 zip and then make install/fast.
    It still returns the error



    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


    but I don't care about it since I have the libs and headers installed in the install dir, and this is what I need.










    share|improve this question





























      1












      1








      1








      I am trying to cross compile libzip-1.5.1 having previously successfully complied zlib-1.2.11 (these are required by libzip and I have installed in a local home path), but I am experiencing problems with the cmake's process.



      The script I use to build and compile (from a build directory into the libzip's sources folder) is the following:



      #!/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


      But at 94 % of building process, I get the following errors:



      [ 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


      It seems that cmake cannot find the compiled zlib libraries, even if the paths seems to be well configured (or not ?).



      Do some has experienced similar issues with libzip ?
      Is there any addition cmake's macro that would solve this issue ?



      ---- UPDATE ----



      I actually get rid of this error suppressing building task for zipcmp, zipmerge and ziptool (since I don't need them) commenting the lines:



      #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})


      into src/CMakeLists.txt.
      Then I compiled the libs using make -j 8 zip and then make install/fast.
      It still returns the error



      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


      but I don't care about it since I have the libs and headers installed in the install dir, and this is what I need.










      share|improve this question
















      I am trying to cross compile libzip-1.5.1 having previously successfully complied zlib-1.2.11 (these are required by libzip and I have installed in a local home path), but I am experiencing problems with the cmake's process.



      The script I use to build and compile (from a build directory into the libzip's sources folder) is the following:



      #!/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


      But at 94 % of building process, I get the following errors:



      [ 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


      It seems that cmake cannot find the compiled zlib libraries, even if the paths seems to be well configured (or not ?).



      Do some has experienced similar issues with libzip ?
      Is there any addition cmake's macro that would solve this issue ?



      ---- UPDATE ----



      I actually get rid of this error suppressing building task for zipcmp, zipmerge and ziptool (since I don't need them) commenting the lines:



      #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})


      into src/CMakeLists.txt.
      Then I compiled the libs using make -j 8 zip and then make install/fast.
      It still returns the error



      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


      but I don't care about it since I have the libs and headers installed in the install dir, and this is what I need.







      linux compiling zip cross-compilation cmake






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 '18 at 22:56









      Rui F Ribeiro

      41.5k16 gold badges96 silver badges158 bronze badges




      41.5k16 gold badges96 silver badges158 bronze badges










      asked Nov 8 '18 at 13:41









      simozzsimozz

      3723 silver badges15 bronze badges




      3723 silver badges15 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          this one is important



          SET(CMAKE_SYSTEM_NAME Linux)



          this one not so much



          SET(CMAKE_SYSTEM_VERSION 1)



          specify the cross compiler



          SET(CMAKE_C_COMPILER /your/toolchain/path/bin/yourcompile-gcc)
          SET(CMAKE_CXX_COMPILER /your/toolchain/path/bin/yourcompile-g++)



          where is the target environment



          SET(CMAKE_FIND_ROOT_PATH /your/rootfs/path)



          search for programs in the build host directories



          SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)



          for libraries and headers in the target directories



          SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
          SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)






          share|improve this answer








          New contributor



          saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });















            draft saved

            draft discarded
















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480563%2flibzip-linux-cross-compile-configuration%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            this one is important



            SET(CMAKE_SYSTEM_NAME Linux)



            this one not so much



            SET(CMAKE_SYSTEM_VERSION 1)



            specify the cross compiler



            SET(CMAKE_C_COMPILER /your/toolchain/path/bin/yourcompile-gcc)
            SET(CMAKE_CXX_COMPILER /your/toolchain/path/bin/yourcompile-g++)



            where is the target environment



            SET(CMAKE_FIND_ROOT_PATH /your/rootfs/path)



            search for programs in the build host directories



            SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)



            for libraries and headers in the target directories



            SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
            SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)






            share|improve this answer








            New contributor



            saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


























              0
















              this one is important



              SET(CMAKE_SYSTEM_NAME Linux)



              this one not so much



              SET(CMAKE_SYSTEM_VERSION 1)



              specify the cross compiler



              SET(CMAKE_C_COMPILER /your/toolchain/path/bin/yourcompile-gcc)
              SET(CMAKE_CXX_COMPILER /your/toolchain/path/bin/yourcompile-g++)



              where is the target environment



              SET(CMAKE_FIND_ROOT_PATH /your/rootfs/path)



              search for programs in the build host directories



              SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)



              for libraries and headers in the target directories



              SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
              SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)






              share|improve this answer








              New contributor



              saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                0














                0










                0









                this one is important



                SET(CMAKE_SYSTEM_NAME Linux)



                this one not so much



                SET(CMAKE_SYSTEM_VERSION 1)



                specify the cross compiler



                SET(CMAKE_C_COMPILER /your/toolchain/path/bin/yourcompile-gcc)
                SET(CMAKE_CXX_COMPILER /your/toolchain/path/bin/yourcompile-g++)



                where is the target environment



                SET(CMAKE_FIND_ROOT_PATH /your/rootfs/path)



                search for programs in the build host directories



                SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)



                for libraries and headers in the target directories



                SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
                SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)






                share|improve this answer








                New contributor



                saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                this one is important



                SET(CMAKE_SYSTEM_NAME Linux)



                this one not so much



                SET(CMAKE_SYSTEM_VERSION 1)



                specify the cross compiler



                SET(CMAKE_C_COMPILER /your/toolchain/path/bin/yourcompile-gcc)
                SET(CMAKE_CXX_COMPILER /your/toolchain/path/bin/yourcompile-g++)



                where is the target environment



                SET(CMAKE_FIND_ROOT_PATH /your/rootfs/path)



                search for programs in the build host directories



                SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)



                for libraries and headers in the target directories



                SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
                SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)







                share|improve this answer








                New contributor



                saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share|improve this answer



                share|improve this answer






                New contributor



                saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered 1 hour ago









                saiynsaiyn

                1




                1




                New contributor



                saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                saiyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




































                    draft saved

                    draft discarded



















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480563%2flibzip-linux-cross-compile-configuration%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...