2

I want to compile a Qt program for an ARM device.

I installed the toolchain for ARM and here is how my qmake.conf file looks like:

#
# qmake configuration for building with arm-none-linux-gnueabi-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabi-gcc
QMAKE_CXX               = arm-linux-gnueabi-g++
QMAKE_LINK              = arm-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabi-g++
QMAKE_CFLAGS += -O3 -march=armv5te
QMAKE_CXXFLAGS += -O3 -march=armv5te
QMAKE_INCDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
QMAKE_INCDIR_QT = /usr/share/qt4/include
QMAKE_LIBDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/lib


# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabi-objcopy
QMAKE_STRIP             = arm-linux-gnueabi-strip

load(qt_config)

The problem is that if I include (as shown above):

QMAKE_INCDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
QMAKE_INCDIR_QT = /usr/share/qt4/include
QMAKE_LIBDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/lib

I get an error that says :

main.cpp:1:30: fatal error: QtGui/QApplication: No such file or directory

And if I exclude :

QMAKE_INCDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include
QMAKE_LIBDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/lib

I get an error that says :

/usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in ‘asm’

I am new to this and have been struggling for over 40 hours this week and can't find what's the problem.

I can compile a simple c++ program for the ARM device, but when I try to use Qt I get the above errors so I think that the problem is in 1 case that the Qt headers are not loaded and in the other that the wrong converter file from c++ to asm is used.

23
  • 1
    Why don't you use the existing specs? Is it some specific ARM not yet supported by Qt proper? Have you tried qmake -spec linux-arm-gnueabi-g++ without your custom ARM setup? Commented Dec 20, 2013 at 10:11
  • Thank for the reply. It is nothing too fancy, but that's the way I found that I should do the compiling so that's how I have done. Commented Dec 20, 2013 at 10:17
  • Try to drop your work, and use the builtin qmake mkspecs support for it. Let me know the result of this trial. Commented Dec 20, 2013 at 10:18
  • Well the above pasted qmake.conf is from qt4/mkspecs/qws/linux-arm-gnueabi-g++ in which I added QMAKE_CFLAGS += -O3 -march=armv5te QMAKE_CXXFLAGS += -O3 -march=armv5te QMAKE_INCDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/include QMAKE_INCDIR_QT = /usr/share/qt4/include QMAKE_LIBDIR_QT = /opt/FriendlyARM/toolschain/4.5.1/arm-none-linux-gnueabi/lib because I was confused why the x86_64 header is used. If I remove the above rows and let it be like it was when installed I get /usr/include/qt4/QtCore/qatomic_x86_64.h:133:29: error: impossible constraint in ‘asm’. Commented Dec 20, 2013 at 10:23
  • qws is not what I was suggesting. I was suggesting the non-qws version! Please run qmake -spec linux-arm-gnueabi-g++ as suggested. Commented Dec 20, 2013 at 10:25

2 Answers 2

2

Just reading the message, qatomic_x86_64.h is rather suspicious in an ARM build. That's obviously the wrong toolchain. So, you definitely need the first statements to select the ARM toolchain.

However, I'm uncertain why your approach to fix a missing include is to remove even more include directories. Nor do I understand why you assume a Qt library is missing when the error is clearly on a header inclusion.

As far as I can see, the only problem is that QtGui\ is a relative path, which is not found in any QMAKE_INCDIR_QT directory. Where is your QtGui include directory?

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the reply. My QtGui is in /usr/share/qt4/include
@NAlex : That's probably QtGui from the x86_64 toolchain.
Yes, probably, but I can't find another include directory in Qt. In the QtCore directory I can see multiple headers like: qatomic_arm.h , qatomic_i386.h, qatomic_x86_64.h etc. So I think they are all there, but Qt uses the wrong one.
It's not the wrong tool-chain, but that the toolchain is using the host's include path. If you get this to compile at all, it's a recipe for odd behaviour at runtime. You need to add the --sysroot option to GCC to point the compiler to your target's header and library files rather than the host's.
Sorry for late reply but I was on vacation. Could you give me more details, please? Until now I only used the command line to compile for the machine I was using, and did not cross-compile.
0

I managed to compile it, the problem was that I used the wrong options for ./configure when installing Qt embedded. After starting from scratch it worked without problems.

The options used: ./configure -opensource -confirm-license -no-pch -embedded arm -platform qws/linux-x86_64-g++ -xplatform linux-arm-gnueabi-g++ -little-endian -no-webkit

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.