USE_GCC

Matthew Seaman matthew at FreeBSD.org
Sun Jan 10 23:02:46 UTC 2016


On 10/01/2016 22:26, John Haraden via freebsd-questions wrote:
> I am running GCC on version 10.2.
> For the fortran compiler, the linker requires Wl, -rpath=target library.
> However, there is a message saying this happens transparently for ports leveraging USE_GCC or USES=compiler.  What does this mean?  How do I leverage GCC?  Where do I get USE_GCC?  Where do I put USES=compiler?

As a ports user, you don't deal with stuff like 'USE_GCC' -- that's for
use when actually writing the port, something that really only port
maintainers need to do.

If you would prefer to use gcc rather than clang as your default
compiler when building ports, then you can add this to /etc/make.conf:

FAVORITE_COMPILER=gcc

On the other hand, if you are actually porting some software then the
ideal in the ports is not to force usage of a specific compiler unless
absolutely necessary.  Instead, you tell the ports infrastructure what
language features the software you're compiling has (eg.
USES=compiler:c++11-lang -- the port is written in C++ according to the
2011 standard) and the ports will pull in whatever compiler is available
on your particular CPU architecture / OS version and that fits your
FAVORITE_COMPILER preference as far as possible.

USES=compiler:foo is not exactly an introductory level topic when
starting to learn about the ports.  Don't be afraid to ask for advice on
the freebsd-ports@ mailing list if this is your use case.

On the gripping hand, if you just want to compile some code outside of
the ports, then *mostly* it's a case of setting make(1) variables like
CC or F77 to invoke your preferred binary.  Frequently you can do that
at the point you run autoconf which will write that choice into the
Makefiles it generates, but compilation systems vary.  Yes, the
particular compiler toolchain you choose will affect the arguments you
need to give to control the linker or other components.  It's best to
give a lot more detail about exactly what it is you're trying to
compile, what you tried, how you expected it to work and what actually
happened.  That way people can give you concrete advice rather than
having to guess what you actually mean.

	Cheers,

	Matthew


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 957 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20160110/4bddb05f/attachment.sig>


More information about the freebsd-questions mailing list