Quazip not building up: Throwing "Undefined symbols for architecture x86_64"



  • I am trying to build the QuaZip library in QT Creator 2.4.1 in a MAC 10.7.2 system without making any changes to the project at all, but i am getting the following error

    Undefined symbols for architecture x86_64:
    @
    "inflateInit2", referenced from:
    _unzOpenCurrentFile3 in unzip.o
    "_get_crc_table", referenced from:
    _unzOpenCurrentFile3 in unzip.o
    _zipOpenNewFileInZip3 in zip.o
    "_crc32", referenced from:
    _unzReadCurrentFile in unzip.o
    _zipWriteInFileInZip in zip.o
    QuaCrc32::update(QByteArray const&) in quacrc32.o
    QuaCrc32::reset() in quacrc32.o
    QuaCrc32::calculate(QByteArray const&) in quacrc32.o
    "_inflate", referenced from:
    _unzReadCurrentFile in unzip.o
    "_inflateEnd", referenced from:
    _unzCloseCurrentFile in unzip.o
    "deflateInit2", referenced from:
    _zipOpenNewFileInZip3 in zip.o
    "_deflate", referenced from:
    _zipWriteInFileInZip in zip.o
    _zipCloseFileInZipRaw in zip.o
    "_deflateEnd", referenced from:
    _zipCloseFileInZipRaw in zip.o
    "_adler32", referenced from:
    QuaAdler32::update(QByteArray const&) in quaadler32.o
    QuaAdler32::reset() in quaadler32.o
    QuaAdler32::calculate(QByteArray const&) in quaadler32.o
    ld: symbol(s) not found for architecture x86_64

    collect2: ld returned 1 exit status
    make: Leaving directory `/Users/vikram.sridhar/Documents/Workspace/quazip-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Debug'
    make: *** [libquazip.1.0.0.dylib] Error 1
    13:37:14: The process "/usr/bin/make" exited with code 2.
    Error while building project quazip (target: Desktop)
    When executing build step 'Make'@



  • It means that this library can't be built on your system.



  • The error means that the linker is trying to find the code for some symbols, but fails to do so. The lib (zlib) is installed on your system, otherwise the compiler would have bailed out already (due to missing include files). Fortunately the solution is easy: The developers forgot to include linkage to zlib in the .pro file, so just add to the file mvim quazip/quazip.pro the following line in the unix scope:

    @
    LIBS += -lz
    @

    The complete snippet that works for me (I had the very same errors on a 10.6 Mac box) is:

    @
    unix:!symbian {
    headers.path=$$PREFIX/include/quazip
    headers.files=$$HEADERS
    target.path=$$PREFIX/lib
    INSTALLS += headers target
    // the following line needs to be added
    LIBS += -lz

    OBJECTS_DIR=.obj
    MOC_DIR=.moc

    }
    @



  • Volker, you just saved me after a weekend of pain ... was having exactly the same issue, couldn't figure it out.

    Was even considering completely different approaches ... thank you so much!



  • You're welcome - that's what these forums have been made for :-)



  • Hi,Volker. I'm a novice in using Qt creator. I have the same problem which confused me for two days. Thank you so much for your answer. Thank you !



  • Thanks, Volker, for the information about needing to add "LIBS += -lz". That worked perfectly, and saved me a lot of time!



  • Thank you Volker



  • Thank you Wolker this help me too. I'm fresh on Mac and some erro messages get me on the wrong way



  • Thank you Wolker this help me too. I'm fresh on Mac and some erro messages get me on the wrong way


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.