Menu

#61 Error building the tests

v1.0_(example)
closed-invalid
nobody
None
5
2015-08-17
2015-08-17
hilt2
No

%qt%\qtbase\bin\qmake.exe CONFIG+=staticlib CONFIG+=release INCLUDEPATH=%zlib% LIBS+=-L%zlib% LIBS+=-lz
"%mingww64%\bin\mingw32-make.exe"

the above commands lead to this (the library itself is created)

.......
g++ -Wl,-s -Wl,-subsystem,console -static -mthreads -o release\qztest.exe object_script.qztest.Release -LC:\windows-package-manager.npackd-scripts\build-pa
ckages\zlib32static -lz -LC:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest/../quazip/release/ -lquazip -LC:/Np
ackdSymlinks/com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5/qtbase/lib -lQt5Test -LC:/NpackdSymlinks/com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5/qtbase/plu
gins/bearer -lqgenericbearer -lqnativewifibearer -lQt5Network -ldnsapi -lQt5Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lqt
pcre
./.obj\qztest.o:qztest.cpp:(.text+0xd66): undefined reference to __imp__ZN6QuaZip16setFileNameCodecEP10QTextCodec' ./.obj\qztest.o:qztest.cpp:(.text+0xd7c): undefined reference toimpZN6QuaZip4openENS_4ModeEP19zlib_filefunc_def_s'
./.obj\qztest.o:qztest.cpp:(.text+0xf13): undefined reference to __imp__ZN10QuaZipFileC1EP6QuaZipP7QObject' ./.obj\qztest.o:qztest.cpp:(.text+0xf7d): undefined reference toimpZN13QuaZipNewInfoC1ERK7QStringS2_'
./.obj\qztest.o:qztest.cpp:(.text+0xff3): undefined reference to `impZN10QuaZipFile4openE6QFlagsIN9QIODevice12OpenModeFlagEERK13QuaZipNewInfoPKcjiibiii'

./.obj\qztest.o:qztest.cpp:(.text+0x1096): undefined reference to __imp__ZN10QuaZipFile5closeEv' ./.obj\qztest.o:qztest.cpp:(.text+0x115f): undefined reference toimpZN10QuaZipFileD1Ev'
./.obj\qztest.o:qztest.cpp:(.text+0x11f8): undefined reference to __imp__ZN6QuaZip10setCommentERK7QString' ./.obj\qztest.o:qztest.cpp:(.text+0x122c): undefined reference toimpZN6QuaZip5closeEv'
./.obj\qztest.o:qztest.cpp:(.text+0x154f): undefined reference to __imp__ZN10QuaZipFileD1Ev' ./.obj\qztest.o:qztest.cpp:(.text+0x1a47): undefined reference toimpZN10QuaZipFileD1Ev'
./.obj\qztest.o:qztest.cpp:(.text+0x1c30): undefined reference to __imp__ZN6QuaZipC1EP9QIODevice' ./.obj\qztest.o:qztest.cpp:(.text+0x1c87): undefined reference toimpZN6QuaZipD1Ev'
./.obj\qztest.o:qztest.cpp:(.text+0x1cca): undefined reference to __imp__ZN6QuaZipD1Ev' ./.obj\qztest.o:qztest.cpp:(.text+0x1d03): undefined reference toimpZN6QuaZipC1ERK7QString'
./.obj\qztest.o:qztest.cpp:(.text+0x1d24): undefined reference to __imp__ZN6QuaZipD1Ev' ./.obj\qztest.o:qztest.cpp:(.text+0x1d3d): undefined reference toimpZN6QuaZipD1Ev'
C:/ProgramFiles/MinGW-w64_x86_64_SEH_POSIX_threads-4.9.2/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: ./.obj\qztest.o:
bad reloc address 0x18 in section `.text$_ZN10QByteArrayD1Ev[_ZN10QByteArrayD1Ev]'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:133: recipe for target 'release\qztest.exe' failed
mingw32-make[2]: [release\qztest.exe] Error 1
mingw32-make[2]: Leaving directory 'C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest'
Makefile:34: recipe for target 'release' failed
mingw32-make[1]:
[release] Error 2
mingw32-make[1]: Leaving directory 'C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest'
makefile:64: recipe for target 'sub-qztest-make_first' failed
mingw32-make: *** [sub-qztest-make_first] Error 2
C:\windows-package-manager.npackd-scripts\build-packages\QuaZIP-static-x86_64-w32-0.7.1>

