Josh
Josh

Reputation: 2869

Error trying to exec cc1, gcc only wants to compile for avr?

I've installed gcc on my Mac (Snow Leopard) so I can compile for AVR microcontrollers. However, it seems to be preventing me from compiling for anything else. I'd like to build the packages from astrometry.net, and when I run ./configure then make i get the following:

make -C ./qfits-an stage CFLAGS=" -g -Wall -ffinite-math-only -fno-signaling-nans  -march=native -O3 -fomit-frame-pointer -DNDEBUG -fPIC -Winline -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE" LDFLAGS=" -g -Wall -ffinite-math-only -fno-signaling-nans  -march=native -O3 -fomit-frame-pointer -DNDEBUG -fPIC -Winline" CC="gcc"
make -C src stage
gcc -g -Wall -ffinite-math-only -fno-signaling-nans  -march=native -O3 -fomit-frame-pointer -DNDEBUG -fPIC -Winline -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -c -o anqfits.o anqfits.c
gcc: error trying to exec 'cc1': execvp: No such file or directory    

gcc -v gives:

Using built-in specs.
Target: avr
Configured with: ./configure --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --prefix=/usr/local/staging.avr-gcc
Thread model: single
gcc version 4.1.1

I'm not sure how to proceed! It seems that currently everything is set up to only build for the AVR platform, but I have Xcode installed so somewhere there are more versions of gcc lurking. This install was via http://www.micahcarrick.com/installing-gnu-tools-avr-gcc.html if that helps to see how it was set up (I had Xcode installed prior to this).

The solution, I expect, is simple. I just want to avoid messing up my settings and then not being able to compile for either platform.

Many thanks!

Upvotes: 3

Views: 2718

Answers (1)

trojanfoe
trojanfoe

Reputation: 122391

You probably want to remove the non-cross-compiler named versions of the AVR tools you have installed (i.e. gcc, ld, etc.), so the cross-compiler, and related tools, are only available using target-specific names.

To do this, find the directory where they are installed (/usr/local/bin ?) and find all the tools installed at the same time. As an example, this is what happens on my Linux machine (to give you an idea):

$ which gcc
/usr/bin/gcc
$ cd /usr/bin
$ ls -li *gcc*
189389 -rwxr-xr-x 2 root root 268088 Dec  6  2011 gcc
195145 -rwxr-xr-x 1 root root   2018 Aug 16  2010 gccmakedep
189389 -rwxr-xr-x 2 root root 268088 Dec  6  2011 x86_64-redhat-linux-gcc

I would then remove gcc, leaving x86_64-redhat-linux-gcc as the only way of starting that compiler (they are hard linked as they share the same inode). There will be other tools as well, which you can identify by date in the same directory.

An alternative approach is to install the cross-compiler into a directory that isn't in your $PATH.

Upvotes: 3

Related Questions