Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GCC-3.4.1 + PPC = works =)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
Twist
Guru
Guru


Joined: 03 Jan 2003
Posts: 414
Location: San Diego

PostPosted: Sat Aug 14, 2004 1:35 am    Post subject: GCC-3.4.1 + PPC = works =) Reply with quote

Just an FYI for people who feel adventurous. I just did a full build from scratch (new install). Started with the 2004.1 stage1, bootstrapped, emerged GCC-3.4.1 (had to edit the ebuild to make it not care about libstdc++-v3, which it doens't need), emerged glibc, re-emerged the bootstrap packages, and then from there system, edit USE flags, world, add my own frills (currently gnome, mozilla, firefox, standard stuff) et voila.


The machine is a Windtunnel dual-G4 btw @1.25Ghz each. The kernel is 2.6.7-r13 with SMP, preemptive enabled.

Code:

dual-g4 ~ # gcc-config -l
[1] powerpc-unknown-linux-gnu-3.3.3
[2] powerpc-unknown-linux-gnu-3.4.1
dual-g4 ~ # gcc-config -c
powerpc-unknown-linux-gnu-3.4.1

dual-g4 ~ # emerge -p glibc

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild     UD] sys-libs/glibc-2.3.3.20040420-r1 [2.3.4.20040808]


Further, because I figured 3.4.1 could handle it, I threw in ~ppc as my arch and used aggressive CFLAGS:

Code:

CFLAGS="-O3 -mcpu=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt -fsigned-char -pipe"

# If you set a CFLAGS above, then this line will set your default C++ flags to
# the same settings.
CXXFLAGS="${CFLAGS}"


So far in early testing it has shown no weirdness whatsoever. I'm going to emerge KDE and a variety of other challenging things and see it how it does with them (it did compile QT fine, which has always been problematic on ppc for me).

-Twist
Back to top
View user's profile Send private message
fb
l33t
l33t


Joined: 08 Dec 2003
Posts: 636
Location: New Zealand

PostPosted: Sat Aug 14, 2004 3:12 am    Post subject: Reply with quote

8O Woa!
Your FLAGS do seem agressive.
Not to mention the benefit of -O3 are not guaranted.

What surprise me is that for gcc3.3 we have been told with a big clue
stick to include the following flag: -fno-strict-aliasing.

Has this requirement diseapered in gcc3.4.x ?

Cheers,
Francois
Back to top
View user's profile Send private message
Twist
Guru
Guru


Joined: 03 Jan 2003
Posts: 414
Location: San Diego

PostPosted: Sat Aug 14, 2004 5:16 am    Post subject: Reply with quote

Quote:

Not to mention the benefit of -O3 are not guaranted.


...on GCC 3.2, which is where that came from. -O3 is sort of questionable in any case, PPC architecture or not, but I put it in on purpose to see if I got any of the instability that resulted in that warning from the 3.2 days. So far, nothing (and no, I have not exhaustively tested yet - but Firefox and Ethereal are both complex apps that ran fine).

Quote:

What surprise me is that for gcc3.3 we have been told with a big clue
stick to include the following flag: -fno-strict-aliasing.


If it's so universal, it should be in the PPC default make.conf =) (it's not). But in any case, given that 3.4 got so much attention to the optimization path, I figure all of that code got a few make oevers and some of this behavior is going to change. It's certainly true I don't have no-strict-aliasing on, but many ebuilds will supply it manually (and the kernel does as well).

-Twist
Back to top
View user's profile Send private message
amitofu
n00b
n00b


Joined: 16 Feb 2004
Posts: 30

PostPosted: Mon Aug 16, 2004 7:05 am    Post subject: Reply with quote

I just did a normal bootstrap, emerged gcc-3.4.1-r2 and rebootstrapped. My initial CFLAGS were:

Code:
-mcpu=7450 -maltivec -mabi=altivec -O2 -frename-registers -fweb -pipe


the boostrap failed on glibc (I should have taken note of where). I rebootstrapped with the following CFLAGS

Code:
-mcpu=7450 -maltivec -mabi=altivec -O2 -frename-registers -fweb -fno-strict-aliasing -pipe


and so far so good. The gcc-3.3.3 ebuild says that if you don't have -fno-strict-aliasing in your CFLAGS, gcc may miscompile certain "type-punned" expressions. I'm not sure what this means, but it gives the warning on all architectures. I guess this is still an issue with gcc-3.4, though my error certainly could have been caused by some other fluke. I have been using gcc-3.4 on my amd64 machine for a while now and it is really zippy!
Back to top
View user's profile Send private message
Twist
Guru
Guru


Joined: 03 Jan 2003
Posts: 414
Location: San Diego

PostPosted: Mon Aug 16, 2004 5:00 pm    Post subject: Reply with quote

Quote:

the boostrap failed on glibc (I should have taken note of where). I rebootstrapped with the following CFLAGS