Discussion

  • Sergey A. Tachenov

    You need DEFINES+=QUAZIP_STATIC. See README.txt

     
  • Sergey A. Tachenov

    • status: open --> closed-invalid
     
  • hilt2

    hilt2 - 2015-08-17

    this helps, but now there is another error. The build script is here: https://github.com/tim-lebedkov/npackd-scripts/blob/master/build-packages/quazip-dev-x86_64-w64-static-0.7.1.bat

    The output is this:
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQUAZIP_STATIC -DNOMINMAX -DQT_NO_DEBUG -DQT_NETWORK_LIB
    -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest\"" -
    I. -I. -I....\QuaZIP-static-x86_64-w32-0.7.1 -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include -I........\Npackd
    Symlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include\QtNetwork -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\q
    tbase\include\QtTest -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include\QtCore -I.moc -I........\NpackdSymlinks\co
    m.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\mkspecs\win32-g++ -o .obj\moc_testquazipnewinfo.o .moc\moc_testquazipnewinfo.cpp
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQUAZIP_STATIC -DNOMINMAX -DQT_NO_DEBUG -DQT_NETWORK_LIB
    -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR="\"C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest\"" -
    I. -I. -I....\QuaZIP-static-x86_64-w32-0.7.1 -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include -I........\Npackd
    Symlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include\QtNetwork -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\q
    tbase\include\QtTest -I........\NpackdSymlinks\com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\include\QtCore -I.moc -I........\NpackdSymlinks\co
    m.nokia.QtDev-x86_64-w64-Npackd-Release-5.5\qtbase\mkspecs\win32-g++ -o .obj\moc_testquazipfileinfo.o .moc\moc_testquazipfileinfo.cpp
    g++ -Wl,-s -Wl,-subsystem,console -static -mthreads -o release\qztest.exe object_script.qztest.Release -LC:/windows-package-manager.npackd-scripts/build-pa
    ckages/QuaZIP-static-x86_64-w32-0.7.1/qztest/../quazip/release/ -lquazip -LC:/NpackdSymlinks/com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5/qtbase/lib -lQt5T
    est -LC:/NpackdSymlinks/com.nokia.QtDev-x86_64-w64-Npackd-Release-5.5/qtbase/plugins/bearer -lqgenericbearer -lqnativewifibearer -lQt5Network -ldnsapi -lQt5
    Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lqtpcre
    ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0xac): undefined reference to gzopen' ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0xc4): undefined reference togzwrite'
    ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0xcc): undefined reference to gzclose' ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0x8ab): undefined reference togzopen'
    ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0x8d4): undefined reference to gzread' ./.obj\testquagzipfile.o:testquagzipfile.cpp:(.text+0x94f): undefined reference togzclose'
    C:/ProgramFiles/MinGW-w64_x86_64_SEH_POSIX_threads-4.9.2/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: ./.obj\testquagz
    ipfile.o: bad reloc address 0x14 in section `.xdata'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:133: recipe for target 'release\qztest.exe' failed
    mingw32-make[2]: [release\qztest.exe] Error 1
    mingw32-make[2]: Leaving directory 'C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest'
    Makefile:34: recipe for target 'release' failed
    mingw32-make[1]:
    [release] Error 2
    mingw32-make[1]: Leaving directory 'C:/windows-package-manager.npackd-scripts/build-packages/QuaZIP-static-x86_64-w32-0.7.1/qztest'
    makefile:64: recipe for target 'sub-qztest-make_first' failed
    mingw32-make: *** [sub-qztest-make_first] Error 2
    C:\windows-package-manager.npackd-scripts\build-packages\QuaZIP-static-x86_64-w32-0.7.1>quazip-dev-x86_64-w64-static-0.7.1.bat

     
  • Sergey A. Tachenov

    Now you forgot to link to zlib, of course you get undefined references to zlib functions. You need LIBS+=-lsomething, LIBS+=-Lsomething and possibly DEFINES+=ZLIB_WINAPI if you decide to use Winapi zlib version.