Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#7 Fix linking for test binaries

Unstable_(example)
closed
nobody
None
5
2015-02-13
2011-08-19
kwizart
No

The binaries used by the test are failing to build because there is a missing link flags.
See the patch as an attachment for the fix.

Discussion

  • kwizart
    kwizart
    2011-08-19

    Fix linking for test binaries

     
    Attachments
  • Well, I could understand the part about replacing "bin" with "quazip", although it's installation-specific, so I'd specify the path on the command line instead.

    But what about minizip? Why would anyone need to link to it? QuaZip doesn't depend on it and neither do the tests. Moreover, it will break linking if minizip isn't installed, which is almost always the case on Windows.

     
    • status: open --> pending
     
  • kwizart
    kwizart
    2011-09-12

    If the test binaries don't use -lminizip, then that's more likely that the link flag is missing from libquazip.so.1 itself

    ldd -u -r libquazip.so.1.0
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzGoToFirstFile (continued)
    undefined symbol: unzGoToFirstFile (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzOpen2 (continued)
    undefined symbol: unzOpen2 (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipCloseFileInZipRaw (continued)
    undefined symbol: zipCloseFileInZipRaw (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzGetGlobalInfo (continued)
    undefined symbol: unzGetGlobalInfo (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzReadCurrentFile (continued)
    undefined symbol: unzReadCurrentFile (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unztell (continued)
    undefined symbol: unztell (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipWriteInFileInZip (continued)
    undefined symbol: zipWriteInFileInZip (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzGetCurrentFileInfo (continued)
    undefined symbol: unzGetCurrentFileInfo (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipCloseFileInZip (continued)
    undefined symbol: zipCloseFileInZip (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipOpen2 (continued)
    undefined symbol: zipOpen2 (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzeof (continued)
    undefined symbol: unzeof (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzGoToNextFile (continued)
    undefined symbol: unzGoToNextFile (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzGetGlobalComment (continued)
    undefined symbol: unzGetGlobalComment (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzClose (continued)
    undefined symbol: unzClose (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipOpenNewFileInZip3 (continued)
    undefined symbol: zipOpenNewFileInZip3 (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzOpenCurrentFile3 (continued)
    undefined symbol: unzOpenCurrentFile3 (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: unzCloseCurrentFile (continued)
    undefined symbol: unzCloseCurrentFile (./libquazip.so.1.0)
    13298: ./libquazip.so.1.0: error: symbol lookup error: undefined symbol: zipClose (continued)
    undefined symbol: zipClose (./libquazip.so.1.0)
    Unused direct dependencies:

    /lib64/libpthread.so.0
    /lib64/libm.so.6
    

    For the search path ../../bin reference the build tree which match the source tree in my case, but there is no installation step involved yet.

    Thx

     
  • kwizart
    kwizart
    2011-09-12

    • status: pending --> open
     
  • None of the QuaZIP components use minizip. Minizip is a non-Qt alternative to QuaZIP, not a dependency. All the symbols you see here belong to QuaZIP itself (zip.c and unzip.c modules), and it's quite weird that they are not found. Which OS, compiler? Any additional configuration involved?

    Linking to Minizip probably helps (somewhat) since Minizip is exactly what QuaZIP was built upon, so the symbol names are the same. However, there were some modifications to the Minizip sources, and the latest versions of QuaZIP can't use Minizip directly even if you link to it, because the API is slightly different (in particular, added support for reading ZIP files through QIODevice API). So it simply won't work, even if it links.

    As for the "bin" part, it's platform dependent (for example, on Windows binaries go to "debug" and "release" subdirectories). I have tried once to set it up for different platforms, but it wasn't very consistent, so I'd just advise to use qmake command line options instead, like this:

    qmake LIBS+=-L../../quazip

    Note that this doesn't apply to the current QuaZIP version anyway, since test subprojects were replaced by one single project using QTestLib, which is much more elegant and robust.

     
    • status: open --> pending
     
  • kwizart
    kwizart
    2011-09-15

    Ok for the bin part with current version (but not yet tested).

    For the missing symbols, I'm using current gcc 4.5.1 with some prep options for the gold linker:
    https://fedoraproject.org/wiki/GoldTransition
    (aka: up to date Fedora 14 build chain).

    If I'm using alternatives --config ld set to ld.gold, I've now:
    g++ -Wl,-O1 -o unzip main.o -L/usr/lib64 -L../../bin -lquazip -lQtCore -lpthread
    /usr/bin/ld: main.o: in function testRead():main.cpp:17: error: undefined reference to 'QuaZip::QuaZip(QIODevice*)'
    /usr/bin/ld: main.o: in function testRead():main.cpp:19: error: undefined reference to 'QuaZip::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:22: error: undefined reference to 'QuaZip::setFileNameCodec(char const*)'
    /usr/bin/ld: main.o: in function testRead():main.cpp:48: error: undefined reference to 'QuaZipFile::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:76: error: undefined reference to 'QuaZipFile::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:85: error: undefined reference to 'QuaZipFile::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:91: error: undefined reference to 'QuaZip::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:44: error: undefined reference to 'QuaZipFile::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:33: error: undefined reference to 'QuaZip::getZipError() const'
    /usr/bin/ld: main.o: in function testRead():main.cpp:92: error: undefined reference to 'QuaZip::getZipError() const'
    /usr/bin/ld: main.o: in function testCase():main.cpp:179: error: undefined reference to 'QuaZip::setFileNameCodec(char const*)'
    collect2: ld returned 1 exit status
    make[1]: *** [unzip] Error 1

    About 0.4.3:
    g++ -Wl,-O1 -shared -Wl,-soname,libquazip.so.1 -o libquazip.so.1.0.0 .obj/JlCompress.o .obj/qioapi.o .obj/quaadler32.o .obj/quacrc32.o .obj/quazip.o .obj/quazipfile.o .obj/quazipnewinfo.o .obj/moc_quazipfile.o -L/usr/lib64 -lz -lQtCore -lpthread
    ln -s libquazip.so.1.0.0 libquazip.so
    ln -s libquazip.so.1.0.0 libquazip.so.1
    ln -s libquazip.so.1.0.0 libquazip.so.1.0
    make[1]: Leaving directory `/home/builder/rpmbuild/BUILD/quazip-0.4.3/quazip'
    cd test/unzip/ && /usr/lib64/qt4/bin/qmake /home/builder/rpmbuild/BUILD/quazip-0.4.3/test/unzip/unzip.pro PREFIX=/usr -o Makefile
    Cannot find file: /home/builder/rpmbuild/BUILD/quazip-0.4.3/test/unzip/unzip.pro.
    make: *** [test/unzip/Makefile] Error 2

     
  • kwizart
    kwizart
    2011-09-15

    • status: pending --> open
     
  • There's something wrong with your setup, but I don't know what it is. I vaguely remember something like that happening to me with some other code. I solved this by adding another -l flag to the linker options. I have no idea why it helped, but you could try it as well by running

    qmake LIBS+=-lquazip

    before building.

     
    • status: open --> pending
     
    • status: pending --> closed
    • Group: --> Unstable_(example)