Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 170069 - [cross-spu-elf/newlib] unable to build newlib on ps3
Summary: [cross-spu-elf/newlib] unable to build newlib on ps3
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-09 09:05 UTC by Sebastian Siewior
Modified: 2009-05-02 02:57 UTC (History)
2 users (show)

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


Attachments
white space fix (whitespace-cflags.patch,785 bytes, patch)
2007-03-09 09:06 UTC, Sebastian Siewior
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Siewior 2007-03-09 09:05:18 UTC
First I die in configure:

configure: running /bin/sh '/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/configure' --prefix=/usr  '--cache-file=./config.cache' '--build=powerpc64-unknown-linux-gnu' '--host=spu-elf' '--target=spu-elf' '--with-newlib' '--with-cross-host=powerpc64-unknown-linux-gnu' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--enable-newlib-mb' '--enable-nls' '--disable-multilib' '--enable-newlib-hw-fp' '--disable-threads' '--libdir=/usr/lib64' '--program-transform-name=s,^,spu-elf-,; ' '--with-target-subdir=spu-elf' '--srcdir=/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib' 'CC=spu-elf-gcc -B/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/ -isystem /var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/targ-include -isystem /var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/include' 'CFLAGS=-O2 ' 'CPPFLAGS=' 'LDFLAGS=' 'build_alias=powerpc64-unknown-linux-gnu' 'host_alias=spu-elf' 'target_alias=spu-elf' --cache-file=.././config.cache --srcdir=/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc
configure: loading cache .././config.cache
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  -O2  
configure:   current value: -O2 
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm .././config.cache' and start over
configure: error: /bin/sh '/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/configure' failed for libc
make[1]: *** [configure-target-newlib] Error 1
make[1]: Leaving directory `/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build'
make: *** [all] Error 2

!!! ERROR: cross-spu-elf/newlib-1.15.0 failed.

This is a white space problem. I attach a fix similar to http://sourceware.org/ml/newlib/2006/msg00472.html
Comment 1 Sebastian Siewior 2007-03-09 09:06:50 UTC
Created attachment 112674 [details, diff]
white space fix

white space fix similar to http://sourceware.org/ml/newlib/2006/msg00472.html
Comment 2 Sebastian Siewior 2007-03-09 09:13:08 UTC
After that I get to next level:

make[5]: Entering directory `/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/libc/argz'
spu-elf-gcc -B/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/ -isystem /var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/targ-include -isystem /var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/include -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.15.0\" -DPACKAGE_STRING=\"newlib\ 1.15.0\" -DPACKAGE_BUGREPORT=\"\"  -I. -I/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/argz -O2 -ffunction-sections -fdata-sections  -DMISSING_SYSCALL_NAMES -fno-builtin      -O2 -c -o lib_a-dummy.o `test -f 'dummy.c' || echo '/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/newlib-1.15.0/newlib/libc/argz/'`dummy.c
cc1: error: unrecognized command line option "-m64"
make[5]: *** [lib_a-dummy.o] Error 1
make[5]: Leaving directory `/var/tmp/portage/cross-spu-elf/newlib-1.15.0/work/build/spu-elf/newlib/libc/argz'

Build process continues and stops later. 
Compiler flag -m64 is invalid for spu-elf-gcc, filter-flags -m64 does not work.
Comment 3 Maik Nijhuis 2007-10-22 12:05:38 UTC
Because newlib-1.15.0 doesn't define FP_ILOGB0, I grabbed the latest version from CVS, which doesn't have this problem. I created a local ebuild file based on the original newlib-1.15.0.ebuild to get it compiled.

I also encountered the -m64 issue. I managed to trace this to the fact that the environment variable CFLAGS_ppc64 is -m64. This is defined in make.defaults from the profile. When I added 'unset CFLAGS_ppc64' to the src_compile() section of the ebuild, the problem disappeared.

There was another problem with the original ebuild: In the line
[[ ${CTARGET} == "spu" ]] \
"spu" must be changed into "spu-elf" so it becomes
[[ ${CTARGET} == "spu-elf" ]] \
Comment 4 Luca Barbato gentoo-dev 2007-10-22 19:48:58 UTC
strange, I just rebuilt newlib with the latest crossdev and portage.

emerge info and crossdev version please
Comment 5 Maik Nijhuis 2007-10-23 14:50:31 UTC
My crossdev version is the latest (crossdev-0.9.18-r4).

Somehow I managed to break my spu toolchain while installing the other newlib. 
The linker complained that _init and _fini were not defined. I think I used the wrong compiler to compile the spu cross-toolchain.

I managed to get it to work again by performing these steps:
1. emerge sys-devel/binutils-2.18-r1
2. emerge sys-devel/gcc-4.3.0_alpha20070810. I had problems compiling a more recent gcc version so I tried this one and it worked.
3. Change default gcc to gcc-4.3.0_alpha20070810
4. emerge cross-spu-elf/binutils-2.18-r1
5. emerge cross-spu-elf/gcc-4.3.0_alpha20070810
6. emerge cross-spu-elf/newlib-1.15.0-r2. This is an ebuild I made that contains the whitespace patch, unsets CFLAGS_ppc64, and has spu changed into spu-elf as I said earlier.
7. Set default gcc back to gcc-4.1.2.

I thus didn't use crossdev to compile the cross-spu-elf/* stuff, but I manually emerged these from the command line.

emerge --info on the ps3 shows:

Portage 2.1.3.9 (default-linux/ppc/ppc64/2007.0/64bit-userland, gcc-4.1.2, glibc-2.5-r2, 2.6.23-rc8-gf7767dc7 ppc64)
=================================================================
System uname: 2.6.23-rc8-gf7767dc7 ppc64 Cell Broadband Engine, altivec supported
Timestamp of tree: Mon, 22 Oct 2007 12:20:01 +0000
app-shells/bash:     3.2_p15-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="ppc64"
CBUILD="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=970 -mtune=970 -mabi=altivec"
CHOST="powerpc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -pipe -mcpu=970 -mtune=970 -mabi=altivec"
DISTDIR="/tmp/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.easynet.nl/mirror/gentoo/ http://gentoo.oregonstate.edu/ http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LINGUAS="en nl"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/tmp/portage"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/toolchain /usr/portage/local/layman/cell /usr/local/overlays/lu_zero /usr/local/overlays/maik"
SYNC="rsync://rsync.nl.gentoo.org/gentoo-portage"
USE="a52 acl altivec bash-completion bitmap-fonts bluetooth cli cracklib crypt dri dts dvd dvdread fbcon ftp gpm iconv ipv6 isdnlog live midi mudflap ncurses nls nptl nptlonly offensive openmp pam pcre perl ppc64 pppd readline reflection session slang spl ssl stroke symlink tcpd threads tiff truetype-fonts type1-fonts unicode usb webdav x264 xorg xvid zlib" ALSA_PCM_PLUGINS="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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en nl" USERLAND="GNU" VIDEO_CARDS="dummy fbdev mach64 mga nv r128 radeon vega"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 6 Luca Barbato gentoo-dev 2007-10-23 16:07:15 UTC
you should use crossdev...
Comment 7 Luca Barbato gentoo-dev 2007-10-25 06:26:55 UTC
I eventually discovered what was wrong for you. wait about 2 hours and sync, I added an updated snapshot that build an links correctly.

Comment 8 Maik Nijhuis 2007-10-25 11:00:11 UTC
Without using crossdev I still get the -m64 error with  cross-spu-elf/newlib-1.16.0_pre20071025.

I didn't use crossdev before because crossdev has no option to only upgrade newlib, and not binutils, gcc etc. Crossdev always wants to upgrade my cross-gcc to the latest version, even though I specify a specific gcc version. I managed to get around this by changing
'cross-spu-elf/gcc' to '=cross-spu-elf/gcc-4.3.0_alpha20070810' in /etc/package.unmask.

With this setting, 'crossdev -v --g 4.3.0_alpha20070810 spu' worked perfect.
Comment 9 Mark Loeser (RETIRED) gentoo-dev 2009-05-02 02:57:15 UTC
As per Luca, this works if you use crossdev.  Someone reopen if I'm wrong and this is still an issue :)