From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] Qtopia4 build issue
Date: Fri, 27 Feb 2009 15:27:17 +0100 [thread overview]
Message-ID: <20090227152717.5cefcd92@surf> (raw)
In-Reply-To: <20090226162124.2d78cfa4@surf>
Le Thu, 26 Feb 2009 16:21:24 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> Ok, I think I found a fix for the issue. First of all, the problem
> only occurs when cross-compiling on x86 to x86. I will cleanup my fix
> later today or tomorrow and submit for discussion.
Here is a discussion patch to fix the Qtopia build issue when the
target architecture is x86. This patch is *not* meant for inclusion,
only for discussions since it has known issues and isn't very clean.
Please tell me if the approach seems correct. If so, I will provide a
cleaned up patch, suitable for inclusion.
Sincerly,
Thomas
===================================================================
Fix Qtopia4 build when target arch = host arch
The Qtopia build process needs to build host tools (qmake, moc and
others) before building the library for the target. Of course, the
host tools must be built with the usual host compiler, while the
libraries must be built with the cross-compiler (generated by
Buildroot or external).
As Qtopia doesn't use the traditionnal autotools, the build process is
a bit unusual. In the Qtopia source tree, in the mkspecs/qws/
directory, there are several directories for various supported
targets: linux-x86-g++, linux-arm-g++, linux-avr32-g++, etc. Each of
these directories contains a qmake.conf which defines the path to the
C and C++ cross-compilers and other configuration values.
When passing the -embedded arm argument to the Qtopia configure
script, Qtopia will :
* Use the parameters defined in linux-x86-g++/qmake.conf to build
host tools ;
* Use the parameters defined in linux-arm-g++/qmake.conf to build the
target libraries.
Since linux-arm-g++/qmake.conf doesn't necessarly match Buildroot
toolchain configuration, this file gets patched by Buildroot
qtopia4.mk Makefile.
This all works fine until the target arch is the same as the host arch
(such as x86 on x86). In this case, Qtopia will use the parameters in
linux-x86-g++/qmake.conf for both the host tools and the target
libraries. As this file has been patched by Buildroot qtopia4.mk
Makefile, it references the Buildroot toolchain. So, the host tools
(qmake, moc and probably others) get compiled with the
i686-linux-uclibc-gcc compiler. And these binaries obviously don't run
on the host system since the host system is not uClibc-based.
So, on x86, we must differentiate the configuration used during Qtopia
build for the host tools and the target libraries. This is possible
through the -platform and -xplatform configuration options, as
explained in the Qt documentation
(http://doc.trolltech.com/4.4/qt-embedded-crosscompiling.html#step-2-create-a-target-specific-qmake-specification)
The approach of my patch is to differentiate these two
configurations. The QTOPIA4_QMAKE_CONF variable is removed in favor of
three variables :
* QTOPIA4_PLATFORM_QMAKE_CONF_DIR, which points to the configuration
used to build the host tools (this variable will be used for the
-platform ./configure option).
Currently, it is hardcoded to linux-x86-g++, which obviously isn't
correct for people using Buildroot on x86_64 or PowerPC or
something else.
* QTOPIA4_XPLATFORM_ORIG_QMAKE_CONF_DIR, which points to an existing
configuration for the target architecture (might be linux-x86-g++,
linux-arm-g++ or whatever)
* QTOPIA_XPLATFORM_QMAKE_CONF_DIR, which points to a non-existing
configuration for the target architecture. This configuration will
be created by Buildroot qtopia4.mk Makefile from the
QTOPIA4_XPLATFORM_ORIG_QMAKE_CONF_DIR by modifying the appropriate
configuration settings. QTOPIA_XPLATFORM_QMAKE_CONF_DIR will be
used for the -xplatform ./configure option.
Then, before running the configure script, we :
* Copy QTOPIA4_XPLATFORM_ORIG_QMAKE_CONF_DIR (which exists) to
QTOPIA_XPLATFORM_QMAKE_CONF_DIR (which didn't exist) ;
* Patch qmake.conf in QTOPIA_XPLATFORM_QMAKE_CONF_DIR as was already
done before in qtopia4.mk. The difference is that we don't patch
something provided by Qtopia, but we make a copy of it before
patching the new copy.
Finally, we run the configure script with :
-platform qws/linux-x86-g++
-xplatform qws/linux-buildroot-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++
And it works :-)
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/qtopia4/qtopia4.mk | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
Index: buildroot/package/qtopia4/qtopia4.mk
===================================================================
--- buildroot.orig/package/qtopia4/qtopia4.mk
+++ buildroot/package/qtopia4/qtopia4.mk
@@ -322,7 +322,9 @@
BR2_PACKAGE_QTOPIA4_EMB_PLATFORM:=$(strip $(subst ",, $(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)))
#"))
-QTOPIA4_QMAKE_CONF:=$(QTOPIA4_TARGET_DIR)/mkspecs/qws/linux-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++/qmake.conf
+QTOPIA4_PLATFORM_QMAKE_CONF_DIR:=$(QTOPIA4_TARGET_DIR)/mkspecs/qws/linux-x86-g++/
+QTOPIA4_XPLATFORM_ORIG_QMAKE_CONF_DIR:=$(QTOPIA4_TARGET_DIR)/mkspecs/qws/linux-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++/
+QTOPIA4_XPLATFORM_QMAKE_CONF_DIR:=$(QTOPIA4_TARGET_DIR)/mkspecs/qws/linux-buildroot-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++/
# Variable for other Qt applications to use
QTOPIA4_QMAKE:=$(STAGING_DIR)/usr/bin/qmake -spec qws/linux-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++
@@ -346,15 +348,16 @@
$(SED) 's/^CFG_IPV6IFNAME=auto/CFG_IPV6IFNAME=no/' $(QTOPIA4_TARGET_DIR)/configure
endif
$(SED) 's/^CFG_XINERAMA=auto/CFG_XINERAMA=no/' $(QTOPIA4_TARGET_DIR)/configure
+ cp -a $(QTOPIA4_XPLATFORM_ORIG_QMAKE_CONF_DIR) $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)
#$(SED) 's,-O2,$(TARGET_CFLAGS),' $(QTOPIA4_QMAKE_CONF)
# Fix compiler path
- $(SED) '\,QMAKE_CC[ ]*=, c\QMAKE_CC = $(TARGET_CC)' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_CXX[ ]*=, c\QMAKE_CXX = $(TARGET_CXX)' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_LINK[ ]*=, c\QMAKE_LINK = $(TARGET_CXX)' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_LINK_SHLIB[ ]*=, c\QMAKE_LINK_SHLIB = $(TARGET_CXX)' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_AR[ ]*=, c\QMAKE_AR = $(TARGET_AR) cqs' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_RANLIB[ ]*=, c\QMAKE_RANLIB = $(TARGET_RANLIB)' $(QTOPIA4_QMAKE_CONF)
- $(SED) '\,QMAKE_STRIP[ ]*=, c\QMAKE_STRIP = $(TARGET_STRIP)' $(QTOPIA4_QMAKE_CONF)
+ $(SED) '\,QMAKE_CC[ ]*=, c\QMAKE_CC = $(TARGET_CC)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_CXX[ ]*=, c\QMAKE_CXX = $(TARGET_CXX)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_LINK[ ]*=, c\QMAKE_LINK = $(TARGET_CXX)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_LINK_SHLIB[ ]*=, c\QMAKE_LINK_SHLIB = $(TARGET_CXX)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_AR[ ]*=, c\QMAKE_AR = $(TARGET_AR) cqs' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_RANLIB[ ]*=, c\QMAKE_RANLIB = $(TARGET_RANLIB)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
+ $(SED) '\,QMAKE_STRIP[ ]*=, c\QMAKE_STRIP = $(TARGET_STRIP)' $(QTOPIA4_XPLATFORM_QMAKE_CONF_DIR)/qmake.conf
-[ -f $(QTOPIA4_QCONFIG_FILE) ] && cp $(QTOPIA4_QCONFIG_FILE) \
$(QTOPIA4_TARGET_DIR)/$(QTOPIA4_QCONFIG_FILE_LOCATION)
@@ -385,11 +388,13 @@
-no-rpath \
-nomake examples \
-nomake demos \
+ -platform qws/linux-x86-g++ \
+ -xplatform qws/linux-buildroot-$(BR2_PACKAGE_QTOPIA4_EMB_PLATFORM)-g++ \
)
touch $@
$(QTOPIA4_TARGET_DIR)/.compiled: $(QTOPIA4_TARGET_DIR)/.configured
- $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(QTOPIA4_TARGET_DIR)
+ $(MAKE) -C $(QTOPIA4_TARGET_DIR)
touch $@
$(STAGING_DIR)/usr/lib/libQtCore.la: $(QTOPIA4_TARGET_DIR)/.compiled
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2009-02-27 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 11:22 [Buildroot] Qtopia4 build issue Thomas Petazzoni
2009-02-26 12:42 ` steve at c2root.be
2009-02-26 13:13 ` Thiago A. Corrêa
2009-02-26 15:21 ` Thomas Petazzoni
2009-02-27 14:27 ` Thomas Petazzoni [this message]
2009-03-31 21:54 ` Peter Korsgaard
2009-03-31 23:31 ` Thomas Petazzoni
2009-04-01 8:04 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090227152717.5cefcd92@surf \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox