PDA

View Full Version : gcc not compiling with Xcode installed




taKevin
Feb 21, 2012, 05:07 PM
I'm trying to use the program GNUplot to fit data, but I just updated to Lion and naturally had to update GNUplot. However, when I try to configure in Terminal it states that I do not have a C compiler, but I already installed Xcode 4 so I know that the GCC and GNU compilers were downloaded. I'm completely lost so any help would be great!



parapup
Feb 21, 2012, 05:10 PM
Can you post the last few lines from config.log? Also on terminal what is the output of following commands -

gcc -v

and

g++ -v

taKevin
Feb 21, 2012, 05:16 PM
It just says -bash: gcc: command not found and the same for g++.

I'm trying to install readline, and the config.log says:

"configure:2059: checking whether make sets $(MAKE)
configure:2085: result: no
configure:2138: checking for gcc
configure:2168: result: no
configure:2231: checking for cc
configure:2278: result: no
configure:2334: checking for cl.exe
configure:2364: result: no
configure:2388: error: in `/Users/ks/readline-6.2':
configure:2391: error: no acceptable C compiler found in $PATH
See `config.log' for more details."

parapup
Feb 21, 2012, 05:23 PM
Ok, so either Xcode is not installed (you need to actually run the Install XCode.app and complete the installation after downloading from App Store) OR the gcc and g++ commands are not in PATH for some reason.

If

clang -v

and

clang++ -v

show valid output then doing this on the terminal before running configure might help -

export CC=clang
export CXX=clang++

Or even try this

export CPP='llvm-gcc-4.2'
export CC='llvm-gcc-4.2'
export CXX='llvm-g++

lloyddean
Feb 21, 2012, 05:30 PM
iMacCoreDuo2:~ lloyd$ ls -alF `whereis g++`
lrwxr-xr-x 1 root wheel 12 Feb 20 12:16 /usr/bin/g++@ -> llvm-g++-4.2

thundersteele
Feb 21, 2012, 05:41 PM
Xcode 4.2 comes without gcc. You can either try to compile using the Apple C/C++ compiler (llvm), or install gcc yourself.

I would recommend installing gcc. I use the following bundle:
http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg

JoshDC
Feb 22, 2012, 06:06 AM
The most recent version of Xcode (4.3, released a few days ago) is distributed as a standalone application rather than an installation package. It no longer provides command line tools by default. To install the command line tools, you need to open Xcode's preferences, go to the “Downloads” tab, and install them from there.

KnightWRX
Feb 22, 2012, 06:23 AM
(you need to actually run the Install XCode.app and complete the installation after downloading from App Store)

That is not true with the XCode currently in the App Store. With release 4.3, XCode is a self-contained app bundle and doesn't require installation anymore.

However, it also doesn't install command line tools either, those are a seperate download.

taKevin
Feb 22, 2012, 09:32 AM
Thanks guys! Got it working.

parapup
Feb 22, 2012, 10:37 AM
That is not true with the XCode currently in the App Store. With release 4.3, XCode is a self-contained app bundle and doesn't require installation anymore.

However, it also doesn't install command line tools either, those are a seperate download.

Oh - that probably was OP's problem. I stopped playing Xcode download/update games with last version - it is incredibly buggy and slow (I wasn't even able to git clone a repo without crashes). Going forward I think I will be much better off with just Vim and Command Line Tools.

thundersteele
Feb 22, 2012, 01:40 PM
The most recent version of Xcode (4.3, released a few days ago) is distributed as a standalone application rather than an installation package. It no longer provides command line tools by default. To install the command line tools, you need to open Xcode's preferences, go to the “Downloads” tab, and install them from there.

Thanks, I didn't realize there was a new version.

Which gcc version do they provide.

A different question... is python part of Xcode or does it come with the OS?

lloyddean
Feb 22, 2012, 02:32 PM
Thanks, I didn't realize there was a new version.

Which gcc version do they provide.

A different question... is python part of Xcode or does it come with the OS?

GCC is no longer included with Xcode

thundersteele
Feb 22, 2012, 02:44 PM
GCC is no longer included with Xcode

Did you read the rest of this thread?

Apparently Xcode 4.3 includes gcc again, however not as part of the standard installation! This is the reason I asked which gcc version was provided if I ask Xcode to install the "console tools" using the preferences menu.

chown33
Feb 22, 2012, 02:46 PM
A different question... is python part of Xcode or does it come with the OS?

The basic python interpreter is part of the OS install. To find out which version, use the Terminal command-line:
python -V

