PDA

View Full Version : Will installing GCC 4.2.2 (or later) break Xcode etc




Cromulent
Feb 28, 2008, 09:42 AM
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
Feb 28, 2008, 10:05 AM
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
Feb 28, 2008, 10:15 AM
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.

techgeek
Feb 28, 2008, 10:28 AM
That's right. It should be totally self contained.

antibact1
Feb 28, 2008, 11:05 AM
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
Feb 28, 2008, 01:04 PM
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
Feb 28, 2008, 01:21 PM
As far as I can say, you can install multiple version on gcc on your machine and select the right version via de terminal using this application
http://svn.macports.org/repository/macports/users/mww/select/
http://trac.macports.org/projects/macports/ticket/14315

Not sure if it still be the same command gcc_select or just select
sudo gcc_select 4.0
4.2 or whatever you had install.

that should help testing both version at the same time.

ChrisA
Feb 28, 2008, 01:40 PM
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
Feb 28, 2008, 04:42 PM
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
Feb 28, 2008, 08:58 PM
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:



./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
Feb 29, 2008, 03:19 AM
Alright, I just compiled gcc 4.2.3. Try doing it with the following commands:



./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
Feb 29, 2008, 08:16 AM
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.

Cromulent
Feb 29, 2008, 03:15 PM
Excellent. Got it working, thanks for your help :).

antibact1
Feb 29, 2008, 05:00 PM
Excellent. Got it working, thanks for your help :).

With the Fortran compiler?

chem
Feb 29, 2008, 05:10 PM
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
Mar 2, 2008, 07:40 AM
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.