I am trying to set up Marble to work with Qt 5.5 on OSX. I'm not very experienced with the details of linking and such and I think that is causing the problem I am having.
Question: Did I screw up the 'marble` install or is this an easily solved linking issue?
Qt 5.5 is installed in my user directory (using Qt's network installer) on a system running OSX 10.9.5. It works fine. I followed the instructions on the Marble site to clone, build and install from source with (I believe) the appropriate Qt flags. That seemed to go without issue. When I try to build the simple test app listed here, the #include <marble/MarbleWidget.h> line gives a "file not found" error.
After the install I've ended up with the following:
A "marble" directory in my root user folder
A "Marble.app" file along with various other marble related files in the bin and include directories. However the Marble.app gives the following error on launch:
Dyld Error Message: Library not loaded:
#rpath/QtCore.framework/Versions/5/QtCore Referenced from:
/usr/local/Marble.app/Contents/MacOS/marble-qt Reason: image not
found
Binary Images:
0x7fff6a1f9000 - 0x7fff6a22c817 dyld (239.4) <7AD43B9B-5CEA-3C7E-9836-A06909F9CA56> /usr/lib/dyld
So a semi-solution: I used the Qt Creator "add Library" function and ended up with the following additions to the .pro file. I had to paste in the link to the lib since the dialog doesn't allow browsing of "usr/local/". Also, although I tried to link to the lib alias ("libmarblewidget-qt5.dylib"), the actual lib name is used.
macx: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lmarblewidget-qt5.0.21.80
INCLUDEPATH += $$PWD/../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../usr/local/include
I don't understand what this $$PWD/../../../../../ business is.
But it worked and I am able to run the example code at the link in my question.
I wish this install/build stuff wasn't so damned arcane. I've spent endless hours just trying to get things set up – really sucks the joy out of exploring this stuff and I can't say I really learned much of anything from it.
Update
So I cleaned out the "$$PWD" crap and the literal lib name and it works. Not sure what difference it makes – but there you go.
macx: LIBS += -L/usr/local/lib/ -lmarblewidget-qt5
INCLUDEPATH +=/usr/local/include
DEPENDPATH +=/usr/local/include
Either the build is faulty or you need a different version of Qt installed to run it. Usually the app has the Qt libraries that it needs wrapped up in the app itself. If it's not in there it will search your mac for it. The message says that QtCore can't be found in either place. If you look inside Google's Google Earth, you can see where the libraries are stored. You can also copy a version of QtCore into your Marble to see if it will work.
Related
I am new to Qt so I follow a tutorial on QML. It starts with a basic qml file which should be run with qmlviewer.
The problem is that when I start qmlviewer it says
qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file or directory
whereis qmlviewer tells me that it's location is /usr/bin/qmlviewer so I try to run it with this absolute path, but I still get the same error
qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file or directory
Why is it still looking for that location ? How can I solve this ?
I should mention that I have tried qtconfig just for testing, and I still get the error, so this is a global Qt problem.
Thank you
As said in the documentation : http://doc.qt.io/qt-5/qtquick-porting-qt5.html
The qmlviewer tool provided for prototyping and testing QML
applications in Qt 4.x has been replaced with the qmlscene tool which
integrates with the new scenegraph features in Qt 5.
So using qmlscence all works.
I know that there are few topics on the Internet about QPSQL driver not loaded problem but none of the solutions have helped me.
Let's start from the beggining. This is what I'm using:
Windows 7 x64
PostgreSQL 9.3
QtCreator 2.4.1
Based on Qt 4.7.4 (32 bit)
First of all I've tried to use tutorial from http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql . The problem with that solution is that cd %QTDIR% command result is changing my working directory to C:\QtSDK\Desktop\Qt\4.7.4\mingw which has not any src directory but fortunately has got plugins\sqldrivers. Unfortunately there is no folder pqsl. Even if I ignore that problem and skip into next step - qmake "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro it shows me that it cannot find file psql.pro and there is no psql.pro file in my whole Qt directory. I've decided to leave that solution and to find another one.
Somewhere in the Web I've found that I need to write those lines into my .pro file:
INCLUDEPATH += $$quote(C:/Program Files/PostgreSQL/9.3/include)
LIBS += -L$$quote(C:/Program Files/PostgreSQL/9.3/lib)
I've done that. But the driver not loaded problem is still appearing.
What should I do. Am I missing something?
If it helps after running
qDebug() << QSqlDatabase::drivers();
command it displays only ("QSQLITE")
P.S. I hope that my problem is understandable - english is not my native language.
Over a week now I tried to implement every Cryptography-Library I could possibly find into QT to encrypt files and strings, but it just seems to be impossible for me.
I started with a clean Ubuntu-Installation, updated everything, installed QT and as Openssl is allready installed on Ubuntu, I tried to start with that.
I've read some tutorials, tried some examples, but nothing I did seemed to solve my "undefined reference" problem.
I googled for the right libs I maybe had to add to the project file, but nothing worked.
As Openssl didn't work for me, I googled my way through "QCA", "Crypto++", "MCrypt" and some public librarys I found.
With the first three I got the "undefined reference" errors again and the other librarys either had depracted code or wrong conversions between data types in the code itself.
I'm new to the whole cryptographic stuff, but I can't get it to work at all.
It would just be awesome if someone could release me from my pain and help me to get ANY library working from a clean ubuntu installation with QT.
I just have to do something wrong....it can't be that the tutorials I found on the web are working just fine for everbody else.
As an example....I installed the packages "libmcrypt-dev", "libmcrypt4" and "mcrypt" and followed the code example here: mcrypt linux how to use rijndael 256 cbc
The include works fine, the header file can be found and the code for the mcrypt classes is highlighted, so it should work, right?
But as I try to compile the code, I get "undefined reference" errors in every line that uses a function from mcrypt.
This also happened with all the other librarys....though I can't find anything missing that others did.
No additional includes are stated anywhere nor any additional library-references which I'd have to include in the project file.
What am I doing wrong?
I fear I don't really have anything to show you guys either, except you want to see a huge list with "undefined reference" errors. :-/
If I try something like that:
#include <mcrypt.h>
int main()
{
MCRYPT td = mcrypt_module_open("rijndael-256", NULL, "cbc", NULL);
mcrypt_module_close(td);
}
I get the following errors
error: undefined reference to `mcrypt_module_open'
error: undefined reference to `mcrypt_module_close'
Project file:
QT += core
QT -= gui
TARGET = untitled
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
error: undefined reference says, that linker can not find library itself. It has headers files, that you have included, but does not see source. To fix this, you have to tell linker, where the sources are, so add in your *.pro file add line, for example like this for libmcrypt library:
LIBS += -L/path/to -lmcrypt
In linux, if you have installed with apt-get install or something similar, -L usually is not needed
I created a C++ library project in Qt creator. After building the project I have the libMylib.so, .so.1, .so.1.0, .so.1.0.0, Makefile and mylib.o files. I added the library headers to my other project and added the path to my .pro file like this:
LIBS += "/home/peter/Workspace/build-Libtester-Desktop-Release/libMyLib.so"
When building the application I don't get no such file error, but when running it I get this:
/home/peter/Workspace/build-Libtester-Desktop-Debug/Libtester: error while loading shared libraries: libMyLib.so.1: cannot open shared object file: No such file or directory
which I can't understand, because it's right there next to the .so which it seem to find, because when the path is wrong I get a no such file or directory error when trying to build the project.
Could someone explain what I'm missing here?
Thanks for your time.
Fortunately, your problem has nothing to do with both Qt and Qt Creator. The error simply boils down to how shared libraries are searched by LD for dynamic linking on Unix OS family.
Today, I've answered similar question, have a look, please. This question was asked in regard to Mac OS X. However, Linux and Mac OS X are the same in the context of your problem. I've provided additional explanation for Linux at the bottom, so pay attention to it. "it's right there next to the .so" - you seem to have Windows background if you make this assumption, but it is wrong for Unix OS family altogether (as stated in the answer too). If you have further questions, just ask.
You are adding the library incorrectly. You are doing:
LIBS += "/home/peter/Workspace/build-Libtester-Desktop-Release/libMyLib.so"
instead of:
LIBS += -L"/home/peter/Workspace/build-Libtester-Desktop-Release" -lMyLib
The first version works on windows, but not linux.
Basically, you create a library, which will be named "libMyLib.so", and then you specify the path to its folder, prepended by "-L" and then do "-lMyLib" at the end, note that it's not "-llibMyLib", but just "-lMyLib", despite the fact that the .so name is "libMyLib".
Look here: https://wiki.qt.io/How_to_create_a_library_with_Qt_and_use_it_in_an_application for more info.
So I have installed the QtSDK on my Windows 7 64 bit machine. However, it seems like when I try to run a simple program like hello world such as:
#include <iostream>
int main(....) {
std::cout << "Hello World\n";
}
My program first gets the error:
CreateProcess: No Such file or directory.
So what I did was I went to this link here:
http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista
And I first tried to add the directory to the
PATH: C:\MinGW\libexec\gcc\mingw32\MinGW-Version
(my directory is slightly different but follows same idea)
where MinGW-Version is the Version of MinGW you are using
So now that got rid of that error but now I get the error:
iostream: No such file or directory
So now I add the path where the iostream library is and that fixes that error but then I get all these other errors where it can't find other standard C++ libraries such as stddef.h or stdio.h etc. So it seems as if the C++ libraries cannot be linked to. I have tried various other things such as including C:\MinGW\bin in my path and have tried uninstalling and reinstalling Qt. Also I have checked that Qt is using the right gcc compiler by going to Tools->Options->Toolchains in Qt Creator.
It seems that the linking to C++ libraries is not correct for some reason. Could anyone help me or guide me as to why this may be happening and how to fix this?
I'm not sure why it's not working, so I'll just tell you how my environment is set up. I don't think you need to add any library paths to the system path. You should only need to add C:\MinGW\bin.
So get rid of everything except for that. Also, are you setting this through cmd or control panel? If doing it in the control panel, make sure you are putting it in the "Path" variable not "PATH" -> the former is in the lower box. I've had problems before using "PATH" in the upper box - not sure what the difference is to be honest.
The QtSDK installation usually install the mingw compiler for you in ...\QtSDK\mingw. The libraries and dlls in ...\QtSDK\Desktop\Qt\4.7.3\mingw were compiled with this compiler. The mingw compiler you installed to c:\MinGW may be a different version than that. If you want to use this compiler you would have to recompile the Qt libraries.
C++ librairies in Qt.
Go to this URL http://doc.qt.digia.com/qtcreator-2.4/creator-overview.html for how to.
It seems (I did not try it, yet) that other librairies can be easily linked to a Qt Project.
This could solve the problem.
Pythagooric