<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>226035</bug_id>
          
          <creation_ts>2008-06-12 08:12 0000</creation_ts>
          <short_desc>sys-apps/iproute2-2.6.22.20070710 fail to cross-compile</short_desc>
          <delta_ts>2008-06-21 05:49:48 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>beber@meleeweb.net</reporter>
          <assigned_to>base-system@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>beber@meleeweb.net</who>
            <bug_when>2008-06-12 08:12:56 0000</bug_when>
            <thetext>iproute2 use host gcc in place of toolchain gcc so crosscompilation failed. Host gcc is used only in directory netem as you can see in this trace :

...
i586-geode-linux-uclibc-gcc -D_GNU_SOURCE -march=k6-2 -O2 -pipe -fomit-frame-pointer -Wstrict-prototypes -Wall -I../include -DRESOLVE_HOSTNAMES   -c -o
 lnstat_util.o lnstat_util.c
i586-geode-linux-uclibc-gcc   lnstat.o lnstat_util.o  -lresolv -L../lib -lnetlink -lutil -o lnstat
make[1]: Leaving directory `/var/tmp/portage/sys-apps/iproute2-2.6.22.20070710/work/misc&apos;
make[1]: Entering directory `/var/tmp/portage/sys-apps/iproute2-2.6.22.20070710/work/netem&apos;
gcc -D_GNU_SOURCE -march=k6-2 -O2 -pipe -fomit-frame-pointer -Wstrict-prototypes -Wall -I../include -o maketable maketable.c -lm
maketable.c:1: error: CPU you selected does not support x86-64 instruction set
maketable.c:1: error: CPU you selected does not support x86-64 instruction set
make[1]: *** [maketable] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-apps/iproute2-2.6.22.20070710/work/netem&apos;
make: *** [all] Error 2
 * 
 * ERROR: sys-apps/iproute2-2.6.22.20070710 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_compile
 *             environment, line 2056:  Called die
 * The specific snippet of code:
 *       emake CC=&quot;$(tc-getCC)&quot; AR=&quot;$(tc-getAR)&quot; || die &quot;make&quot;
 *  The die message:
 *   make
 * 
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at &apos;/var/log/portage/i586-geode-linux-uclibc/sys-apps:iproute2-2.6.22.20070710:20080612-080416.log&apos;.
 * The ebuild environment file is located at &apos;/var/tmp/portage/sys-apps/iproute2-2.6.22.20070710/temp/environment&apos;.
 * 

# /usr/bin/emerge --info
Portage 2.1.5.4 (uclibc/x86/2.4, gcc-3.4.6, uclibc-0.9.28.3-r3,
2.6.24-gentoo-r4 x86_64)
=================================================================
System uname: 2.6.24-gentoo-r4 x86_64 AMD Athlon(tm) 64 Processor 3200+
Timestamp of tree: Sun, 08 Jun 2008 14:16:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r4
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.25-r3
ACCEPT_KEYWORDS=&quot;x86&quot;
CBUILD=&quot;x86_64-pc-linux-gnu&quot;
CFLAGS=&quot;-march=k6-2 -O2 -pipe -fomit-frame-pointer&quot;
CHOST=&quot;i586-geode-linux-uclibc&quot;
CONFIG_PROTECT=&quot;/etc /var/bind&quot;
CONFIG_PROTECT_MASK=&quot;/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/
/etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release
/etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/
/etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo
/etc/texmf/web2c /etc/udev/rules.d&quot;
CXXFLAGS=&quot;-march=k6-2 -O2 -pipe -fomit-frame-pointer&quot;
DISTDIR=&quot;/usr/portage/distfiles&quot;
FEATURES=&quot;autoconfig distlocks nodoc noinfo noman parallel-fetch sandbox
sfperms strict unmerge-orphans userfetch&quot;
GENTOO_MIRRORS=&quot;http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/linux/distributions/gentoo&quot;
LANG=&quot;C&quot;
LC_ALL=&quot;C&quot;
LDFLAGS=&quot;&quot;
LINGUAS=&quot;&quot;
PKGDIR=&quot;/usr/portage/packages&quot;
PORTAGE_RSYNC_OPTS=&quot;--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --stats --timeout=180 --exclude=/distfiles
--exclude=/local --exclude=/packages&quot;
PORTAGE_TMPDIR=&quot;/var/tmp&quot;
PORTDIR=&quot;/usr/portage&quot;
PORTDIR_OVERLAY=&quot;/opt/meleeweb/portage&quot;
SYNC=&quot;rsync://rsync.gentoo.org/gentoo-portage&quot;
USE=&quot;cli cracklib crypt dri ipv6 midi mudflap ncurses openmp pcre perl readline
reflection session spl ssl tcpd uclibc x86 xorg zlib&quot; ALSA_PCM_PLUGINS=&quot;adpcm
alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa
lfloat linear meter mulaw multi null plug rate route share shm softvol&quot;
APACHE2_MODULES=&quot;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&quot; ELIBC=&quot;uclibc&quot;
INPUT_DEVICES=&quot;keyboard mouse evdev&quot; KERNEL=&quot;linux&quot; LCD_DEVICES=&quot;bayrad cfontz
cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text&quot; USERLAND=&quot;GNU&quot;
VIDEO_CARDS=&quot;dummy fbdev v4l&quot;
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, MAKEOPTS,
PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

