Cross Compile With/Without Sysroot
-
Hello QT experts,
I am having a hard time installing the QT with cross compile toolchain for beaglebone black. I followed the tutorial in the following guide: https://wiki.qt.io/BeagleBone_Black_Beginners_Guide. I am kind of stuck in the step number 7 of the guide.
Here is my setup:
Host: Ubuntu 20.04 LTS
Target: Debian 9.5Installed all the dependencies and packages in Host and the target as instructed in the guide, copied the image, mount the image, downloaded the toolchain from the following link: https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz, downloaded the qt-everywhere-src-5.15.2 version and then I run the the configure command:
./configure -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/home/khan/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/bbb-rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5bbb -hostprefix /usr/local/qt5bbb -qt-zlib -qt-libpng -no-openssl -no-opengl -v
at first it didn't go through after a quick search I found that I have to add -static to the configure which I did and the configure completed without any problem but when I run the make command I am getting the following error:
make[2]: Leaving directory '/home/khan/qt5.15.2/qt-everywhere-src-5.15.2/qtbase/src/widgets'
make[1]: Leaving directory '/home/khan/qt5.15.2/qt-everywhere-src-5.15.2/qtbase/src'
make: *** [Makefile:51: sub-src-make_first] Error 2I know the above error information is not enough to deduce the problem but I am not able copy the whole verbose output neither I can attached any file for further reference here please let me know how I can do that.
After trying for a while I downloaded the sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf files from linaro website and tired the following configure command:
./configure -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/home/khan/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5bbb -hostprefix /usr/local/qt5bbb -qt-zlib -qt-libpng -no-openssl -no-opengl -v
It works perfect, I copied the /usr/local/qt5bbb to the beaglebone and everything works fine but now when I am trying to compile the qtserialport module it is installing it in the sysroot directory which is /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf, it is outside the qt5bbb directory.
I cannot add the qtserialport I don't know if it is because I configured the qt in different way than the guide or I might be missing some thing else.
Please help me out I have been trying to fix this from more than a week now.
Your help is much appreciated.
-
I am trying to compile the qtserialport module
How are you trying to compile it?
-
@sierdzio I am following the instruction mentioned in the guide which are:
workstation@workstation:~/opt$ cd ../qtserialport/ workstation@workstation:~/opt$ /usr/local/qt5bbb/bin/qmake . workstation@workstation:~/opt$ make -j4 workstation@workstation:~/opt$ sudo make install
-
Sudo shouldn't be necessary.ah no, you are installing to root directories... that's totally unnecessary. But does require sudo.Anyway, it's been a while since I did this but I think you can just
rsync
your sysroot with yoiur real device and it will work. -
Sudo shouldn't be necessary.ah no, you are installing to root directories... that's totally unnecessary. But does require sudo.Anyway, it's been a while since I did this but I think you can just
rsync
your sysroot with yoiur real device and it will work.@sierdzio just so that I understand it right, should I rsync the sysroot directory from /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf ? please excuse the following question I am pretty new to Linux environment, is rsync same as coping the whole directory and replacing all the folders and files? I am asking this because I did that then I tried running a QT project and I got the ELGFS not found error.
-
Yes,
rsync
is just copy-pasting stuff. -
I just tried with another version of debian 8.6 and I get the following error while the configuring process:
/home/khan/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to
log10@GLIBC_2.4' /home/khan/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to
cosh@GLIBC_2.4'
collect2: error: ld returned 1 exit status
make: *** [Makefile:91: atomicfptr] Error 1
std::atomic for function pointers disabled.
ERROR: detected a std::atomic implementation that fails for function pointers.
Please apply the patch corresponding to your Standard Library vendor, found in
/home/khan/qt5.7/qt5/qtbase/config.tests/common/atomicfptrso many errors, I don't know how to resolve these errors please help me out.
-
@sierdzio I copy and pasted the qt5bbb folder from /usr/local directory of my host to the /usr/local directory of the target it worked fine I ran a simple project and it worked. The problem is when I compile the qtserialport module it is being installed in the /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf directory because this the sysroot directory I have provided in the configuring command. Now when I tried to copy this directory to the sysroot directory of the target I am getting EGLFS not found error.
-
You need to copy
/home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf
to root/
of your device.But yeah, something doesn't seem right here.
-
You need to copy
/home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf
to root/
of your device.But yeah, something doesn't seem right here.
@sierdzio How can I resolve it? I have been trying a lot of things from more than 2 weeks now. It seems the guide: https://wiki.qt.io/BeagleBone_Black_Beginners_Guide is pretty old and outdated, the commands in the guide isn't working as described. I tried with the exact same version of the debian and ubuntu and followed the every single step as it written in the guide and I end up with the following error:
/home/khan/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to log10@GLIBC_2.4' /home/khan/gcc-linaro-4.9-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference tocosh@GLIBC_2.4'
collect2: error: ld returned 1 exit status
make: *** [Makefile:91: atomicfptr] Error 1
std::atomic for function pointers disabled.
ERROR: detected a std::atomic implementation that fails for function pointers.
Please apply the patch corresponding to your Standard Library vendor, found in
/home/khan/qt5.7/qt5/qtbase/config.tests/common/atomicfptrIt seems I am lost I don't know what to do.
-
-
While the steps of the guide are likely still valid, the versions of the various components have likely changed.
You should update them based on the actual version of the distribution you are using on the device.
-
While the steps of the guide are likely still valid, the versions of the various components have likely changed.
You should update them based on the actual version of the distribution you are using on the device.
@SGaist Hi SGaist is there a tutorial or guide available for the new versions of the distribution?
-
That I do not know.
We have a user here that did cross-compile successfully a more recent version here.
@SGaist You are right. That is exactly what I did and I had success in that not completely though it did worked for a simple qt project. Let me try to explain it again I think not having much knowledge in Linux I must be using wrong terminologies in my questions which is becoming an hindrance in getting my message across. Let me try again.
So in the following configure commend you see I am using the sysroot-glibc-linaro files that I downloaded from the linaro website.
./configure -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/home/khan/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5bbb -hostprefix /usr/local/qt5bbb -qt-zlib -qt-libpng -no-openssl -no-opengl -v
After the configuration process completes a folder is produced named 'qt5bbb' in the /usr/local/ directory of the host I copied this folder to the target /usr/local everything works flawlessly. I created a simple push button project, build it, deploy it works.
Now I needed serial module, so to get that I compiled the qtserialport module from the downloaded qt source code folder using the following command:
sudo /usr/local/qt5bbb/bin/qmake /home/khan/qt-everywhere-src-5.15.2/qtserialport/qtserialport.pro -spec devices/linux-beagleboard-g++
When process is complete I get the following message in the terminal:
Running configuration tests... Done running configuration tests. Configure summary: Serial Port: ntddmodm ............................... no Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into '/home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb'.
So here is the problem you see that message in the last line the new module files are being installed in the directory /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb not in the /usr/local/qt5bbb. This is where things are going sideways, once again I copied the /usr/local/qt5bbb directory from the host to /usr/local/qt5bbb directory of the target. I tired a simple serial project but I got an error:
/home/debian/GC_1.pro: error while loading shared libraries: libQt5SerialPort.so.5: cannot open shared object file: No such file or directory 14:42:16: Application finished with exit code 127.
No surprise in that error because the serial module files are not synced with the target yet so now this time I copied the qt5bbb folder /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb of the host to the /usr/local/qt5bbb directory of the target because that is where the serial module files are located right!
Then I tried deploying a simple serial module project and guess what I get the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: linuxfb, minimal, offscreen, vnc. 14:54:10: Remote process crashed.
This is where I am stuck at, I wish I knew what I am doing wrong.
-
@SGaist You are right. That is exactly what I did and I had success in that not completely though it did worked for a simple qt project. Let me try to explain it again I think not having much knowledge in Linux I must be using wrong terminologies in my questions which is becoming an hindrance in getting my message across. Let me try again.
So in the following configure commend you see I am using the sysroot-glibc-linaro files that I downloaded from the linaro website.
./configure -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/home/khan/gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5bbb -hostprefix /usr/local/qt5bbb -qt-zlib -qt-libpng -no-openssl -no-opengl -v
After the configuration process completes a folder is produced named 'qt5bbb' in the /usr/local/ directory of the host I copied this folder to the target /usr/local everything works flawlessly. I created a simple push button project, build it, deploy it works.
Now I needed serial module, so to get that I compiled the qtserialport module from the downloaded qt source code folder using the following command:
sudo /usr/local/qt5bbb/bin/qmake /home/khan/qt-everywhere-src-5.15.2/qtserialport/qtserialport.pro -spec devices/linux-beagleboard-g++
When process is complete I get the following message in the terminal:
Running configuration tests... Done running configuration tests. Configure summary: Serial Port: ntddmodm ............................... no Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into '/home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb'.
So here is the problem you see that message in the last line the new module files are being installed in the directory /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb not in the /usr/local/qt5bbb. This is where things are going sideways, once again I copied the /usr/local/qt5bbb directory from the host to /usr/local/qt5bbb directory of the target. I tired a simple serial project but I got an error:
/home/debian/GC_1.pro: error while loading shared libraries: libQt5SerialPort.so.5: cannot open shared object file: No such file or directory 14:42:16: Application finished with exit code 127.
No surprise in that error because the serial module files are not synced with the target yet so now this time I copied the qt5bbb folder /home/khan/sysroot-glibc-linaro-2.23-2017.05-arm-linux-gnueabihf/usr/local/qt5bbb of the host to the /usr/local/qt5bbb directory of the target because that is where the serial module files are located right!
Then I tried deploying a simple serial module project and guess what I get the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: linuxfb, minimal, offscreen, vnc. 14:54:10: Remote process crashed.
This is where I am stuck at, I wish I knew what I am doing wrong.
@Parvez-Khan said in Cross Compile With/Without Sysroot:
qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in ""
I do do not know whether you are in a useful configured state, but if you want to pursue that further to find the cause,
export QT_DEBUG_PLUGINS=1
and then run your executable for diagnostic output. -
@Parvez-Khan said in Cross Compile With/Without Sysroot:
qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in ""
I do do not know whether you are in a useful configured state, but if you want to pursue that further to find the cause,
export QT_DEBUG_PLUGINS=1
and then run your executable for diagnostic output.@JonB Hi JonB, can you elaborate please. After export QT_DEBUG_PLUGINS=1 how can I run executable for diagnostic output?
-
@JonB Hi JonB, can you elaborate please. After export QT_DEBUG_PLUGINS=1 how can I run executable for diagnostic output?
Then I tried deploying a simple serial module project and guess what I get the following error:
However you do that (I don't know) you need to set environment variable
QT_DEBUG_PLUGINS
to value1
and then run whatever you run. That will tell you why theeglfs
error is occurring. Whether that will help you I don't know :) -
Then I tried deploying a simple serial module project and guess what I get the following error:
However you do that (I don't know) you need to set environment variable
QT_DEBUG_PLUGINS
to value1
and then run whatever you run. That will tell you why theeglfs
error is occurring. Whether that will help you I don't know :)@JonB I tried setting the the QT_DEBUG_PLUGINS flag to 1 and execute the project but there is no change in the error message. Thank you for the suggestion though.
-
Then I tried deploying a simple serial module project and guess what I get the following error:
However you do that (I don't know) you need to set environment variable
QT_DEBUG_PLUGINS
to value1
and then run whatever you run. That will tell you why theeglfs
error is occurring. Whether that will help you I don't know :)@JonB Jon I think I have more information this time. Instead of clicking deploy button from the host I SSH into the target and ran ./projectName.pro and here is the result I get from that command:
QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/qt5bbb/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5bbb/plugins/platforms/libqlinuxfb.so" Found metadata in lib /usr/local/qt5bbb/plugins/platforms/libqlinuxfb.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "linuxfb" ] }, "archreq": 0, "className": "QLinuxFbIntegrationPlugin", "debug": false, "version": 331520 } Got keys from plugin meta data ("linuxfb") QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5bbb/plugins/platforms/libqminimal.so" Found metadata in lib /usr/local/qt5bbb/plugins/platforms/libqminimal.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "minimal" ] }, "archreq": 0, "className": "QMinimalIntegrationPlugin", "debug": false, "version": 331520 } Got keys from plugin meta data ("minimal") QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5bbb/plugins/platforms/libqoffscreen.so" Found metadata in lib /usr/local/qt5bbb/plugins/platforms/libqoffscreen.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "offscreen" ] }, "archreq": 0, "className": "QOffscreenIntegrationPlugin", "debug": false, "version": 331520 } Got keys from plugin meta data ("offscreen") QFactoryLoader::QFactoryLoader() looking at "/usr/local/qt5bbb/plugins/platforms/libqvnc.so" Found metadata in lib /usr/local/qt5bbb/plugins/platforms/libqvnc.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "vnc" ] }, "archreq": 0, "className": "QVncIntegrationPlugin", "debug": false, "version": 331520 } Got keys from plugin meta data ("vnc") QFactoryLoader::QFactoryLoader() checking directory path "/home/debian/platforms" ... qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: linuxfb, minimal, offscreen, vnc. Aborted
Does it give any insights to what is going on?