gcc

Jazzy_Jay

Registered
I have downloaded gcc 2.95.1 from gnu and I\'ve been having install problems. I\'ve fixed that fact that it would not recognize darwin1.2. The problem is:

make stage1
make stage2
make compare
make install

Has anyone compiled gcc on OSX-PB

help!
 

redbird

Registered
If you don\'t *have* to have gcc and friends, you can use the Apple version that comes with the developer tools. Yeah, it\'s a pain to go through the process to become an Online ADC member and to download the 80 MB tarball, but once you\'ve got the stuff installed it\'s worth it.

I haven\'t had any problems with cc, Apple\'s C compiler, though I admit to usually using c++, for the obvious langauge.
 

scruffy

Notorious Olive Counter
Please check up on this, since I am not exactly sure of the details.

I am pretty sure that the cc on OS X developer tools is gcc. I do know for sure that Apple contributed back to the GNU project the work they did on gcc as part of Darwin. I see no reason why they would then not include that work in OSX.

I have not had any trouble myself with that aspect of installing Unix programs, so I haven\'t tested this, but I have heard that when configure/make scripts complain about the lack of a gcc, it is usually sufficient to <tt>ln /usr/bin/cc /usr/bin/gcc</tt>. Then the makefiles can call the compiler what they want, and they stop complaining.
 

natergj

Registered
scruffy is right. cc is gcc, but you redbird is wrong in saying that you need to be an ADC member to get them. They Darwin1.2 installer comes with everything you need to compile pretty much anything. I was able to get them installed by running the Darwin installer and then the OSX installer afterwards.

If you have troubles compiling things because of an error saying something like "no gcc found" then just make a link to it.

ln -s /usr/bin/cc /usr/bin/gcc

then everything should work fine. it did for me
 

redbird

Registered
But, if you don't have Darwin 1.2 downloaded, that is an even bigger download. Plus, you still have to join an Apple developer group to get access (or maybe that's just for the sources, but whatever). I guess it just depends on what you want. If you get the Mac OS X developer tools, you'll also get lots of nice stuff for developing for OS X, not just the command line. I'm sure that there are other advantages to going to Darwin rout (it might be informative is someone could expound on these here).
 

monty

Registered
Thanks! I went through all the trouble of getting gcc downloaded. Wish i'd read this first.

quote from the cc man pages:
"cc - C and Objective-C compiler"

Why did they take out c++ support? Seems kind of silly. gcc will compile c, c++ and objc so why can't cc if it's derived from it?

peter
 

redbird

Registered
Originally posted by monty
Why did they take out c++ support? Seems kind of silly. gcc will compile c, c++ and objc so why can't cc if it's derived from it?
Ahh, but it does. You see, gcc does the same thing that cc does. When you run g++, you are really running gcc, just with a whole lot of arguments to turn C into C++ (C++ uses different libraries and such, but aside from the extensions works the same underneath, but works in a way that is different enough from C that it can't be done all in one command (like ObjC can)). g++ and c++ under Darwin are frontends for gcc and cc, respectively; they make it easy to compile C++ programs.
 

monty

Registered
according to the gcc manual it no longer turns c++ code into an intermediate c version. that's why they changed gcc from being GNU C Compiler to GNU Compiler Collection. But that's really beside the point. You're saying all I have to do is run c++ instead of cc??

peter
 

redbird

Registered
Originally posted by monty
You're saying all I have to do is run c++ instead of cc??
Yes. That's it. The arguments you can pass are pretty much the same (though there are probably some extra ones relating to C++ specific stuff, but I've never made use of them). Just as a note, you may want to create symlinks to cc and c++ with the names gcc and g++, respectively, since if you ever try to install software it may look for these and not the cc and c++ combo.

Also, thanks for the heads up on how gcc works now. My info is a few years old, and haven't bother to check whether things had changed.
 

natergj

Registered
ln -s /usr/bin/cc /usr/bin/gcc

this should do it. The format is.

ln -s <thing you want to link> <where you want to link it>
 

natergj

Registered
apparently you can;t use greater than or less than symbols, it make everything inside of them disappear, so I'll use parenthasis.

format is:

ln -s (thing you want to link) (where you want to link it to)
 

Gametes

Registered
Actually, for me the developer tools do not correctly compile C++ programs. So if it is gcc or cc, whichever, it doesn't work correctly.

For example, the code
...
cout<<"Input your age: ";
cin>>age;
...

displays a blank prompt first, then the text asking for your age. A series of 3 cin/cout stages will operate incorrectly just as this one, awaiting input 3 times and then suddenly displaying 3 prompts.

The problem can be avoided, by using the <<endl; operator, but this is a work around. The bottom line is that gcc/cc does not follow standard c++ implementation.

So watch out.
 
Top