Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Qtopia4 build issue
@ 2009-02-26 11:22 Thomas Petazzoni
  2009-02-26 12:42 ` steve at c2root.be
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2009-02-26 11:22 UTC (permalink / raw)
  To: buildroot

Hi,

With latest SVN, Qtopia4 doesn't build on i386. The problem is that
'qmake' is being built with the target compiler instead of the host
compiler, while qmake is supposed to be executed on the host.

Buildroot's qtopia4.mk Makefile patches the Qmake configuration file to
set the correct path to the compiler.

But Qt's ./configure script looks inside the Qmake configuration to
know which compiler to use to compile Qmake itself, unless the CC and
CXX variables are overriden.

So I'm not sure what the correct fix for this issue is (maybe setting
CC and CXX ?), but there's clearly an issue here.

Anyone having the same problem ?

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  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
  2 siblings, 0 replies; 8+ messages in thread
From: steve at c2root.be @ 2009-02-26 12:42 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

I have the same issue with the general release and allan confirmed he  
saw it too

regards
Citeren Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:

> Hi,
>
> With latest SVN, Qtopia4 doesn't build on i386. The problem is that
> 'qmake' is being built with the target compiler instead of the host
> compiler, while qmake is supposed to be executed on the host.
>
> Buildroot's qtopia4.mk Makefile patches the Qmake configuration file to
> set the correct path to the compiler.
>
> But Qt's ./configure script looks inside the Qmake configuration to
> know which compiler to use to compile Qmake itself, unless the CC and
> CXX variables are overriden.
>
> So I'm not sure what the correct fix for this issue is (maybe setting
> CC and CXX ?), but there's clearly an issue here.
>
> Anyone having the same problem ?
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers and embedded Linux development,
> consulting, training and support.
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  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
  2 siblings, 0 replies; 8+ messages in thread
From: Thiago A. Corrêa @ 2009-02-26 13:13 UTC (permalink / raw)
  To: buildroot

Hi,

On Thu, Feb 26, 2009 at 8:22 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hi,
>
> With latest SVN, Qtopia4 doesn't build on i386. The problem is that
> 'qmake' is being built with the target compiler instead of the host
> compiler, while qmake is supposed to be executed on the host.
>
> Buildroot's qtopia4.mk Makefile patches the Qmake configuration file to
> set the correct path to the compiler.

Yes, but that's for the target .conf file, which is used by qmake, and
qmake isn't used to build qmake, instead the package comes with a
Makefile for that.
Without it, qmake generated Makefiles will just fail to find the toolchain.

> But Qt's ./configure script looks inside the Qmake configuration to
> know which compiler to use to compile Qmake itself, unless the CC and
> CXX variables are overriden.

I don't remember configure doing that, but then perhaps it changed in
newer versions.

> So I'm not sure what the correct fix for this issue is (maybe setting
> CC and CXX ?), but there's clearly an issue here.

You could configure with -fast first, this generates moc Makefiles
that will call qmake later, than fix the compiler paths after
configure has run.
This would fix the chicken-egg issue.

> Anyone having the same problem ?

I could build on AVR32 and the apps using it runs fine on the target.
It must be i386 specific.

Kind Regards,
    Thiago A. Correa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  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
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2009-02-26 15:21 UTC (permalink / raw)
  To: buildroot

Le Thu, 26 Feb 2009 12:22:05 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

> With latest SVN, Qtopia4 doesn't build on i386. The problem is that
> 'qmake' is being built with the target compiler instead of the host
> compiler, while qmake is supposed to be executed on the host.

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.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  2009-02-26 15:21 ` Thomas Petazzoni
@ 2009-02-27 14:27   ` Thomas Petazzoni
  2009-03-31 21:54     ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2009-02-27 14:27 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  2009-02-27 14:27   ` Thomas Petazzoni
@ 2009-03-31 21:54     ` Peter Korsgaard
  2009-03-31 23:31       ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Korsgaard @ 2009-03-31 21:54 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 Thomas> Le Thu, 26 Feb 2009 16:21:24 +0100,
 Thomas> 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.

 Thomas> Here is a discussion patch to fix the Qtopia build issue when the
 Thomas> target architecture is x86. This patch is *not* meant for inclusion,
 Thomas> only for discussions since it has known issues and isn't very clean.

 Thomas> Please tell me if the approach seems correct. If so, I will
 Thomas> provide a cleaned up patch, suitable for inclusion.

Is this still needed? I don't normally use QT, but built it earlier
today without problems (after the fixes I committed today).

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  2009-03-31 21:54     ` Peter Korsgaard
@ 2009-03-31 23:31       ` Thomas Petazzoni
  2009-04-01  8:04         ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2009-03-31 23:31 UTC (permalink / raw)
  To: buildroot

Hi Peter,

Le Tue, 31 Mar 2009 23:54:39 +0200,
Peter Korsgaard <jacmet@uclibc.org> a ?crit :

> Is this still needed? I don't normally use QT, but built it earlier
> today without problems (after the fixes I committed today).

I worked on Qt build issues on Sunday, but didn't had the time to reach
a submitable state before the end of day. Definitely, on Sunday, quite
a few modifications were needed to get Qtopia4 to build properly (with
an external toolchain, or on a x86). But I suspect that your recent
changes fix at least part of these issues. I'll have a try at them
soonish and I'll let you know.

Thanks for the improvements!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] Qtopia4 build issue
  2009-03-31 23:31       ` Thomas Petazzoni
@ 2009-04-01  8:04         ` Peter Korsgaard
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2009-04-01  8:04 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 Thomas> I worked on Qt build issues on Sunday, but didn't had the
 Thomas> time to reach a submitable state before the end of
 Thomas> day. Definitely, on Sunday, quite a few modifications were
 Thomas> needed to get Qtopia4 to build properly (with an external
 Thomas> toolchain, or on a x86). But I suspect that your recent
 Thomas> changes fix at least part of these issues. I'll have a try at
 Thomas> them soonish and I'll let you know.

It first built here for my host (x86_64) (by accident because of the
bug in qtopia4.mk), and after the fixes it now builds for ppc as well,
so hopefully it should work for you as well.

 Thomas> Thanks for the improvements!

You're welcome.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-01  8:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-03-31 21:54     ` Peter Korsgaard
2009-03-31 23:31       ` Thomas Petazzoni
2009-04-01  8:04         ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox