How can I switch compiler from clang to gcc46?

Matthew Seaman m.seaman at infracaninophile.co.uk
Sat Mar 16 13:29:02 UTC 2013


On 16/03/2013 13:01, Beeblebrox wrote:
> I need to compile a source not in the ports tree. The source needs to use the
> gcc compiler (I have lang gcc (46) installed). Sourec make file complains it
> cannot find gcc46.

gcc46 will be /usr/local/bin/gcc46 -- it could be that /usr/local/bin
isn't on the path that Makefile searches.

> To test, I placed in my environment:
> setenv CC gcc46
> setenv CXX g++46
> setenv CPP cpp46

Try using the fully qualified path in those settings:

setenv CC /usr/local/bin/gcc46
setenv CXX /usr/local/bin/g++46
setenv CPP /usr/local/bin/cpp46

(Sanity check that -- I don't have gcc46 installed, so cannot confirm
those are the correct paths.)

> When I do "cc -v" I still get clang output and not gcc46. What am I doing
> wrong here?

Well, yes.  What did you expect?  Typing 'cc' at the shell prompt will
almost certainly run /usr/bin/cc and that's going to be Clang on recent
versions of FreeBSD.  What you need to do is persuade your Makefile to
run a different compiler, somewhere else in the filesystem.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.

PGP: http://www.infracaninophile.co.uk/pgpkey
JID: matthew at infracaninophile.co.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 268 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20130316/7e531c28/attachment.sig>


More information about the freebsd-ports mailing list