This bug is a revival of #54943


Reproducible: Always

Steps to Reproduce:
1. ROOT=/root/cross/i586-geode-linux-uclibc
PORTAGE_CONFIGROOT=/etc/ct/i586-geode-linux-uclibc
CHOST=i586-geode-linux-uclibc CBUILD=x86_64-pc-linux-gnu emerge -vat iproute2</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2008-06-12 13:13:39 0000</bug_when>
            <thetext>that is because host gcc is *supposed* to be used in the netem subdirectory.  it&apos;s building utilities that it then executes.

the problem is that the target CFLAGS bleed and get used when executing on the build system.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>beber@meleeweb.net</who>
            <bug_when>2008-06-12 17:31:16 0000</bug_when>
            <thetext>Yes, I corrected the &quot;bug&quot; by doing that :

On iproute2 source
--- netem/Makefile.ori	2008-06-12 10:44:19.000000000 +0200
+++ netem/Makefile	2008-06-12 10:45:07.000000000 +0200
@@ -2,6 +2,7 @@
 DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist
 
 HOSTCC ?= $(CC)
+CCOPTS  = $(CBUILD_CFLAGS)
 LDLIBS += -lm 
 
 all: $(DISTGEN) $(DISTDATA)

On iproute2 ebuild
--- /usr/portage/sys-apps/iproute2/iproute2-2.6.22.20070710.ebuild	2008-03-11 18:07:50.000000000 +0100
+++ iproute2-2.6.22.20070710.ebuild	2008-06-12 10:49:15.000000000 +0200
@@ -38,6 +38,7 @@
 	sed -i &quot;s:-O2:${CFLAGS}:&quot; Makefile || die &quot;sed Makefile failed&quot;
 
 	epatch &quot;${FILESDIR}&quot;/${PN}-2.6.16.20060323-build.patch #137574
+	epatch &quot;${FILESDIR}&quot;/${PN}-2.6.22.20070710-netem-hostcc.diff
 
 	local check base=${PORTAGE_CONFIGROOT}/etc/portage/patches
 	for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do

Then build like that :
ROOT=/root/cross/i586-geode-linux-uclibc
PORTAGE_CONFIGROOT=/etc/ct/i586-geode-linux-uclibc
CHOST=i586-geode-linux-uclibc CBUILD=x86_64-pc-linux-gnu CBUILD_CFLAGS=&quot;-march=athlon64 -O2 -pipe -fomit-frame-pointer&quot; emerge -vat iproute2

It&apos;s really bad and just home working, so didn&apos;t post any fix.

But, what could be done for that ? Desactivate SUBDIR for cross compilation ? Get upstream ?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vapier@gentoo.org</who>
            <bug_when>2008-06-21 05:49:48 0000</bug_when>
            <thetext>added your fix to cvs, thanks

http://sources.gentoo.org/sys-apps/iproute2/iproute2-2.6.25.20080417.ebuild?r1=1.1&amp;r2=1.2
http://sources.gentoo.org/sys-apps/iproute2/files/iproute2-2.6.25.20080417-build.patch?rev=1.1</thetext>
          </long_desc>
      
    </bug>

</bugzilla>