Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure cross-compile toolchain on QtCreator?

I have built a Qt toolchain using Yocto. I installed it and set the environment variables running the script generated by Yocto.

I open QtCreator and configure my cross-compiler kit following these instructions. I'm unable to build this:

#include <QApplication>
#include <QPushButton>


int main(int argc, char **argv)
{    
    QApplication a( argc, argv );    
    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );
    hello.show();    
    return a.exec();    
}

Getting this error:

(.qtversion[qt_version_tag]+0x0):-1: error: undefined reference to `qt_version_tag'

So I try to build this instead:

#include <stdio.h>

int main()
{
   printf("Hello world!\n");
   return 0;
}

It's ok. But when I deploy to my target and try to run it can't because it hasn't been compiled for target architecture (arm).

helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ldd

There is also this warning which could be very indicative:

:-1: warning: "/usr/bin/gcc" is used by qmake, but "/opt/poky/2.1.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc" is configured in the kit.
Please update your kit or choose a mkspec for qmake that matches your target environment better.

I tried to set mkspec on my kit configuration but the result it's the same.

like image 864
anat0lius Avatar asked Nov 27 '25 17:11

anat0lius


1 Answers

Solved. Maybe I "lied" about saying that setting the mkspec manually it wasn't working neither. That's not true, it does. It's just I was having another issues and couldn't test it properly. The problem was mkspec it wasn't the right. It was pointing to linux-g++ and I fixed it pointing to the proper mkspec. Anyway Qt cretator is telling me that he can't find it! so it's that a bug? The first issue (compiling GUI) was solved too thanks to this.

like image 181
anat0lius Avatar answered Nov 30 '25 18:11

anat0lius