thundersteele
Feb 22, 2012, 02:56 PM
The basic python interpreter is part of the OS install. To find out which version, use the Terminal command-line:
python -V


The reason I can't find out myself is that I have both Xcode and the enthought python distribution installed... I just didn't remember whether a basic python installation was part of OSX.

I have python 2.7.2 from enthought.

lloyddean
Feb 22, 2012, 03:24 PM
Did you read the rest of this thread?

Apparently Xcode 4.3 includes gcc again, however not as part of the standard installation! This is the reason I asked which gcc version was provided if I ask Xcode to install the "console tools" using the preferences menu.

Well of course! I just don't don't think of the following as gcc.


iMacCore2Duo:~ lloyd$ ls -alF `whereis gcc`
lrwxr-xr-x 1 root wheel 12 Feb 20 12:16 /usr/bin/gcc@ -> llvm-gcc-4.2

iMacCore2Duo:~ lloyd$ ls -alF `whereis llvm-gcc-4.2`
lrwxr-xr-x 1 root wheel 32 Feb 20 12:16 /usr/bin/llvm-gcc-4.2@ -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

thundersteele
Feb 22, 2012, 03:35 PM
Well of course! I just don't don't think of the following as gcc.


iMacCore2Duo:~ lloyd$ ls -alF `whereis gcc`
lrwxr-xr-x 1 root wheel 12 Feb 20 12:16 /usr/bin/gcc@ -> llvm-gcc-4.2

iMacCore2Duo:~ lloyd$ ls -alF `whereis llvm-gcc-4.2`
lrwxr-xr-x 1 root wheel 32 Feb 20 12:16 /usr/bin/llvm-gcc-4.2@ -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2

Ok, so this answers my question. It's not the gnu c compiler suite, they just add a symlink to their own C compiler.

GSL, the gnu scientific library, is at this point not compatible with llvm... it compiles, but some of the tests fail. I don't know about other stuff.

lloyddean
Feb 22, 2012, 04:48 PM
Ok, so this answers my question. It's not the gnu c compiler suite, they just add a symlink to their own C compiler.

GSL, the gnu scientific library, is at this point not compatible with llvm... it compiles, but some of the tests fail. I don't know about other stuff.

That's right - back at response 5.

taKevin
Feb 22, 2012, 07:37 PM
Guys, new issue. I've got gcc and got gnuplot downloaded and running...kind of. But now every time I try to use gnuplot through Terminal, I tell it to plot a basic function and get the following error:

gnuplot> plot sin(x)
gnuplot(21992) malloc: *** error for object 0x7000000074697865: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

What does all this mean and what can I do to fix it?

thundersteele
Feb 22, 2012, 08:51 PM
Guys, new issue. I've got gcc and got gnuplot downloaded and running...kind of. But now every time I try to use gnuplot through Terminal, I tell it to plot a basic function and get the following error:

gnuplot> plot sin(x)
gnuplot(21992) malloc: *** error for object 0x7000000074697865: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

What does all this mean and what can I do to fix it?
Did you install all dependencies for gnuplot?

maybe this helps:
http://www.leancrew.com/all-this/2012/02/fixing-gnuplot-on-os-x-10-7-3/

I usually go through macports to install linux software. But gnuplot seems to be standalone, as long as you have gcc... not sure what is going wrong.

floh
Feb 27, 2012, 07:33 AM
The most recent version of Xcode (4.3, released a few days ago) is distributed as a standalone application rather than an installation package. It no longer provides command line tools by default. To install the command line tools, you need to open Xcode's preferences, go to the “Downloads” tab, and install them from there.

I had already figured that out, but am running into two different problems: I would like to have the GNU autotools (autoconf, automake, libtool) and an OpenMPI environment (mpicc, mpirun, ...) for shell compilation. These used to be included in the XCode Developer Tools, but they don't seem to be anymore with version 4.3.

Is there any official way to install them (like another command-line-like package to download)? Or do I need to go the GNU-route with Macports or compiling them myself?

Maybe someone already found out... thanks!

KnightWRX
Feb 27, 2012, 07:51 AM
Is there any official way to install them (like another command-line-like package to download)? Or do I need to go the GNU-route with Macports or compiling them myself?

Did you give the download section a look in the ADC portal or in XCode's preferences by any chance or did you just ask the question before looking ? ;)

floh
Feb 27, 2012, 08:08 AM
Did you give the download section a look in the ADC portal or in XCode's preferences by any chance or did you just ask the question before looking ? ;)

