Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,810
1,100
The Land of Hope and Glory
If I compile and install the latest version of GCC will it cause any problems for Xcode and the other Apple dev tools? I've already upgraded NASM to 2.02 and that seems fine but GCC is such an integral part of the build process I am relucant to do it before I know of any potential problems.

Thanks for any help :).
 

techgeek

macrumors member
Jun 11, 2004
94
0
UK
Disclaimer: I haven't tried this on Mac OS X, only Solaris and XP.

Right now we have that out of the way.
You should be able to specify the install location for your new version of GCC and have two (or more) version installed at the same time with no problems. Then it's all just down to paths as to which one you use.
I work in embedded software and frequently have multiple compilers installed for cross-compilation to the target(s) as well as for compilation for the host platform

If you want to get xcode to use the new version, well I can't help you with that one. Would be nice to be allowed to use a mac for work :(
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,810
1,100
The Land of Hope and Glory
Ah okay, so as long as GCC 4.2.2 goes in /usr/local and the standard build tools remain where they are I can use them interchangably? I was just worried that it would make changes to the libraries or whatever.

It should be interesting to see if I can get Xcode to compile with the new version, from what I have read Apple make a few changes to GCC which do not help when compiling standard open source code for whatever reason.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
Odds are this is not going to work well, especially with Xcode. In the past I needed a Fortran compiler and was unable to get the Apple provided GCC sources to compile properly with only that added to --enable-languages. I fought with it for a while but finally decided it wasn't worth it and found an alternative solution. Report back and let us know how it goes.
 

GeeYouEye

macrumors 68000
Dec 9, 2001
1,669
10
State of Denial
It shouldn't break it, as long as you don't overwrite whatever's currently installed. If something fails in Xcode then, just use gcc-select.
 

Ti_Poussin

macrumors regular
May 6, 2005
210
0

ChrisA

macrumors G5
Jan 5, 2006
12,915
2,164
Redondo Beach, California
Ah okay, so as long as GCC 4.2.2 goes in /usr/local and the standard build tools remain where they are I can use them interchangably? I was just worried that it would make changes to the libraries or whatever.

The libraries and such go into directories that have the the target system name and version number in the name. So you can keep many copies of gcc without need to resort to
Take a look inside /usr/lib/gcc.
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,810
1,100
The Land of Hope and Glory
Well my first attempt at compiling GCC did not go too well at all :). It keeps erroring out at the same point. Are there any special steps to take when compiling on Mac OS X? I pretty much just had the standard configure settings. At a bit of a lose really. I'm sure I'll figure it out when I am less tired.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
Well my first attempt at compiling GCC did not go too well at all :). It keeps erroring out at the same point. Are there any special steps to take when compiling on Mac OS X? I pretty much just had the standard configure settings. At a bit of a lose really. I'm sure I'll figure it out when I am less tired.

Alright, I just compiled gcc 4.2.3. Try doing it with the following commands:

Code:
./configure --disable-checking --prefix=/usr/local --enable-languages=c,objc,c++,obj-c++ --build=i686-apple-darwin9 --host=i686-apple-darwin9 --target=i686-apple-darwin9

make -j4

make install

I did this on a 2.2GHz MacBook Pro. Change prefix to where you would like it to be installed.
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,810
1,100
The Land of Hope and Glory
Alright, I just compiled gcc 4.2.3. Try doing it with the following commands:

Code:
./configure --disable-checking --prefix=/usr/local --enable-languages=c,objc,c++,obj-c++ --build=i686-apple-darwin9 --host=i686-apple-darwin9 --target=i686-apple-darwin9
 
make -j4
 
make install

I did this on a 2.2GHz MacBook Pro. Change prefix to where you would like it to be installed.

Excellent, thanks for that. I think (I'm at work at the moment) I tried using this for configure when I did it (or something like it, I might have got something a little wrong from memory).

./configure --enable-werror --enable-stage1-checking --disable-libada --disable-libssp

I guess the problem was in compiling the Ada, Java or Fortran compiler. Shame, I wanted to have a look at Fortran.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
Excellent, thanks for that. I think (I'm at work at the moment) I tried using this for configure when I did it (or something like it, I might have got something a little wrong from memory).



I guess the problem was in compiling the Ada, Java or Fortran compiler. Shame, I wanted to have a look at Fortran.

You may be able to do the Fortran one, I just remember having problems when I tried previously. To compile the Fortran compiler, you will also need to compile GMP and MPFR. I may try it tonight when I get home from work, just out of curiousity.
 

chem

macrumors regular
Jun 9, 2007
184
0
Fortran is best handled through something like macports. That way you have a complete gcc 4.2.3 suite independent of the system compilers. You can also use a fortran plugin for Xcode and point it at your macports gfortran executable.

For those of you who aren't familiar with macports or xcode plugins, I detail a science-friendly fresh install of OS X 10.5.2 here:

http://yocto.wordpress.com/2008/02/27/personal-installation-of-os-x-1052/
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,810
1,100
The Land of Hope and Glory
With the Fortran compiler?

No, the only way I could think of doing that was using GCC 4.2.3 to compiler the libraries needed for Fortran and then reinstall GCC with only Fortran selected as the enabled language. The Apple compiler seems to choke on a few open source libraries for some unknown reason.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.