Cross Compile QT for ARM under Ubuntu gives Linker Error
-
Hi
Im quite new to QT and embedded development.
I have a i.MX6 Development board which is an armv7 architecture processor.
I would like to start developing apps for this target with QT.My Host is Ubuntu 16.10 x64
I started with the following tutorial: http://wiki.qt.io/RaspberryPi_Beginners_Guide
I installed the compiler with the following command:sudo apt-get install g++-arm-linux-gnueabihf
After that i changed into the directory /opt/QTLIB/qt5/qtbase/
This is where my qt resides.
No i entered the following command:./configure -device linux-imx6-g++ -device-option CROSS_COMPILE=arm- linux-gnueabihf- -sysroot ~/Schreibtisch/LinuxDevelopment/rootfsOverlay -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5imx -hostprefix /usr/local/qt5imx -no-opengl
It successfully created a makefile and told me to run make.
I did what i was told and ran make.
After around 20 minutes i got a linker error:qbitarray.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
This is just one of them. There are many other of this kind. Always the same with the relocation. Now im confused about the R_X86... since i want to build for arm and not x86 so im thinking there must be something basically wrong.
One important addition:
My rootfs. I use buildroot to build my kernel and generate my image.
Buildroot also creates a rootfs from a skeleton. If i want to add files to the rootfs structure, i can do so with a so called overlay folder. This is a folder which its content get included into the rootfs. The folder itself is empty. Is this a problem if i point -sysroot to this folder?btw. Where do i have to point my -prefix and -hostprefix to?
I hope someone can help me.
Thanks
Regards -
@johnwatson said in Cross Compile QT for ARM under Ubuntu gives Linker Error:
./configure -device linux-imx6-g++ -device-option CROSS_COMPILE=arm-
linux-gnueabihf- -sysroot ~/Schreibtisch/LinuxDevelopment/rootfsOverlay
-opensource -confirm-license -optimized-qmake -reduce-exports -release
-make libs -prefix /usr/local/qt5imx -hostprefix /usr/local/qt5imx
-no-openglYou have an error in your configure line..
CROSS_COMPILE=arm-linux-gnueabihf- -sysroot
You have a trailing - on your cross_compile and a single dash on sysroot. Fix that and make sure to clean and rebuild everything as it all built for x86_64 the last time. :)Also yes, your sysroot being empty is not ok. You will fail to build. It needs to have the libs from your Pi device that are already built for the ARM processor. Your host system libs will not work for obvious reasons. That empty directory means you messed up/missed a step on that guide.
-
Thank you for your Answer.
I changed the following:./configure -device linux-imx6-g++ -device-option CROSS_COMPILE=arm-
linux-gnueabihf -sysroot /opt/buildroot/output/target
-opensource -confirm-license -optimized-qmake -reduce-exports -release
-make libs -prefix /usr/local/qt5imx -hostprefix /usr/local/qt5imx
-no-openglThen i got the following error:
unkown command: arm-linux-gnueabihfcpp
cause it was missing the trailing dash.
And are you sure that is should be --sysroot instead of -sysroot?I have also changed the sysroot directory to the real sysroot.
EDIT:
I changed back to arm-linux-gnueabihf-
just like in my original ./configure. But with the changed sysroot to the real sysroot.
It was able to successfully make the lib.Now i have on my host in /usr/local/qt5imx/
libQT5Bootstrap.a and .prl files. But much less than in the sysroot.And my sysroot is full of libs.
For what are the files on my host system under -hostprefix /usr/local/qt5imx ? -
@johnwatson said in Cross Compile QT for ARM under Ubuntu gives Linker Error:
Thank you for your Answer.
I changed the following:./configure -device linux-imx6-g++ -device-option CROSS_COMPILE=arm-
linux-gnueabihf -sysroot /opt/buildroot/output/target
-opensource -confirm-license -optimized-qmake -reduce-exports -release
-make libs -prefix /usr/local/qt5imx -hostprefix /usr/local/qt5imx
-no-openglThen i got the following error:
unkown command: arm-linux-gnueabihfcpp
cause it was missing the trailing dash.
And are you sure that is should be --sysroot instead of -sysroot?No I was assuming that was a typo with the trailing dash. According to the guide (which I skimmed this time) it is indeed -sysroot.
I have also changed the sysroot directory to the real sysroot.
This was more than likely your problem. It needed to be the real sysroot directory. :)
EDIT:
I changed back to arm-linux-gnueabihf-
just like in my original ./configure. But with the changed sysroot to the real sysroot.
It was able to successfully make the lib.Excellent. :)
Now i have on my host in /usr/local/qt5imx/
libQT5Bootstrap.a and .prl files. But much less than in the sysroot.And my sysroot is full of libs.
For what are the files on my host system under -hostprefix /usr/local/qt5imx ?I'm not sure on this one. I haven't done embedded development with Qt before. I have done it for ARM based credit card terminals before but never with Qt.
-
Hi,
IIRC; it's for the host tools like qmake, moc, uic, rcc etc.