[SOLVED] ZLib And QtCore



  • Hi everyone,

    I'm trying to build a static version of Qt 5.2 (developper, opensource, msvc2010, no exemples, no tests, OpenGL desktop), which i succeeded but when i try to link it with my application which use other frameworks, the build fail with a linker error:

    Qt5Cored.lib(zutil.obj) : error LNK2005: _z_errmsg already defined in...

    So i tried to use the -no-zlib switch but it does not seems no work as the Library is set to:
    ZLIB support............qt

    What can i do to remove this lib from qtcore ? I heard that the -system-zlib does not work on Windows so i haven't tried it yet ...

    Thanks for the reply :)



  • Hi .. can you post the full argument after configure?...
    I know the QtCore need zlib for many section.. aka qCompress

    grep -r "qCompress" *
    corelib/tools/qbytearray.cpp: \fn QByteArray qCompress(const QByteArray& data, int compressionLevel)
    corelib/tools/qbytearray.cpp:QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel)
    corelib/tools/qbytearray.cpp: qWarning("qCompress: Data is null");
    corelib/tools/qbytearray.cpp: qWarning("qCompress: Z_MEM_ERROR: Not enough memory");
    corelib/tools/qbytearray.cpp: This function will uncompress data compressed with qCompress()
    corelib/tools/qbytearray.cpp: \sa qCompress()
    corelib/tools/qbytearray.h:Q_CORE_EXPORT QByteArray qCompress(const uchar* data, int nbytes, int compressionLevel = -1);
    corelib/tools/qbytearray.h:inline QByteArray qCompress(const QByteArray& data, int compressionLevel = -1)
    corelib/tools/qbytearray.h:{ return qCompress(reinterpret_cast<const uchar *>(data.constData()), data.size(), compressionLevel); }
    network/access/qnetworkdiskcache.cpp: are compressed using qCompress. Each cache file starts with "cache_"
    network/access/qnetworkdiskcache.cpp: out << qCompress(data.data());
    tools/rcc/rcc.cpp: qCompress(reinterpret_cast<uchar *>(data.data()), data.size(), m_compressLevel);



  • Well I used the usual ones i think, from the wiki and other sources...
    -developer-mode
    -opensource
    -platform win32-msvc2010
    -static
    -opengl desktop
    -nomake examples
    -nomake demos



  • here i build static 5.1.1
    qt-everywhere-opensource-src-5.1.1.tar.xz

    on this way..
    ./configure -prefix /opt/icon/ -opensource -static -no-framework -no-xcb -release -silent
    i need this only to build installer or small apps..
    the best performance by qt apps is the shared lib variant...



  • Method 1:
    In the other framework, look for zutil.h and zutil.c .
    Open those files, and rename z_errmsg to z_errmsg2 . Recompile.

    Method 2 (not recommended):
    Tell the compiler to ignore multiple definitions
    @
    cl /FORCE:MULTIPLE
    @



  • thx for your replies,

    it worked fine with the 5.1.0 and 5.1.1 with the same options so i was hoping that it will be ok with the 5.2...

    i see what i can do with the first method thx :)


Log in to reply
 

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