Maybe my -O3 is helping me out =). Although for those reading, it's probably not making my code execute particularly faster.

Quote:

The gcc-3.3.3 ebuild says that if you don't have -fno-strict-aliasing in your CFLAGS, gcc may miscompile certain "type-punned" expressions. I'm not sure what this means, but it gives the warning on all architectures. I guess this is still an issue with gcc-3.4,


It is, I got curious and looked it up, discussion from the GCC bug list is here . It seems that this "bug" will exist in GCC forever after, as the real issue is (in the case of C/C++) not using a union where it is needed. Apparently the agreed upon compiler rules for this situation favor GCC's implementation, and since it's easy to get around by slightly different code syntax, that's how it's going to be.

Or of course you can use -fno-strict-aliasing. Seems like it would be simple to fix in code, but there are potentially so many code bases that would have the error....

-Twist

edit: I think the actual answer here is to modify the ebuilds that fail without this flag to include it. It seems more proper for apps that know they may compile incorrectly to correct themselves rather than globally disabling a compiler feature. I dont have time to look at it right this moment but I'm betting that everything in "system" that needs it already has this flag, for instance.
Back to top
View user's profile Send private message
stimuli
Apprentice
Apprentice


Joined: 16 Dec 2002
Posts: 292
Location: Vancouver, BC, Canada

PostPosted: Mon Aug 16, 2004 9:32 pm    Post subject: Reply with quote

is it necessary to re-bootstrap? Can I safely just emerge gcc 3.4.1 on top of my gcc 3.3 install?
Back to top
View user's profile Send private message
Twist
Guru
Guru


Joined: 03 Jan 2003
Posts: 414
Location: San Diego

PostPosted: Tue Aug 17, 2004 5:47 pm    Post subject: Reply with quote

Quote:

is it necessary to re-bootstrap? Can I safely just emerge gcc 3.4.1 on top of my gcc 3.3 install?


Strictly speaking, no I don't believe it should be necessary. I did it only because this isn't my primary machine and I could afford the long rebuild. The x86 side of gentoo helps you out here; because they have had two GCC versions for some time and therefore have portage features to support it (gcc-config). I actually have both 3.3.3 and 3.4.1 installed, since I had to bootstrap 3.3.3 of course.

Usually when I'm replacing a compiler I rebuild glibc, but that's just me I guess.

Oh and update: I now have KDE installed, works fine. So basically I have everything major built out of ~ppc with this 3.4.1 system and no problems to date. Your mileage may vary =)

-Twist
Back to top
View user's profile Send private message
stimuli
Apprentice
Apprentice


Joined: 16 Dec 2002
Posts: 292
Location: Vancouver, BC, Canada

PostPosted: Wed Aug 18, 2004 4:35 am    Post subject: Reply with quote

Does 3.4.1 have more intelligent optimization code? Will I see results with a PPC 7450 (actually, a 7455, but I hear 7455 is flaky as a target CPU, at least in GCC 3.3.x)
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Wed Aug 18, 2004 5:42 am    Post subject: Reply with quote

oh crap. so i

Code:
emerge sync

today, and lo and behold there is the new gcc 3.4 and a new glibc etc. great, i thought, and i

Code:
emerge -uD

and it starts compiling gcc 3.4 which works great. and then gcc 3.3.3 (again??) which works great too. and then glibc and i get this