Sorry, I should have elaborated...

I did check the Preferences Download tab. And I searched not only the ADC portal but did an extensive internet search if there were any packages available. I did not find anything. (except threads that complained about the autotools being dropped out of XCode)

Still, I searched for solutions to the "missing gcc" error (that this thread already solved) for quite a while before I noticed the "command line tools" package, simply because I searched for the wrong words and did not know there was a package by that name.

If you are implying that there is a very simple solution that I just overlooked, please enlighten me.

Background to what I've been using so far: I worked on an older laptop that I upgraded through several XCode versions, that's why even with the newest, I still had a working MPI compiler and autotools on the system. But my laptop crashed and burned and I decided to start freshly with the new one, installing a plain XCode 4.3. That's when my troubles began.
I did have Macports installed for some more GNU utilities, but would like to avoid it for most parts, since upgrades take forever when you base everything on the Macports gcc (Compiling a compiler takes time...).

Maybe someone had a similar problem, and I've had very good experiences in the MacRumors forums (mostly in the Digital Video section).

KnightWRX
Feb 27, 2012, 08:26 AM
Sorry, I should have elaborated...

I did check the Preferences Download tab. And I searched not only the ADC portal but did an extensive internet search if there were any packages available. I did not find anything.

Did not look very hard did you ?

Log in to ADC, then go to the Mac dev center :

https://developer.apple.com/devcenter/mac/index.action

On the bottom, there's a big Blue Arrow in a section titled "Additional Downloads" and there's a "View All Downloads" on the right of it.

After clicking that, there's no way you can miss the label displayed in a HUGE font saying "Command Line Tools for Xcode - February 2012".

floh
Feb 27, 2012, 08:46 AM
Did not look very hard did you ?


Wait, I think we're not talking about the same thing...

I WAS looking for the command line tools, because I was surprised they were gone. I DID find the package (after some search though...). And it helped me a lot in so far as I have a gcc again and git and many other helpful tools on the command line.

However, OpenMPI and autoconf and everything I mentioned are no longer included in XCode (also not in the command line tools, which are basically just adding the XCode contents to the shell environment). And I would love to find a _second_ package that contains just this, but I did not.

Maybe I should start a new thread for this...

----------

Sorry, I just re-read my first post and it is really unclear... I hope the last one cleared things up a bit. So again:

I happily installed the command line tools and have my gcc and make back.

I am however still missing my mpicc and automake, which were included in earlier version of XCode but were apparently dropped. I was hoping there might be a _second_ package much like the command line tools that I overlooked.

KnightWRX
Feb 27, 2012, 09:14 AM
I am however still missing my mpicc and automake, which were included in earlier version of XCode but were apparently dropped. I was hoping there might be a _second_ package much like the command line tools that I overlooked.

I don't have access to my Mac right now (nor did I upgrade to 4.3 yet), and can't find a list of the tools online. Either the package doesn't include them (Xcode after all doesn't use automake/autoconf and other such GNU tools, in favor of its xcodebuild system) or they aren't put in the PATH (could try updatedb/locate to find them).

Otherwise, the Command Line Tools package should be sufficient to install them from MacPorts.

floh
Feb 27, 2012, 09:23 AM
I don't have access to my Mac right now (nor did I upgrade to 4.3 yet), and can't find a list of the tools online. Either the package doesn't include them (Xcode after all doesn't use automake/autoconf and other such GNU tools, in favor of its xcodebuild system) or they aren't put in the PATH (could try updatedb/locate to find them).


I can tell you already that they are not included, sadly. I tried locate already and manually (and with find) searched through the Xcode.app-folder. In case anyone reads this and is interested: Upgrading will work fine (or so it did on my old laptop), and the autotools will be kept.

I am actually more surprised that they got rid of the OpenMPI installation. I can see that most Mac developers probably won't need to program highly parallel applications, but some of us do. :(


Otherwise, the Command Line Tools package should be sufficient to install them from MacPorts.

Okay, I'm gonna go with MacPorts, thanks.
By the way: Macports claims on their website that it won't work with XCode 4.3, only with 4.2. I got it installed though after finding out about the command line tools. Let's hope that it works out.

Thanks again and greetings from Germany, (sorry for my English btw.)

Floh

subsonix
Feb 27, 2012, 09:31 AM
I am actually more surprised that they got rid of the OpenMPI installation. I can see that most Mac developers probably won't need to program highly parallel applications, but some of us do. :(


