2 Attachment(s)
[win32, MinGW] Qt5 does not find external libraries that works in Qt4
Hello, I do my main development in Linux and time to time (years) I do a compilation in Windows.
In my windows machine I had Qt 4.8 with gcc 4.6. I compiled, long time ago and using gcc 4.6, some external libraries and my old code works fine.
Now I wanted to compile in windows my new code, that in the meantime has been ported to Qt5.
So in the windows machine I installed, in an other folder, Qt5, that now comes shipped directly each version of Qt with its own MinGW. For example I have Qt5.2.1 with its DOS prompt set to work with gcc 4.8.
My project uses some external libraries that have been compiled from source in windows using gcc 4.6 (and it was a mess, so I would really like to avoid to recompile them if possible).
My qt project file instructs the linker to use them with the following lines:
Code:
win32 {
INCLUDEPATH += win32/include/coin
INCLUDEPATH += win32/include/coin/ThirdParty
INCLUDEPATH += win32/include
INCLUDEPATH += win32/include/adolc
INCLUDEPATH += $$[QT_INSTALL_DATA]/src/3rdparty/zlib
LIBS += -L win32/lib -lipopt
LIBS += -L win32/lib -lcoinmetis
LIBS += -L win32/lib -lcoinmumps
LIBS += -L win32/lib -lcoinhsl
LIBS += -L win32/lib -lcoinblas
LIBS += -L win32/lib -lcoinlapack
LIBS += -L win32/lib -ladolc
LIBS += -lpthread -lgfortran -lcoinmetis -lcoinblas
CONFIG += exceptions
}
The problem is that when I run make, I got, in Qt5, the following error:
Attachment 11397
When I run the old software, with the same configuration and using the Qt4 prompt, I don't have instead any linking problem:
Attachment 11398
Could it be a different way of including external libraries in a project in Qt5 compared to Qt4? Or because the external libraries have been compiled with gcc 4.6 and are hence not recognised by the gcc 4.8 used with the new Qt5 ??
Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4
On first screenshot I see "permission denied" error.
1 Attachment(s)
Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4
Here is a complete screenshot with the directory structure, the content of the .pro file and the link error (the first post didn't include the ThirdParty subdirectory, as it was one of the many tests I did). As you can see the lib files are there, and I am using a windows XP virtual machine with no particular permissions set.. and the Qt4 version, with an analogue structure, works.. Is it changed something in Qt5 compared to Qt4 in the way external libraries have to be declared in the project?
Thank you very much and sorry to bother you..
Attachment 11400
Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4
You are using relative paths in your LIBS and building the code in a shadow build directory. It seems likely/possible that the libraries are not in the same relative location at link time. Try an absolute path
Code:
LIBS += -Lc:/full/path/to/ThirdParty/...
LIBS += -lipopt \
-lcoinmetis \
-lcoinmumps \
...
If the libraries have C++ interfaces then you will most likely have to build them again.
Re: [win32, MinGW] Qt5 does not find external libraries that works in Qt4
Thank you, setting the full path in -L works. I also solved a problem with zlib (Qt5 doesn't ship with it any more like in Qt4). Unfortunately my libraries, compiled with an older version of MinGW, crash, so I need to recompile them..
Thank you