Unsolved How to get cross compile toolchain from target system
-
Im trying to use a virtualmachine Linux now, but I have a similar problem. When trying to use QtCreator and make a Kit for my embedded board, there is an error saying I need a Qt version that is compatible with ARM, and I only have an x86 version.
What do I do to get a qmake that will compile for ARM?
-
@lx_frz said in How to get cross compile toolchain from target system:
Im trying to use a virtualmachine Linux now, but I have a similar problem. When trying to use QtCreator and make a Kit for my embedded board, there is an error saying I need a Qt version that is compatible with ARM, and I only have an x86 version.
What do I do to get a qmake that will compile for ARM?
Did you download already the complete source archive?
There is already a link given in my earlier post on bullet "Download Qt ..."Basically you need to set up 2 environment variables and start configure. I believe there is a way to do through Qt creator,but so far I have found the way using configure easier. At the end of configure it tells you how to start the actual cross compilation.
After cross compilation you can bind the freshly cross-compiled Qt Libs with its qmake into Qt creator and use it from there.
-
So the link I clicled on talked about using a "configure" command, but I dont seem tonhave that on thebsystemnthat has QT.
There is, however, already a qmake.conf and qplatformdefs.h for ARM in the mkspec location. Are these the files I am meant to be generating?
Either way, that page ends with different plugin options. It doesnt say anything about how to actually set Qt to use these files for anything, so Im still a little unclear on what the end goal is.
-
@lx_frz said in How to get cross compile toolchain from target system:
So the link I clicled on talked about using a "configure" command, but I dont seem tonhave that on thebsystemnthat has QT.
There is, however, already a qmake.conf and qplatformdefs.h for ARM in the mkspec location. Are these the files I am meant to be generating?
Either way, that page ends with different plugin options. It doesnt say anything about how to actually set Qt to use these files for anything, so Im still a little unclear on what the end goal is.
I guess you did not download Qt sources yet. Here is a link for Qt 5.10.0. Thereare always a zip (for compilation for windows) and tar.xz (for compilation for linux and other systems). This is the single folder for complete lib. There is also an option for downloading only submodules, which I never did so far, because I prefer the complete version, which is presumably easier.
The sources already delivered with a precompiled version are not as complete as you found out already.
Also make sure that you use the archive for the OS, see above, you are targeting. AFAIK the difference are only the line endings.
-
Here is another page for compilation on linux
Sorry, I seem to remember some different guides helping in compilation, but apparently they have renamed or moved and I cannot find them.
When all compilers are already installed the main thing you have to do is starting configure script, wait and follow the instructions for continuing.
The main things from the guide would be the first part. There is also a link provided for description of the configuration parameters.
-
Ok, thank you for that link, I was having a tough time locating those sources.
So if I read that first page you linked correctly, the main two things I need to specify for "configure" are -device and -sysroot.
In the mkspec directory there is a subdirectory called 'linux-arm-gnueabi-g++', which sounds right, but for some reason when I pass that I get back "ERROR: No device matching 'linux-arm-gnueabi-g++'."
And for the -sysroot I just pass in my root directory? Is that right?
-
Ok, im making some progress I think.
I sent in -device linux-arm-generic-g++ instead and that seemed to register. Now its complaining that it cant find g++. It also says "Maybe you forgot to setup the environment?"
I can see g++ at "/opt/Xilinx/sdk/2016.2/gnu/arm/lin/bin/arm-xilinx-linux-gnueabi-g++", and when I set up Xilinx it set my CROSS_COMPILE to "arm-xilinx-linux-gnueabi-". But apparently thats either not correct or not what QT wants. So I need help figuring out how to direct it properly.
-
Those are the commands I have used for cross-compilation for BeagleBoneBoard
./configure -platform linux-g++ -release -device linux-beagleboard-g++ \ -sysroot /opt/arm-toolchain/sysroot-glibc-linaro-arm-linux-gnueabihf \ -prefix /opt/QtForBBB/ -device-option CROSS_COMPILE=/opt/arm-toolchain/gcc-linaro-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- \ -qt-xcb -nomake tests -nomake examples -no-opengl
I do not know what the embedded device is you are compiling for, but for the beaglebone the cross-compiler and sysroot had to be installed. Whereever you are going to install this sysroot you need to refer to.
Note: the part after CROSS_COMPILE looks broken, but that is correct to have a stump there. It will be extended configure with "g++" or whatever is required. -
OK, I found a set of parameters that worked to start the build.
Is this version of Qt you linked "stable"? I ask because the actual make process is currently failing when it reaches QWebGL, citing some issues with the source file. Im not really sure how to skip compilation of this, but at the moment Im stuck on that part.
-
The given command as given in my previous post was producing a stable set Qt libs currently deployed on to BBB and working stable. At least those libraries used by my application.
The Qt version compiled version 5.9.2
What does the error message?
You can exclude certain things by prepending -no e.g. -no-opengl as I have used. Here is a list of submodules which you apparently can exclude -no-
Not sure if -no-webkit would help -
Switching to 5.9 helped.
I think I have just one more problem before this will work.
When I built the 5.9 and made an executable, it was recognized on the target platform, but couldnt run because it couldnt find the Qt .so files, despite them being on my platform.
On some threads I found from google, it qas recommended that I compile Qt statically to avoid this. I tried it and it worked. However, there is still 1 missing .so, libstdc++.so.6
Supposedly I could use the -static_runtime option to statically include this, but when I try that I get
Warning: Feature static_runtime is insignificant in this configuration, ignoring related command(s)
So I can make executables now, but they wont run on my target because I cant compile with a static libstdc++.so.6
Do you jave any suggestions about this?
-
@lx_frz said in How to get cross compile toolchain from target system:
Switching to 5.9 helped.
I think I have just one more problem before this will work.
When I built the 5.9 and made an executable, it was recognized on the target platform, but couldnt run because it couldnt find the Qt .so files, despite them being on my platform.
I had that problem too, but this helped
export LD_LIBRARY_PATH=/home/ubuntu/QtForBBB/lib:.
The statement above is basically similar for that case as the path enviroment setting in windows.
The only issue is, for windows boys like me, the different syntax to separate path values. The separator is a ' : '
The shared libraries are on QtForBBB/lib and the default folder ' . ' for the dynamic libs of my application. Basically the default is also the folder where the application executable resides. linux does apparently/obviously not look into the default folder for dynamic libs.On some threads I found from google, it qas recommended that I compile Qt statically to avoid this. I tried it and it worked. However, there is still 1 missing .so, libstdc++.so.6
I have seen those posts in the past as well, but actually I was surprised how easy this dynamic link part.
Supposedly I could use the -static_runtime option to statically include this, but when I try that I get
Warning: Feature static_runtime is insignificant in this configuration, ignoring related command(s)
So I can make executables now, but they wont run on my target because I cant compile with a static libstdc++.so.6
libstdc++.so.6 is part of the compiler. On my BBB it is found on folder /usr/lib/arm-linux-gnueabihf
As the whole setup looks to me is the compiler with all its libraries already installed on the device. Probably it came already with the bootable SD card.For you that would mean that you need to install the gnu c++ with its libraries.