gcc not compiling with Xcode installed

Discussion in 'Mac Programming' started by taKevin, Feb 21, 2012.

  1. macrumors newbie

    Joined:
    Feb 21, 2012
    Location:
    Columbus
    #1
    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!
     
  2. macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #2
    Can you post the last few lines from config.log? Also on terminal what is the output of following commands -

    Code:
    gcc -v 
    and

    Code:
    g++ -v 
     
  3. thread starter macrumors newbie

    Joined:
    Feb 21, 2012
    Location:
    Columbus
    #3
    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."
     
  4. macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #4
    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

    Code:
    clang -v
    and
    Code:
    clang++ -v
    show valid output then doing this on the terminal before running configure might help -
    Code:
    export CC=clang
    export CXX=clang++
    Or even try this
    Code:
    export CPP='llvm-gcc-4.2'
    export CC='llvm-gcc-4.2'
    export CXX='llvm-g++
     
  5. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #5
    iMacCoreDuo2:~ lloyd$ ls -alF `whereis g++`
    lrwxr-xr-x 1 root wheel 12 Feb 20 12:16 /usr/bin/g++@ -> llvm-g++-4.2
     
  6. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #6
  7. macrumors regular

    Joined:
    Apr 8, 2009
    #7
    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.
     
  8. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #8
    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.
     
  9. thread starter macrumors newbie

    Joined:
    Feb 21, 2012
    Location:
    Columbus
    #9
    Thanks guys! Got it working.
     
  10. macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #10
    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.
     
  11. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #11
    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?
     
  12. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #12
    GCC is no longer included with Xcode
     
  13. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #13
    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.
     
  14. macrumors 603

    Joined:
    Aug 9, 2009
    #14
    The basic python interpreter is part of the OS install. To find out which version, use the Terminal command-line:
    Code:
    python -V
    
     
  15. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #15
    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.
     
  16. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #16
    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
     
  17. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #17
    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.
     
  18. macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #18
    That's right - back at response 5.
     
  19. thread starter macrumors newbie

    Joined:
    Feb 21, 2012
    Location:
    Columbus
    #19
    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?
     
  20. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #20
    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.
     
  21. macrumors 6502

    Joined:
    Nov 28, 2011
    Location:
    Stuttgart, Germany
    #21
    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!
     
  22. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #22
    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 ? ;)
     
  23. macrumors 6502

    Joined:
    Nov 28, 2011
    Location:
    Stuttgart, Germany
    #23
    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).
     
  24. macrumors Pentium

    KnightWRX

    Joined:
    Jan 28, 2009
    Location:
    Quebec, Canada
    #24
    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".
     
  25. macrumors 6502

    Joined:
    Nov 28, 2011
    Location:
    Stuttgart, Germany
    #25
    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.
     

Share This Page