Was OpenMPI ever included with the developer tools?

KnightWRX
Feb 27, 2012, 09:40 AM
Okay, I'm gonna go with MacPorts, thanks.
By the way: Macports claims on their website that it won't work with XCode 4.3, only with 4.2. I got it installed though after finding out about the command line tools. Let's hope that it works out.

You'll need to perform some workarounds (search for xcode-select) and a few symlinks to get it working. There's also some hacking required of the Macports configuration file.

floh
Feb 27, 2012, 09:51 AM
Was OpenMPI ever included with the developer tools?

It was. I can still find it in my "/Developer-old/usr/bin/"-Folder on my old harddrive. It was actually nice to have a ready-made MPI on every Mac system. Well, those days are over...

----------

You'll need to perform some workarounds (search for xcode-select) and a few symlinks to get it working. There's also some hacking required of the Macports configuration file.

Thanks you, that has already been very helpful. I'll report back when I get it running.

healeydave
Jun 27, 2012, 03:41 AM
This is frustrating as hell.

I have installed Xcode 4.5 Preview 2 and Command Line Tools for Xcode 4.5 preview 2 for Lion.

If I do gcc -v I get:


Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~30/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~30/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)


...and g++ -v gives:



Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~30/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~30/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)


...and clang -v gives:


Apple clang version 4.0 (tags/Apple/clang-421.10.48) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix


....but when I try to make, I'm still getting:



Checking for a C compiler... not found.
make: *** [compiler] Error 1



arrggghh, I think I'm outa my depth :(

floh
Jun 27, 2012, 04:49 AM
Checking for a C compiler... not found.
make: *** [compiler] Error 1



I am not an expert by any chance, but I know the following: This looks like a configure script that is called by make. This configure script will not only take a huge amount of options but is also highly dependent on what build system you use.

To me, the error message looks like an autotools one. Do you have a script "configure" in the directory? Have you tried giving that script the gcc location manually, like:

./configure CC=/usr/bin/gcc


I think to get help here, you need to post some more details on what you are trying to compile and with what build system.

healeydave
Jun 27, 2012, 04:58 AM
Thanks for the reply.

I'm trying to compile flashrom.
It doesn't have a configure file.

gnasher729
Jun 27, 2012, 05:23 AM
Guys, new issue. I've got gcc and got gnuplot downloaded and running...kind of. But now every time I try to use gnuplot through Terminal, I tell it to plot a basic function and get the following error:

gnuplot> plot sin(x)
gnuplot(21992) malloc: *** error for object 0x7000000074697865: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

What does all this mean and what can I do to fix it?

It means there is a bug in gnuplot. You'd have to run it under Xcode, set a breakpoint in malloc_error_break as it tells you, and the program will stop exactly at the point where the bug breaks the program. And then you figure out what's wrong and fix it.

floh
Jun 27, 2012, 05:42 AM
I'm trying to compile flashrom.
It doesn't have a configure file.

I just downloaded flashrom to see what it's about.

First things first: You do know what you're doing, right? It says explicitely to not use flashrom on any laptop since you might permanently brick it. It also says (in the included README file) that you have to install DirectHW from coresystems first. If you want to compile such a delicate tool, I highly suggest you know your way around computers very well.

That being said: flashrom comes with its own very long Makefile. This Makefile seems to check for various compilers and go with the wrong one. It can not be fixed by MacOS experts, but by the guys from flashrom. They seem to have an IRC channel you can check out. Good luck.

----------

It means there is a bug in gnuplot. You'd have to run it under Xcode, set a breakpoint in malloc_error_break as it tells you, and the program will stop exactly at the point where the bug breaks the program. And then you figure out what's wrong and fix it.

For some reason, this seems to have landed in the wrong thread. The quote isn't from within the thread and it's about something completely different. Could the poster please check what went wrong?

Futhark
Jun 27, 2012, 10:31 AM
I'm trying to use the program GNUplot to fit data, but I just updated to Lion and naturally had to update GNUplot. However, when I try to configure in Terminal it states that I do not have a C compiler, but I already installed Xcode 4 so I know that the GCC and GNU compilers were downloaded. I'm completely lost so any help would be great!

Have you installed the additional tools? If not then you've no GCC yet. I had this problem too only a few days ago :D

chown33
Jun 27, 2012, 11:11 AM
Have you installed the additional tools? If not then you've no GCC yet. I had this problem too only a few days ago :D

You're answering a post from Feb 2012.

The latest question is on page 2 of the thread.