Configuring Qmake mkspecs after it's built
I don't know if it's really even possible (see related thread on this forum that had no replies), but the 4.8 documentation says that an environment variable "QMAKESPEC" can be set to specify mkspecs:
Quote:
The QMAKESPEC environment variable can contain any of the following:
A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
However, while qmake does not exist with an error, setting the QMAKESPEC environment doesn't seem to have any effect:
Code:
davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ echo $QMAKESPEC
/usr/share/qt4/mkspecs/linux-arm-g++
davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ ls $QMAKESPEC
qmake.conf qplatformdefs.h
davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ qmake -query
QT_INSTALL_PREFIX:/usr
QT_INSTALL_DATA:/usr/share/qt4
QT_INSTALL_DOCS:/usr/share/qt4/doc
QT_INSTALL_HEADERS:/usr/include/qt4
QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu
QT_INSTALL_BINS:/usr/bin
QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt4/plugins
QT_INSTALL_IMPORTS:/usr/lib/qt4/imports
QT_INSTALL_TRANSLATIONS:/usr/share/qt4/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/lib/qt4/examples
QT_INSTALL_DEMOS:/usr/lib/qt4/demos
QMAKE_MKSPECS:/usr/share/qt4/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.8.1
Here's what's in the qmake.conf in the directory specified by the QMAKESPEC env variable:
Quote:
#
# qmake configuration for linux-g++
#
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_CC = $CROSS_COMPILE-gcc
QMAKE_CXX = $CROSS_COMPILE-g++
QMAKE_LINK = $CROSS_COMPILE-g++
QMAKE_LINK_SHLIB = $CROSS_COMPILE-g++
QMAKE_AR = $CROSS_COMPILE-ar cr
QMAKE_OBJCOPY = $CROSS_COMPILE-objcopy
QMAKE_STRIP = $CROSS_COMPILE-strip
QMAKE_LFLAGS_RELEASE = -Wl,-O1,-rpath $ROOTFS/usr/lib
QMAKE_INCDIR = $ROOTFS/usr/include
QMAKE_LIBDIR = $ROOTFS/usr/lib
QMAKE_INCDIR_X11 = $ROOTFS/usr/include
QMAKE_LIBDIR_X11 = $ROOTFS/usr/lib
QMAKE_INCDIR_OPENGL = $ROOTFS/usr/include
QMAKE_LIBDIR_OPENGL = $ROOTFS/usr/lib
load(qt_config)
davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$
Can qmake be configured to use different mkspecs after being built?
Re: Configuring Qmake mkspecs after it's built
Why do you say it didn't work?
Re: Configuring Qmake mkspecs after it's built
Quote:
Why do you say it didn't work?
1) Note the value of the qmake variable QMAKE_MKSPECS
QMAKE_MKSPECS:/usr/share/qt4/mkspecs
2) Changing the value of the $QMAKESPEC env variable to a non-existant location doesn't cause any error when running qmake.
3) I get invalid qt version message in QtCreator when using qmake and trying to set a cross compile tool chain, regardless of whether $QMAKESPEC is set. It configures ok for local build which uses the qmake's qmakespec as configured for build
Is it possible to do what I'm trying to do and I'm just missing something?
Thanks,
Dave Thomas
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
1) Note the value of the qmake variable QMAKE_MKSPECS
QMAKE_MKSPECS:/usr/share/qt4/mkspecs
2) Changing the value of the $QMAKESPEC env variable to a non-existant location doesn't cause any error when running qmake.
3) I get invalid qt version message in QtCreator when using qmake and trying to set a cross compile tool chain, regardless of whether $QMAKESPEC is set. It configures ok for local build which uses the qmake's qmakespec as configured for build
Is it possible to do what I'm trying to do and I'm just missing something?
For me it works:
Code:
!build_pass {
linux-*:message(LINUX)
win32-*:message(WINDOWS)
}
QMAKESPEC=/home/wysota/Qt/5.3/gcc_64/mkspecs/win32-g++ qmake
yields:
Project MESSAGE: WINDOWS
Changing the specs will not modify the value of qmake variables, why would it? You are still within the same qmake installation.
Also remember you can always pass a different specs to qmake using the -spec parameter:
qmake -spec windows-g++
Re: Configuring Qmake mkspecs after it's built
Thanks for the reply. It helps a lot to know it SHOULD work.
Maybe it's just QtCreator configuration issues. When I went back to native build on Raspberry Pi using QtCreator I kept getting messages about invalid Qt version when I tried going back to the native qmake. Turns out the real problem was that the build output directory was still pointing to the directory I was going to use on the ubuntu compiling machine--which doesn't exist from the RPI's point of view.
So, given this bad error message, I suspect several errors cause the same "invalid qt version" error. I think what's really happening is that the qmake selection doesn't change when other errors occur, so if it was invalid, it stays invalid until the other issues are fixed.
At least that's the path I'm going down next. I'll try get qmake working (creating makefiles with cross-compile toolchain) outside QtCreator, then use QtCreator using the -spec parameter if needed (I think I saw a thread indicating that may be required for cross-compiling).
Does remote debugging work from QtCreator 4.8 on Ubuntu with rpi as target? Haven't tried yet, but if it doesn't I'm less enthused about going to cross-compilation development.
I suspected the QMAKE_MKSPECS only indicated what was configured at build time, but there's nothing in the documentation (that I could find) that clarifies this.
Thanks!
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
Does remote debugging work from QtCreator 4.8 on Ubuntu with rpi as target?
Qt Creator's current version is 3.3 so I can't say whether it will work in 4.8 ;)
Quote:
Haven't tried yet, but if it doesn't I'm less enthused about going to cross-compilation development.
I don't see why it shouldn't if you have gdbserver for Pi available.
Re: Configuring Qmake mkspecs after it's built
So, I got it working using the -spec option like Wysota suggested.
Thanks!
Added after 1 27 minutes:
Quote:
I don't see why it shouldn't if you have gdbserver for Pi available.
Yes, it works fine using the RPI gdbserver if I manuall start the gdbserver on the RPI and specify the debuggee (target) executable name.
It would be nice if QtCreator would launch gdbserver on the remote machine, but I don't see how to do that in the docs. I tried using Debug->Start Debugging->Start and Debug Remote Application, but that didn't work. Does QtCreator support this -- automatic launching gdbserver and the target app on the remote machine?
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
It would be nice if QtCreator would launch gdbserver on the remote machine, but I don't see how to do that in the docs.
Debug -> Start Debugging -> Start Remote Debug Server Attached to Process...
Re: Configuring Qmake mkspecs after it's built
Quote:
Debug -> Start Debugging -> Start Remote Debug Server Attached to Process..
That action isn't there in QtCreator 2.4.1. Under Debugging->Start Debugging, the remote debugging actions are:
- Start Remote Debug Server
- Attach to Remote Debug Server
- Start and Debug Remote application
"Start Debug Server" seems to be presenting a list of running processes on the target. That seems more like something that should be labelled "attach to process on remote machine", but I haven't tried this action.
"Attach to Remote Debug server" works, but only if I first launch the application under gdbserver first on the target platform. That's what I'm doing now.
"Start and Debug Remote application" sounds like the action I want, but when I try it, I get the message "Debugging has finished" in the application output window. The remote application never started.
Do I need to set up a start script on the host that gets executed on the target to launch gdbserver?
I'm just trying to get as tight a compile-test-debug-edit-compile cycle as possible. Now it's really quick compared to native RPI development. so while having to switch context to ssh, vnc, or target console to launch gdbserver is not a big deal, if support for automatic launch of a remote target process (and gdbserver) is in QtCreator there I want to use it.
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
That action isn't there in QtCreator 2.4.1.
That's a really ancient version. Why don't you upgrade to 3.x?
Re: Configuring Qmake mkspecs after it's built
I'm using Ubuntu 12. 2.4.1 is the latest qtcreator available for it, according to apt-get.
I started with a new version of Ubuntu, but the ia32-lib that's required for cross-compiling to a raspberry pi target isn't available for the newer Ubuntu releases. I spent a lot of time trying work-arounds with no success and got nothing but silence when I asked on various forums if anyone had a solution that didn't require a 12.x Ubuntu host.
Will qtcreator 3.x work on Ubuntu 12? Can I get binaries using apt-get from somewhere, or would I have to build it? If I have to build it, can I use the qt4.8 binaries on that system? if I have to move up to qt5.x, then I have another pile o stuff to do to get qt5 up and going on the rpi.
Thanks,
Dave Thomas
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
I'm using Ubuntu 12. 2.4.1 is the latest qtcreator available for it, according to apt-get.
Forget apt-get, download QtCreator from here: http://www.qt.io/download-open-source/#section-6
Quote:
I started with a new version of Ubuntu, but the ia32-lib that's required for cross-compiling to a raspberry pi target isn't available for the newer Ubuntu releases.
You can use schroot or a similar tool to have a Ubuntu 12.x installation inside your Ubuntu 14.x system.
Quote:
Will qtcreator 3.x work on Ubuntu 12?
Yes.
Quote:
Can I get binaries using apt-get from somewhere, or would I have to build it?
The link I gave you contains downloads for a binary release of QtCreator.
Quote:
If I have to build it, can I use the qt4.8 binaries on that system? if I have to move up to qt5.x, then I have another pile o stuff to do to get qt5 up and going on the rpi.
You are confusing two things. Creator is just a tool, it has nothing to do with version of Qt you use to write your projects with. Creator is built against Qt5 but it can work with both Qt4 and Qt5 projects. Just use the download link I gave you and all will be fine.
Re: Configuring Qmake mkspecs after it's built
Quote:
You can use schroot or a similar tool to have a Ubuntu 12.x installation inside your Ubuntu 14.x system.
I'm actually running a Vmware player on windows 7. Are you suggesting running Ubuntu 12 inside 14.x in a Vm session on windows? Why, is the latest qtcreator incompatible with Ubuntu 12?
I understand QtCreator versus Qt libraries. But, I think I can do a lot of "GUI only" work on the Ubuntu host platform using Qt Designer and Qt4 stuff that will be compatible with what's available (without building qt) on the RPI. So, moving up to Qt5 on the host Ubuntu system would seem to only complicate things. Or, would it be easy to use a QtCreator built for Qt5, have the libraries it needs for running, but build local and target applications using Qt4? Whew....
I started the Wizard, but I need to know what it's going to do before I run it. It looks like I choose a Qt5 version to install.
I don't want to clobber the qt4 stuff until I understand the above issues better. Are you saying I can configure QtCreator built from Qt5 to use Qt4 for applications it builds?
Thanks!
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
I'm actually running a Vmware player on windows 7. Are you suggesting running Ubuntu 12 inside 14.x in a Vm session on windows? Why, is the latest qtcreator incompatible with Ubuntu 12?
No, you said you couldn't upgrade to newer kubuntu because of some missing library. I showed you how to do it - have a minimalistic Ubuntu 12 as a chroot in Ubuntu 14.
Quote:
I understand QtCreator versus Qt libraries. But, I think I can do a lot of "GUI only" work on the Ubuntu host platform using Qt Designer and Qt4 stuff that will be compatible with what's available (without building qt) on the RPI. So, moving up to Qt5 on the host Ubuntu system would seem to only complicate things. Or, would it be easy to use a QtCreator built for Qt5, have the libraries it needs for running, but build local and target applications using Qt4? Whew....
Qt4 and Qt5 can live side by side. Qt Creator that I gave you a link to contains a bundled Qt5 environment so you don't have to build anything.
Quote:
I don't want to clobber the qt4 stuff until I understand the above issues better. Are you saying I can configure QtCreator built from Qt5 to use Qt4 for applications it builds?
Just install the thing and stop worrying. I have a single instance of Creator working fine with Qt4 as well as Qt5, both native and cross-compiled. Creator is not tied to developing with any particular version of Qt. It just needs a particular version of Qt to run. And the binary release comes with one integrated which is totally separate from what you have in your system.
Re: Configuring Qmake mkspecs after it's built
I took the plunge after taking a snapshot of the vmplayer.
It looks like the 4.8 qtcreator is still there "to fall back on", and using qtcreator 3.x I see what looks like existing projects configured to use qt4--just like I think you said.
Looks like great advice, will know for sure once I'm building again.
Thanks!
Added after 53 minutes:
The project builtok with little effort.
I was a bit confused by being presented with multiple kits to choose from after opening the project I was working on, but I just picked one. Also, I kept getting complaints about the permissions on the *user* file, so I ended up just making it readable and writeable outside qtcreator.
I had to add the -spec param to qmake and pick the cross-compiler. I quess the 3.x qtcreator couldn't deal with the 2.x .pro file.
After doing this, the project built Ok, but I can't figure out how to configure a deploy step to transfer the binary to the target like I was doing in QtCreator 2.
The combo on the Run Settings menu only has "Deploy Locally" item. I can't figure out how to set up for deployment using something like SFTP to a remote target like I did on the older QtCreator.
I suspect that since I'm using the -spec parameter to get the cross-compile stuff set up, QtCreator doesn't know I'm actually creating binaries for a remote target? Is there a work-around for this?
Added after 5 minutes:
btw, the new QtCreator performance seems much better. Not the compile, of course, but just the response time when clicking on options, etc. A much "snapier" feeling.
Not sure why that would be, but it's a big improvement. Worth the change, even if I can't get auto launch of a remote application working. (Assuming I can figure out how to do the deploy thing).
Added after 23 minutes:
Ok, figured out how to set up for remote deployment. Forgot I had to set up a Generic Linux device.
So, I see the
Quote:
Debug -> Start Debugging -> Start Remote Debug Server Attached to Process...
Wysota referenced earlier in this thread before suggesting I move up to a later QtCreator. But when I use that option, I see the what looks like the same list of pids on the target platform that I saw when I clicked on "Start Remote Debug Server" on the 2.x version of QtCreator.
Why a list of processes? I would expect something like a menu for a host name/ip address and an ip address. Maybe a name for something to launch, like "gdbserver :1234 my_remote_app". This option looks like something I would attach to, not launch.
Is that what's supported? I still need to launch the application outside of qtcreator, but qtcreator will start a gdbserver and attach to a remote process that's already running?
Re: Configuring Qmake mkspecs after it's built
I'll spend a day trying to configure the new QtCreator for remote debugging and start a new thread if I can't figure it out.
Thanks Wysota!
Re: Configuring Qmake mkspecs after it's built
Quote:
Originally Posted by
davethomaspilot
I had to add the -spec param to qmake and pick the cross-compiler. I quess the 3.x qtcreator couldn't deal with the 2.x .pro file.
No, the pro file is independent of the version of Creator. If you had to set specs and the compiler manually, it means the kits were not configured properly.
Quote:
After doing this, the project built Ok, but I can't figure out how to configure a deploy step to transfer the binary to the target like I was doing in QtCreator 2.
Nothing changed in this regard -- configure a remote linux device and attach it to your kit.
Re: Configuring Qmake mkspecs after it's built
Quote:
Nothing changed in this regard -- configure a remote linux device and attach it to your kit.
I have a remote linux device configured in a kit called Qt 4.8.1. I can build and deploy using that kit with no issues.
However, when I try to debug by using what worked on QtCreator 2, (Attach to Remote Debug Server) a combobox is shown The selected kit isn't what I set-up for build and the Qt4.8.1 isn't in the combobox list.
However, when I click on "Start Remote Debug Server attached to Process", I DO see the Qt4.8.1 kit as the selected one. But, I'm still confused by the presentation of what looks like a list of processes running on the target platform. What do I do at this point to get gdbserver launched using a specified port?
Maybe the issue is related to the fact I'm using the -spec parameter as Wysota suggested.
When I hover over Qt 4.8.1 kit in , I get an error message saying that the cross-compiler selected can't generate code for the qt version selected. I think that error occurs because qtcreator doesn't understand what the -spec flag will do when qmake is executed? Not sure why build and deploy would pick up the kit but not debug.
So, I can't debug a remote target using the new QtCreator, even if I launch the target application under gdbserver manually--I can't get QtCreator to pick up the Qt4.8.1 kit for debugging use.
Re: Configuring Qmake mkspecs after it's built
Without knowing how you configured the kit, I cannot provide any precise hint. Maybe you didn't set a debugger for it or you didn't associate it with a device or you didn't do something else that I cannot see. Make sure you have the right compiler, the right debugger, the right Qt version and the right device set for the kit. If Creator doesn't let you choose the kit in some situation then it means it doesn't have some feature required for the function.
Re: Configuring Qmake mkspecs after it's built
I think the error QtCreator is complaining about must prevent the specified device in the kit to be presented as an option in the Debug commands. But, it's probably a moot point...
I do see my device in the "Recent" combo at the bottom of the menu. When I select that, the correct gdb gets executed and everything seems to be flowing ok until QtCreator gives up complaining the gdb used doesn't support python scripting.
I'm not willing to be build my own cross-debugging gdb, so I'll stick with QtCreator 2.x and launch the remote application under gdbserver manually. The 3.x documentation makes no mention of a capability to launch the remote application anyway and seems in no way different in this respect than the 2.x QtCreator.