Explanation configure options of QT for cross-compiling
-
Hi All,
that's my first topic here on the forum. I am trying to cross-compiling QT libraries 5.12.5 for my Raspberry PI 3B+ and then trying to cross-compiling a simply QT application.
First of all I configured, built and installed from sources the libraries specifying the following data:
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=<path_to_compiler> -sysroot <path_to_sysroot> -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5pi -extprefix /develop/raspberry/qt5pi -hostprefix /develop/raspberry/qt5pi -no-use-gold-linker -no-gbmSysroot has been downloaded from Raspi with rsync command.
From the output of the whole process I can see the bin libraries has been installed in /develop/raspberry/qt5pi as stated in -extprefix and -hostprefix.
Now I was wondering what is the role of -prefix path? If I am building everything on the host is that path important?
And, as soon as I will deploy my application to final platform, Do I have to copy the whole /develop/raspberry/qt5pi into /usr/local/qt5pi?Thanks in advance,
Andrea
-
@ab-90 said in Explanation configure options of QT for cross-compiling:
Do I have to copy the whole /develop/raspberry/qt5pi into /usr/local/qt5pi?
I think so, preferably with rsync (so it's easy to update later) like this guide and this tutorial are suggesting.
-
Hi,
thanks for you reply.
Just to be more clear: I am trying to cross-compile with Cmake a simply QT project on a Ubuntu virtual machine. For that reason, I want to build everything on the host machine.
So the question is, is -prefix option important while working on host machine only? I have some problems with linker and I am asking myself if the library has been configured correcly.AB
-
Now I was wondering what is the role of -prefix path?
on linux this prefix is compiled into the binaries and read from the compiler linker during compilation and from system linker during loading.
And, as soon as I will deploy my application to final platform, Do I have to copy the whole /develop/raspberry/qt5pi into /usr/local/qt5pi?
after compiling Qt simply call
make install
and copy everything from the specified prefix -
@raven-worx
I think it's not clear to me the last step. After I did ./configure <my-options>, make and make install I get the output of the build procedure in estprefix path on my PC (with tools since the path is the same).
At the moment, I don't want to copy that on my raspberry since I just want to build on my PC a program. But, as soon as, I configure my CMake I got a linker error which is looking to /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 path.
In my opinion this error is due to the fact QT libraries have to be linked against this system library but the linker should look into sysroot path.
Am I missing something?AB
-
@ab-90 said in Explanation configure options of QT for cross-compiling:
I don't want to copy that on my raspberry since I just want to build on my PC a program.
So why did you cross-compile Qt to start? :-)
You can build your Qt app for your PC given that you use a proper defined kit for such platform
-
@Pablo-J-Rogina sorry, maybe my previous response was not so clear. As soon as I get QT libraries built for raspi, my goal is to cross-compile a whole QT application on my PC for raspi too. In order to do that I rely on a CMake file where I set CMAKE_TOOLCHAIN_FILE variable in order to set C/CXX compiler and Sysroot path.
I know that I will have to move to target the built libraries in order to run an app there.Before that, the problem rises when I build with that configuration on host PC since I got the following errors:
- /develop/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libc.so.6
- /develop/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
- /develop/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
So it seems the build procedure is looking for that files inside the root of my host PC e not on my sysroot. I suppose there is some error in configuration of QT libraries since with a simple hello world C++ program everything work.
Thanks
AB
-
@ab-90 said in Explanation configure options of QT for cross-compiling:
CMake file where I set CMAKE_TOOLCHAIN_FILE variable in order to set C/CXX compiler and Sysroot path.
I'm not well versed on CMake, but usually the path for the compiler and the sysroot folder are two different locations
the build procedure is looking for that files inside the root of my host PC e not on my sysroot
yes, it looks like so it seems you need to modify your CMake file(s) to reflect your environment
there is some error in configuration of QT libraries
I'd say problem with your build procedure, not the Qt libraries
since with a simple hello world C++ program everything work.
Do you mean a simple cross-compiled Qt app running Ok on the target device?