ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
338 stars 90 forks source link

Object Viewer Qt Plugin #85

Closed ryzom-pipeline closed 10 years ago

ryzom-pipeline commented 10 years ago

Original report by Юрий Шернин (Bitbucket: 59RuUser, ).


Hi Please help VC10-11 Qt v4.7.4 Object Viewer Qt Plugin - Georges Editor zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - Landscape Editor zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - Mission Compiler zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - Object Viewer zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - Object Viewer zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - Translation Manager zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

Object Viewer Qt Plugin - World Editor zlib.lib(gzread.obj) : error LNK2005: _gzread уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzopen уже определен в QtCore4.lib(QtCore4.dll) zlib.lib(gzlib.obj) : error LNK2005: _gzdopen уже определен в QtCore4.lib(QtCore4.dll)

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


The problem seems to come from Qt that exports zlib symbols publicly (he shouldn't do that). Did you compile Qt yourself ? If yes, I suggest you to use "-system-zlib" when building Qt.

Perhaps this bug has been fixed in new Qt versions.

ryzom-pipeline commented 10 years ago

Original comment by Юрий Шернин (Bitbucket: 59RuUser, ).


Thanks!

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


You're welcome :) I also had this error some time ago, that's why I prefer to compile Qt myself now.

ryzom-pipeline commented 10 years ago

Original comment by Юрий Шернин (Bitbucket: 59RuUser, ).


Hi sorry new problem VC10 Qt v4.7.4 Object Viewer Qt Plugin - Landscape Editor builder_zone.obj : error LNK2001: неразрешенный внешний символ ""__declspec(dllimport) public: class stlpx_std::basic_string<char,class stlpx_std::char_traits,class stlpxstd::allocator > thiscall QString::toStdString(void)const " (imp?toStdString@QString@@QBE?AV?$basic_string@DV?$char_traits@D@stlpx_std@@V?$allocator@D@2@@stlpx_std@@XZ)" C:\Ryzom\code\build\bin\Release\ovqt_plugin_landscape_editor_r.dll : fatal error LNK1120: неразрешенных внешних элементов: 1

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Thanks for the report, I thought I already fixed all of them :( I'll commit a fix soon :)

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Fixed: #85 Compilation with STLport

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


It should be fixed with last commit :)

ryzom-pipeline commented 10 years ago

Original comment by Юрий Шернин (Bitbucket: 59RuUser, ).


Now everything works! Thank you for your work!

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


You're welcome :)

ryzom-pipeline commented 10 years ago

Original comment by S (Bitbucket: S, GitHub: S).


Cédric OCHS Which version of QT do you use ? Which option do you pass to configure fot building QT (for zlib and so on ?)

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


For Ryzom, I use an old Qt 4.8.2 :)

I didn't keep the exact command line to compile Qt, but I'm pretty sure I used at least : "-openssl -system-zlib -system-libpng -system-libjpeg -I d:/External/vc10/qt-compil/include -L d:/External/vc10/qt-compil/lib64" to be sure Qt is linked to the same libraries as Ryzom Core

ryzom-pipeline commented 10 years ago

Original comment by S (Bitbucket: S, GitHub: S).


Ok thx!

But if you set -system-zlib -system-libpng -system-libjpeg QT will not be build with external dependencies like png and jpeg used by Ryzom ?

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


"-system-x" flags mean Qt won't be using sources bundled with Qt, but it'll use -I for includes and -L for libs to search the right files. The previous problem occurred because NeL and Qt are linked against different versions of the same libs :(

So if you put the right directories for headers and libraries, Qt should be build using the same files as NeL.

ryzom-pipeline commented 10 years ago

Original comment by S (Bitbucket: S, GitHub: S).


Ok I understand. And the last big question, do we have to build QT with stlport ? or not ? Or just use the stl of the builder ? Do a tool built with stlport will link to QT build with stl (non stlport) ?

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


You don't need anymore to compile Qt with STLport, because I removed all QString <> std::string conversions so even without STLport it should link without problem :)

ryzom-pipeline commented 10 years ago

Original comment by Raster Ron (Bitbucket: rasteron, GitHub: rasteron).


Hi, I tried following your guide above with Qt 4.8.2 source, my setup is x86 build:

C:\Qt\4.8.2>configure -openssl -system-zlib -system-libpng -system-libjpeg -I c: /ryzom/external/include -L c:/ryzom/external/lib

It configures ok, after running nmake I get this error:

LINK : fatal error LNK1181: cannot open input file 'zdll.lib' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0 \VC\BIN\link.EXE"' : return code '0x49d' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0 \VC\BIN\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.

I'm using the external libraries from external_vc10.7z package.

Any ideas?

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


In fact, you can't specify library names to Qt, so the only fix I have to propose is to copy the existing libs to the name Qt expect to find.

Another fix should be to modify Qt makefiles to link to the correct libs, but it's longer to do :)

ryzom-pipeline commented 10 years ago

Original comment by Raster Ron (Bitbucket: rasteron, GitHub: rasteron).


Ok thanks :-). BTW, are there any latest documentation/link to do this step by step? I have no problem building client/server in windows, just the tools particularly QT.

I see the external library only has zlib.lib. Is this the one to use with QT?

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Yes, it's zlib.lib and I don't think there are documentation about Qt tools compilation because a few people are compiling them themselves.

ryzom-pipeline commented 10 years ago

Original comment by Raster Ron (Bitbucket: rasteron, GitHub: rasteron).


Yes, I was hoping for that myself to test out a ready made windows toolset binaries. But I notice in the sourceforge repo files the tools are already outdated (2012).

I would like to try out the landscape editor but could not find a working Object Viewer QT, since this is the only version I can find. Could you at least provide a latest binary version download for these tools?

Thanks.

ryzom-pipeline commented 10 years ago

Original comment by Raster Ron (Bitbucket: rasteron, GitHub: rasteron).


Ok changing the zlib.lib to zdll.lib works. I have omitted the libjpeg and libpneg flags because it's throwing CMake and VC errors so I use QT's instead and it works great. Thanks!

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


You're welcome :) Yes, I really think that's a bug with exported zlib functions :( All other 3rd party libs don't have this bug :)

ryzom-pipeline commented 10 years ago

Original comment by Łukasz K. (Bitbucket: maczuga, GitHub: maczuga).


2 questions to You guys.

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


In fact, to not have conflicts with other 3rd party libs, I suggest to create a new directory (E:\ryzom\external_qt) with externals QT should use (only OpenSSL and zlib files) and specify these directories to -I and -L parameters.

ryzom-pipeline commented 10 years ago

Original comment by Łukasz K. (Bitbucket: maczuga, GitHub: maczuga).


Open source version worked fine for me for Qt errors. I was still getting linker errors, but I managed to fix it.

Solution for - error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Go to Project Properties -> Configuration Properties -> Linker -> Advanced Put "main" to the "Entry Point" field.

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


I don't know what changed, but it should link to qtmain(d).lib :(

ryzom-pipeline commented 10 years ago

Original comment by Raster Ron (Bitbucket: rasteron, GitHub: rasteron).


same thing with me. But I just inserted /ENTRY:"mainCRTStartup" in the commandline linker box. As Łukasz K. pointed out, this happens on ObjectViewer QT main exe, Ryzom Configuration Tool and Georges Editor QT build.

ryzom-pipeline commented 10 years ago

Original comment by Łukasz K. (Bitbucket: maczuga, GitHub: maczuga).


Also, for future users, I have also found that installing gnuwin32 zlib library also fixes zlib errors.