Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 261412 - x11-libs/qt-core-4.5.0 fails to build on ppc64 (32-bit ul); attempts to build with -m64
Summary: x11-libs/qt-core-4.5.0 fails to build on ppc64 (32-bit ul); attempts to build...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: PPC64 Linux
: High normal with 1 vote (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 266201
  Show dependency tree
 
Reported: 2009-03-06 05:03 UTC by Ian Leonard
Modified: 2009-05-12 20:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Leonard 2009-03-06 05:03:03 UTC
x11-libs/qt-core-4.5.0 fails to install under ppc64 (64-bit kernel, 32-bit UL). My guess is it checks the kernel for what architecture to build. This seems confirmed as running linux32 prior to emerging will trick qt-core into building as 32-bit. Manual trickery should not be necessary while using the recommended userland under ppc64.

Reproducible: Always

Steps to Reproduce:
1.emerge -1v =qt-core-4.5.0

Actual Results:  
This is the Qt/X11 Open Source Edition.

Determining system architecture... (Linux:2.6.29-rc5:ppc64)
    64-bit PowerPC (powerpc)
    'powerpc' is supported
System architecture: 'powerpc'
Symbol visibility control enabled.
Symbolic function binding enabled.
You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 2.1 or
the GNU General Public License (GPL) version 3.

You have already accepted the terms of the  license.

Creating qmake. Please wait...
project.cpp:1: error: -m64 not supported in this configuration
gmake: *** [project.o] Error 1

ERROR: x11-libs/qt-core-4.5.0 failed.


emerge --info

Portage 2.1.6.7 (default/linux/powerpc/ppc64/2008.0/32bit-userland, gcc-4.3.3, glibc-2.9_p20081201-r2, 2.6.29-rc5 ppc64)
=================================================================
System uname: Linux-2.6.29-rc5-ppc64-Cell_Broadband_Engine,_altivec_supported-with-glibc2.0
Timestamp of tree: Fri, 06 Mar 2009 02:30:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.4.4-r13, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
dev-util/cmake:      2.6.3
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.4.3-r1
sys-apps/sandbox:    1.3.9
sys-devel/autoconf:  2.63
sys-devel/automake:  1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.28-r1
ACCEPT_KEYWORDS="ppc"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=cell"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe -mcpu=cell"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
LINGUAS="en en_US"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl alsa altivec berkdb bzip2 cli cracklib crypt cups dbus dri fbcon fortran gcc64 gdbm gpm hal iconv ipv6 isdnlog kde midi mudflap ncurses nls nptl nptlonly opengl openmp pam pcre pdf perl ppc pppd python readline reflection sdl session spl srt ssl sysfs tcpd tiff unicode x264 xorg xvid zlib" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus aoa-soundbus-i2s aoa-tas aoa-toonie powermac usb-audio via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" USERLAND="GNU" VIDEO_CARDS="fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-03-06 05:37:26 UTC
thx for the report. Assigning to maintainers and CC'ing ppc64 team for additional advice if needed.
Comment 2 Brent Baude (RETIRED) gentoo-dev 2009-03-16 14:05:57 UTC
will look into it; usually a naughty assumption based on uname or something
Comment 3 Brent Baude (RETIRED) gentoo-dev 2009-03-17 15:47:12 UTC
Here is a lengthy update.  First, a little background for those not familiar with PowerPC.  With Gentoo, we offer three flavors:

1.  ppc - 32bit kernel, 32bit userland, arch is ppc
2.  ppc64 32UL - 64 bit kernel, 32bit userland, arch is ppc
3.  ppc64 64UL - 64 bit kernel, 64bit userland, arch is ppc64

The problem for this bug is option 2.

Qt-4.5 (and earlier) uses the various results of uname -foo to determine what architecture, OS, etc it is working on.  It then makes assumptions based on that for compilation.  The most important assumption for powerpc is that it assumes if it finds a 64bit (ppc64) kernel, the userland should also be 64bit.  Same for ppc being 32bit.  The latter is a safe assumption.  The former is th crux of the problem for scenario 2.

The previous (qt-4.4) configure scripts seem to be able to deal with this.  I'm not sure why--the configure scripts differ a fair amount between 4.4 and 4.5.

There are numerous ways to deal with this.  Here is one which I have tested.  Consider this patch for the ebuild:


--- qt-core-4.5.0.ebuild        2009-03-17 10:15:21.000000000 -0500
+++ qt-core-4.5.0.ebuild.orig   2009-03-17 10:10:44.000000000 -0500
@@ -139,9 +139,6 @@
                myconf="${myconf} -nomake docs"
        fi
 
-       # Bug 261412 Qt configure detects archs by uname
-       [[ ${ARCH} == "ppc" ]] && myconf="${myconf} -platform linux-g++-32"
-
        cp -f "${FILESDIR}"/moc.pro "${S}"/src/tools/moc/
        cp -f "${FILESDIR}"/rcc.pro "${S}"/src/tools/rcc/
        cp -f "${FILESDIR}"/uic.pro "${S}"/src/tools/uic/

Basically, we determine if the arch is ppc, then pass the appropriate platform.  This gcc tupple makes the configure script get the right compiler.  This is tested and works fine.  I assume no objection from the ppc32 proper folks would exist.  If there is, we can test for both arch being ppc and the kernel arch being ppc64 to make the test more selective.

There is one negative side effect to this (and it was present in qt-4.4), though as I said earlier the configuration script dealt with it.  Even with the patched ebuild, the output for the qt build will produce something like:

This is the Qt/X11 Open Source Edition.

Determining system architecture... (Linux:2.6.25-gentoo-r7:ppc64)
    64-bit PowerPC (powerpc)
    'powerpc' is supported
System architecture: 'powerpc'

So, in addition to patching the ebuild, something like this might be really nice:

--- qt-x11-opensource-src-4.5.0.orig/configure  2009-02-25 15:09:13.000000000 -0600
+++ qt-x11-opensource-src-4.5.0/configure       2009-03-17 10:08:57.000000000 -0500
@@ -2480,7 +2480,9 @@
         CFG_HOST_ARCH=powerpc
         ;;
     *:*:ppc64)
