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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fix linking for test binaries
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.
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:
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
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.
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
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.