Code:
checking for uintptr_t... no
checking for pid_t... yes
checking whether the C compiler ( /var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/xgcc -B/var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/ -B/usr/powerpc-unknown-linux-gnu/bin/ -B/usr/powerpc-unknown-linux-gnu/lib/ -isystem /usr/powerpc-unknown-linux-gnu/include -O2 -O2 -mcpu=G4 -pipe ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [configure-target-libiberty] Error 1

!!! ERROR: sys-libs/libstdc++-v3-3.3.3-r1 failed.
!!! Function src_compile, Line 169, Exitcode 2
!!! (no error message)

*sigh* great... and now? i hope the system isn't inconsistent now? what do i do, did you have the same problem? my current suppsed world update includes

Code:
[ebuild  N    ] sys-libs/libstdc++-v3-3.3.3-r1  -debug +nls  0 kB

which is the one that fails.

cheers,
jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
amitofu
n00b
n00b


Joined: 16 Feb 2004
Posts: 30

PostPosted: Wed Aug 18, 2004 6:54 am    Post subject: Reply with quote

_savage wrote:
Code:
checking for uintptr_t... no
checking for pid_t... yes
checking whether the C compiler ( /var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/xgcc -B/var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/ -B/usr/powerpc-unknown-linux-gnu/bin/ -B/usr/powerpc-unknown-linux-gnu/lib/ -isystem /usr/powerpc-unknown-linux-gnu/include -O2 -O2 -mcpu=G4 -pipe ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [configure-target-libiberty] Error 1

!!! ERROR: sys-libs/libstdc++-v3-3.3.3-r1 failed.
!!! Function src_compile, Line 169, Exitcode 2
!!! (no error message)

*sigh* great... and now? i hope the system isn't inconsistent now? what do i do, did you have the same problem? my current suppsed world update includes

Code:
[ebuild  N    ] sys-libs/libstdc++-v3-3.3.3-r1  -debug +nls  0 kB

which is the one that fails.

I think you need to run

Code:
gcc-config powerpc-unknown-linux-gnu-3.4.1

to tell your system to use the new compiler. Your system absolutely shouldn't be in an inconsistent state though because you still have glibc installed--just compiled with an older compiler.
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Wed Aug 18, 2004 4:24 pm    Post subject: Reply with quote

amitofu wrote:
I think you need to run

Code:
gcc-config powerpc-unknown-linux-gnu-3.4.1

to tell your system to use the new compiler. Your system absolutely shouldn't be in an inconsistent state though because you still have glibc installed--just compiled with an older compiler.


I am at work right now, I'll try it tonight. But in general, should not the ebuild script catch exactly this and run gcc-config? The whole idea of ebuilds was that, right??

Thanks :)
Jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Thu Aug 19, 2004 3:44 am    Post subject: Reply with quote

nope, didn't work. i switched the compiler

Code:
root@tigger ~ # gcc-config powerpc-unknown-linux-gnu-3.4.1
 * Switching to powerpc-unknown-linux-gnu-3.4.1 compiler...               [ ok ]

and then

Code:
emerge -uD world

again. same old, it started compiling fine, and then i have the same error message

Code:
checking whether the C compiler ( /var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/xgcc -B/var/tmp/portage/libstdc++-v3-3.3.3-r1/work/build/gcc/ -B/usr/powerpc-unknown-linux-gnu/bin/ -B/usr/powerpc-unknown-linux-gnu/lib/ -isystem /usr/powerpc-unknown-linux-gnu/include -O2 -O2 -mcpu=G4 -pipe ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [configure-target-libiberty] Error 1

!!! ERROR: sys-libs/libstdc++-v3-3.3.3-r1 failed.
!!! Function src_compile, Line 169, Exitcode 2
!!! (no error message)

darn, great... now what can i do?? i mean, every world update fails. which sucks. big time. :-(

jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
_savage
Guru
Guru


Joined: 06 Jun 2004
Posts: 308
Location: Redmond, WA

PostPosted: Thu Aug 19, 2004 11:07 am    Post subject: Reply with quote

It seems that my /etc/make.conf settings were wrong ever since I bootstrapped stage 1. They are set to "-mcpu=G4 -mtune=G4", where G4 is not defined (according to gcc.gnu.org). Instead I need to set it to 7450 (I have a 1GHz TiBook, which runs on a 7455).

From the configure.log of libiberty (which comes with libstd++) it seems that this option breaks the configure. But why did it work so far? Right now I have changed my settings and rerun the whole thing.

You may want to have a look at this thread too: https://forums.gentoo.org/viewtopic.php?p=1449940...

Jens
_________________
Jens Troeger
http://savage.light-speed.de/
Back to top
View user's profile Send private message
Twist
Guru
Guru


Joined: 03 Jan 2003
Posts: 414
Location: San Diego

PostPosted: Fri Aug 20, 2004 9:10 pm    Post subject: Reply with quote

Emerging some packages with a broken CFLAGS can work because those packages completely ignore user CFLAGS (there are a few) or filter all but a small set of known CFLAGS.

-Twist
Back to top
View user's profile Send private message
Hydraulix
Guru
Guru


Joined: 12 Dec 2003
Posts: 447
Location: Baltimore, Maryland

PostPosted: Sun Aug 29, 2004 12:53 am    Post subject: Reply with quote

Hey thanks for the heads up. GCC-3.4.1-r2 works great on my dual usb iBook.



Code:

# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-O2 -mcpu=750 -mpowerpc-gfxopt -fno-strict-aliasing -fsigned-char -pipe"
CHOST="powerpc-unknown-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="X acpi aim alsa apm -arts calendar cdr crypt dga directfb dvd esd ethereal fbcon gnome gif gphoto2 gtk gtk2 java jikes  jpeg -kde mozilla mpeg ncurses opengl oscar oss -qt quicktime spell tiff usb xmms wifi"
GENTOO_MIRRORS="http://gentoo.ccccom.com ftp://gentoo.ccccom.com"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
PORTDIR_OVERLAY=/usr/local/portage





Code:
gcc (GCC) 3.4.1 20040803 (Gentoo Linux 3.4.1-r2, ssp-3.4-2, pie-8.7.6.5)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

_________________
It is the fate of operating systems to become free.
- Neal Stephenson

If only You and Dead people can read hex, how many people can read hex?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum