what is auto generating LIBS path in makefile "qt creator"
-
in the auto generated Makefile, LIBS get wrong path to lib. after every build, i have to manually correct the path.
what and where in qt creator is making the path?
if it can not be set in qt creator, how can i overwrite the settings? -
@micha_eleric If you are using
qmake
then it is a combination of the settings matching your Qt library installation and anything yourproject.pro
files does to the LIBS variable.If you are using
cmake
then it is a combination of settings matching the Qt library being used and anything you do withtarget_link_libraries()
and similar directives inCMakeLists.txt
-
@ChrisW67 said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric If you are using
qmake
then it is a combination of the settings matching your Qt library installation and anything yourproject.pro
files does to the LIBS variable.If you are using
cmake
then it is a combination of settings matching the Qt library being used and anything you do withtarget_link_libraries()
and similar directives inCMakeLists.txt
it seems what i set in .pro is over riden
-
@micha_eleric So clearly you already knew the answer to the question.
If you want help you will have to:
- Describe what you are doing.
- What is your PRO file?
- What Qt version? NOT Qt Creator version.
- What platform?
- The details matter
- Describe what you are expecting.
- Describe what you are getting.
- Explain why you think that is wrong.
- Describe what you are doing.
-
@ChrisW67 no, i dont already know the answer
.pro
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5SerialPort
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5Widgets
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5Gui
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5SerialPort
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5CoreMakefile
LIBS = $(SUBLIBS) -L/home/micha_eleric/ProjectGUI/lib -lQt5Widgets -lQt5Gui -lQt5SerialPort -lQt5Core /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Widgets.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Gui.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5SerialPort.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Core.so -lGL -lpthreadin order for program to run
Qt5.12.12/5.12.12/gcc_64
has to be manually made
ProjectGUI
in Makefileif i manually edit Makefile with Kate, program runs
first error is
:-1: error: cannot find /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5SerialPort.so: No such file or directoryjust for giggles, i deleted
/home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Widgets.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Gui.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5SerialPort.so /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5Core.so
and it ran -
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5SerialPort
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5Widgets
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5Gui
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5SerialPort
unix:LIBS += -L/home/micha_eleric/ProjectGUI/lib -lQt5CoreYou should never need to manually specify the Qt libraries. These will be generated as a result of putting the correct information in:
QT += core widgets serialport
Is this the Qt library installation you are intending to build with?
/home/micha_eleric/Qt5.12.12/5.12.12/gcc_64
If so, then you need to run
/home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/bin/qmake
In Qt Creator, which is not essential to this process, this path is part of your Kit definition.This message:
first error is :-1: error: cannot find /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5SerialPort.so: No such file or directory
is telling you that the optional serial port library has not been built/installed into the Qt library set.
-
@ChrisW67 said in
This message:
first error is :-1: error: cannot find /home/micha_eleric/Qt5.12.12/5.12.12/gcc_64/lib/libQt5SerialPort.so: No such file or directory
is telling you that the optional serial port library has not been built/installed into the Qt library set.
that is because it is at
-L/home/micha_eleric/ProjectGUI/lib -
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
if i dont specify which folder libs are in, then then when executable goes to another computer, or as i found out, my computer gets os reinstalled, executable can not find a lib
You need to deploy your application properly. This is not a function of the build and link issue you are having.
Regarding libQt5SerialPort
that is because it is at
-L/home/micha_eleric/ProjectGUI/libWhy?
-
@ChrisW67 said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
if i dont specify which folder libs are in, then then when executable goes to another computer, or as i found out, my computer gets os reinstalled, executable can not find a lib
You need to deploy your application properly. This is not a function of the build and link issue you are having.
Regarding libQt5SerialPort
that is because it is at
-L/home/micha_eleric/ProjectGUI/libWhy?
so i dont send the entire Qt folder, just the libs that project uses
-
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
so i dont send the entire Qt folder, just the libs that project uses
Put the libraries back where they belong on your development machine. They are not part of your project's build products.
When you go to build a deployment package, then you make a copy to deploy.
-
@ChrisW67 said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
so i dont send the entire Qt folder, just the libs that project uses
Put the libraries back where they belong on your development machine. They are not part of your project's build products.
When you go to build a deployment package, then you make a copy to deploy.
did, put copy of libs in folder, and executable does not work if qt is not in home folder.
-
@micha_eleric Probably still something is missing. Any errors if you start the app in a terminal?
You also should take a look at https://doc.qt.io/qt-6/deployment.html -
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
did, put copy of libs in folder, and executable does not work if qt is not in home folder.
Install the Qt library version, including optional components, you wish to build with. Nothing in this directory tree needs to be changed or moved. Then the process goes:
- Build application in your development environment using the qmake from intact Qt library you installed. No part of the Qt libraries are in your build directory.
- Test application in your development environment. Everything is exactly where it was at build time and the run time environment matches the build time environment.
- Rinse and repeat steps above until the application works.
- Only then do you consider what has to be deployed in order to test the application away from the development environment before releasing it in the wild.
It is hard to help if you cannot tell the difference between building the application (which is what is failing here) and deploying the application (which is what you seem to think you are doing). If you mangle your Qt installation, or mix and match several versions, or remove files that are expected in certain places then you get to keep the broken pieces.
-
@jsulm said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric Probably still something is missing. Any errors if you start the app in a terminal?
You also should take a look at https://doc.qt.io/qt-6/deployment.htmlif i move Qt5.12.12 into a different folder, i get:
error while loading shared libraries: libQt5SerialPort.so.5: cannot open shared object file: No such file or directoryeven after i installed qt-everywhere-src-5.15.13, then deployed
maybe i have to many qt installed
5.15.13 is not showing up for build. was it not properly installed?
-
i /tmp/qt-everywhere-src-5.15.13/configure -static, gmake, sudo gmake install, but did not show up in qt creator project, which explains why deploy did not work.
i then /tmp/qt-everywhere-src-5.15.13/configure -static again, uninstalled, reinstalled, and still does not show up in qt creator projects as an option for build. -
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
and still does not show up in qt creator projects as an option for build
Then create a Kit in QtCreator pointing to this Qt build...
And as already suggested take a look at https://doc.qt.io/qt-6/deployment.html to learn how to deploy a Qt application. -
@jsulm said in what is auto generating LIBS path in makefile "qt creator":
And as already suggested take a look at https://doc.qt.io/qt-6/deployment.html to learn how to deploy a Qt application.
have been
-
@jsulm said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
Then create a Kit in QtCreator pointing to this Qt build...
And as already suggested take a look at https://doc.qt.io/qt-6/deployment.html to learn how to deploy a Qt application.Set up new Qt versions
To add a Qt version:
Select Preferences > Kits > Qt Versions > Add. [done] Select the qmake executable for the Qt version to add. [[nothing, and no clue where qmake(qmake**) is, what it looks like, nor what folder it might be in]
[ did a search for "qmake", it gave .h .cpp .pro .pri .qdoc Makefile .conf , all i would guess is not close to the qmake that it is looking for. ]
[ i found /usr/bin/qmake, which list as an executable, but when selected and Open, it says The qmake executable /usr/lib/qt5/bin/qmake could not be added: qmake "/usr/lib/qt5/bin/qmake" is not an executable.]
[well, i found /usr/local/Qt-5.15.13/bin/qmake, compiled, but gave:
name
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. ]
[ well, found:
"Set the environment variable QT_DEBUG_PLUGINS=1 and then run your application. This should give more detailed information on why it failed." results in:
name
QFactoryLoader::QFactoryLoader() ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. ]Select the Qt version to view and edit it. In the Name field, edit the name that Qt Creator suggests for the Qt version. In the qmake path field, you can change the qmake location. If the Qt version is for QNX, enter the path to the QNX SDK in the QNX SDK field.
still wander if i found the correct qmake
-
@jsulm said in what is auto generating LIBS path in makefile "qt creator":
@micha_eleric said in what is auto generating LIBS path in makefile "qt creator":
.>And as already suggested take a look at https://doc.qt.io/qt-6/deployment.html to learn how to deploy a Qt application.according to:
https://doc.qt.io/qt-6/linux-building.htmlStep 4: Using Qt
After Qt is installed, you can start building applications with it.
If you work from the command line, consider adding the Qt tools to your default PATH. This is done as follows:
In .profile (if your shell is bash, ksh, zsh or sh), add the following lines:
PATH=/usr/local/Qt-6.6.3/bin:$PATH
export PATHchanged 6.6.3 to 5.15.13, it errors with:
error: Extra characters after test expression.
at export PATH