[Solved] Cross compiling between x64 and Cortex A8
-
Hi Folks,
I have a project which will run on an Cortex A8 based embedded PC. I tried to compile on the board, but it is something difficult.
Is any solution to make cross compile my project: configure the .pro files and set the target architectures, include path and link path too?
I have installed Qt framework on the board but different path as on the computer.Regards,
Norbert -
You need to configure cross-compiler on your system + sysroot(additional/system libraries from Cortex-A8 platform which can be used for compilation). Then you can compile Qt using -platform "compiler you are building on", and -xplatform "your target platform". In QtCreator you can then configure your compiler to cross-compile your program with the right cross-compiler and Qt libs.
-
Hi,
I make a special compile process based on a "special cross compile solution".
- I use my computer to develop the sources and handle projects.
- I made a compile script which make same steps as rebuild in Qt Creator and run on the embedded board.
- I have a subdir project for test.
I connected to the embedded board via ssh and type the following:
"../../../thesis_app/masterController/compile.sh"and I got an linker error like the linker doesn't find any .so libs:
@
g++ -Wl,-O1 -Wl,-rpath,/home/moravas/project/cubie/bin/lib -o masterController main.o -L/home/moravas/project/cubie/bin/lib -lQt5Core -lpthread
main.o: In functionQDebug::operator<<(char const*)': /home/moravas/project/build/embedded/masterController/masterController/../../../../cubie/bin/include/QtCore/qstring.h:909: undefined reference to
QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
main.o: In functionQDebug::Stream::~Stream()': /home/moravas/project/build/embedded/masterController/masterController/../../../../cubie/bin/include/QtCore/qstring.h:909: undefined reference to
QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'
collect2: ld returned 1 exit status
make[1]: *** [masterController] Error 1
make[1]: Leaving directory `/home/moravas/project/build/embedded/masterController/masterController'
make: *** [sub-masterController-make_first-ordered] Error 2
@If I good see the compiler output it found the correct path of Qt libs. My main.cpp looks out like this:
@
#include <QCoreApplication>
#include <QDebug>
#include <QVector>int main()
{
qDebug() << "hello";
return 0;
}
@My compiler script looks out like this:
@
#!/bin/bash( test -d ~/project/build/embedded/masterController/ || mkdir ~/project/build/embedded/masterController/ ) && cd ~/project/build/embedded/masterController/
rm -rf *
~/project/cubie/bin/bin/qmake ~/project/thesis_app/masterController/masterController.pro -r -spec linux-g++ -d
/usr/bin/make -f Makefile
@Have anybody some idea?
Regards,
Norbert -
what is "special cross compile solution" have never heard about it and google don't know it too....
From your outputs I can't see any paths to cross-compiler etc... No idea what is wrong there.....If you like to read about how to compile your personal cross-compiler, use sysroot and so on, look here: http://cross-lfs.org/view/clfs-embedded/arm/
There is another method to do cross-compilation if you use linux. You can use QEMU user mode emulation... it will emulate your Cortex-A8 CPU but all other system resources will be the same(RAM speed, disk speed, etc), you then don't need to play with cross-compilers etc... simply copy all your Cortex-A8 system to the folder on your PC, mount with --bind proc, dev, sys folders and chroot to this folder.
An idea of that you can get here: http://www.intestinate.com/pilfs/beyond.html#qemuuser
-
Hi,
“special cross compile solution” means for me that I edit and manage the project included the sources on x86 based PC but I run the qmake and compilation on the target architecture.
I don't see this solution nothing but I thing I have enough power for compilation.I compile qt framework on my embedded board and install it.
After that I made a simple project and try to compile on the embedded device. At compilation I get the following error:
g++ -Wl,-O1 -Wl,-rpath,/home/moravas/project/cubie/bin/lib -o masterController main.o -L/home/moravas/project/cubie/bin/lib -lQt5Core -lpthread
main.o: In functionQDebug::operator<<(char const*)': /home/moravas/project/build/embedded/masterController/masterController/../../../../cubie/bin/include/QtCore/qstring.h:909: undefined reference to
QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)'You can see that I would like call a simple
@
qDebug() << "something"
@I checked the library path: "-L/home/moravas/project/cubie/bin/lib", I found the libQt5Core.so.
This lib is exist and I list the symbols too and I found:
@
readelf -Ws libQt5Core.so | grep deallocate
3219: 0006dfed 20 FUNC GLOBAL DEFAULT 12 _ZN10QArrayData10deallocateEPS_jj
@I don't have any idea...
Regards,
Norbert