-        if [ "$OPT_VERBOSE" = "yes" ]; then
+        if [ "$PLATFORM" = "linux-g++-32" ]; then
+            echo "    32-bit userland with 64-bit PowerPC (powerpc) kernel"
+       else
             echo "    64-bit PowerPC (powerpc)"
         fi
         CFG_HOST_ARCH=powerpc


Ok, a couple of other thoughts.  If we have a good relationship with qt upstream, we could consider asking them to advise on this.  They do similar foo as I posted above in their configure script for amd.  It would seem they could make this change for powerpc as well.

Lastly, if we choose to go this route, we need to change all the qt-*-4.5 ebuilds unless there is some qt-4 eclass trickery we can do.

Comment 4 Markos Chandras (RETIRED) gentoo-dev 2009-03-18 09:30:09 UTC
Brent, that was an excellent analysis. However patching all the ebuilds is not that handy. One way ( but I am not that happy about this ) to fix this is by creating a tarball with patches for ppc64,mirror it , and use it when ${ARCH}=ppc is detected. This patching should be done directly on eclass and not on every single ebuild. 
Since you have a good relationship with qt upstream, it would be nice to provide your patches upstream just to let them know what this is all about. If those stuff are fixed upstream they will help us a lot :)

Let me know if you contact them
Comment 5 Brent Baude (RETIRED) gentoo-dev 2009-04-15 17:33:59 UTC
Markos, I don't have any relationship with QT upstream.  I'm  sorry if I inferred that I did.

When you say won't patch the ebuilds, do you mean you would not add:

       # Bug 261412 Qt configure detects archs by uname
       [[ ${ARCH} == "ppc" ]] && myconf="${myconf} -platform linux-g++-32"

to the qt ebuilds?  or are you referring to the second suggestion which is an actual patch to make things *appear* better?
Comment 6 Ian Leonard 2009-05-12 02:54:21 UTC
Problem remains in 4.5.1. Adding block to #266201
Comment 7 Markos Chandras (RETIRED) gentoo-dev 2009-05-12 19:06:34 UTC
I applied that patch proposed by Brent on qt4-build eclass. Could you please resync your tree and try to recompile qt-4.5
Comment 8 Brent Baude (RETIRED) gentoo-dev 2009-05-12 20:44:24 UTC
solution worked....