Problems Cross Compiling Qt 4.7 from Source for Arm

Problems cross compiling Qt 4.7 from source for ARM


{standard input}:1294: Error: selected processor does not support Thumb mode 'swp r6,r4,[r3]'

Why is the compiler complaining that the thumb mode is not supported?

Note, the compiler is complaining about the swp instruction not being available for thumb mode. Your CPU supports thumb, thumb2, and ARM. The Cortex series deprecates the use of swp and prefers ldrex/strex pairs.

Any thoughts on what went wrong and how to fix this?

You need to get gcc to define __ARM_ARCH_7__; this is done with either -mcpu=cortex-a8 or the combination -mtune=cortex-a8 and -march=armv7-a or what ever you like depending on how many types of boards you want Qt to run on.

In detail, see qatomic_arm.h for where a sub-file is selected. You have a very generic ARM selected (I guess), so you get qatomic_armv5.hNote1 where you can see the code around line 125. The right file for your CPU is qatomic_armv7.h, which mainly just includes qatomic_armv6.h. In this file you can find ldrex/strex which is the wholesome goodness that your gcc is requesting.

I also suggest you do not compile with -fast. There is another question where the OP says this solved his issue; but I think this is different.

You can try to pass -armfpa to configure. ./configure -embedded arm --help is useful. configure appears to have selected NEON, so it seems to know you have a more advanced CPU (there is no NEON on an armv5, but this maybe a fault of configure).

For certain, you don't want the swp code and the ldrex/strex is preferred for your system, even if swp could somehow work. I would at least resolve this. Alter the -xplatform qws/linux-am335x-g++ to update -mcpu or possibly pass an explicit -D__ARM_ARCH_7__. You can get a list of defines with arm-gcc -mcpu=cortex-a8 -dM -E - < /dev/null, to verify that the __ARM_ARCH_7__ is being defined. It looks like it is moc failing, so maybe the -D__ARM_ARCH_7_ solution will be needed.

You might also try to alter -mthumb in the compiler option. It is probably best to use -mcpu=cortex-a8 and -mthumb for your system, if you can get that to compile/build. Omitting -mthumb will make the code slightly larger. You might also try -Os. For some reason, I have huge builds with other optimizations and more recent gcc versions. It appears to be due to some C++ feature as normal 'C' doesn't behave this way; but this may just be my compiler. I looked and believe it is the exception tables, but I never confirmed anything and moved on. I am sure you are aware of how long Qt takes to compile.

Note1: The qatomic_armv5.h code is fairly confused and newer gcc or binutils will choke even when this is the correct file to use.

 asm volatile("swpb %0,%2,[%3]"
: "=&r"(ret), "=m" (*ptr)
: "r"(newval), "r"(ptr)
: "cc", "memory");

This specifies some inline assembler parameters which are never used. Not to mention the condition codes are not used, etc.

asm volatile("swpb %0,%1,[%2]"
: "=r"(ret)
: "0"(newval), "r"(ptr)
: "memory");

will compile with newer gcc and binutils. It also uses less registers and is optimal for the way Qt is currently using it; there maybe cases where ret needs to be preserved to compare to newval but it is just a user space spin lock currently.

The bracket [x] is a memory operand register and must be different than the other two parameters for a valid swp. I believe the first form was used to stop %0 from being the same as %3. The 2nd form avoids this by making %0 and %1 the same, so %2 must be different.

Problem with cross-compiling Qt 5.9.8 for ARM

you have set the option -no-feature-completer, try to reconfigure the build without it.

Cross-compiling Qt for Pandaboard

To cross-compile a program on a PC you must have the development files for the same packages installed on the PC as the ARM target. Qt 4.8 depends on OpenSSL, so you must get the correct development files for the ARM release if you wish to compile Qt.

  1. Install a Ubuntu 12.04 PC virtual box. SAME VERSION as the board.
  2. Get the compiler. apt-get install arm-linux-gnueabihf (You knew that).
  3. Get required development packages. apt-get install libssl-dev or
    apt-get build-dep -aarmhf qt4 (which only works for X11).
  4. Edit your Qt configuration to suit your needs and build it.

The current step you are missing is step 3; but to perform it you need step 1 or some other way to get the OpenSSL development files for Ubuntu 12.04. There is probably some other way to do this using apt.sources. I think the steps above will be easiest for you.

Compiling QT from Source depends to original src directory

I finally found my fault! After making the projects I should execute nmake install or jom install ! After that it will generate the correct include files and Libs in prefix directory.

Missing libraries when installing qt-everywhere for cross-compiling on arm

Solved it turned out tslib was not correctly insttalled



Related Topics



Leave a reply



Submit