gcc-4.8.4_3

Shane Ambler FreeBSD at ShaneWare.Biz
Fri Jun 17 02:39:46 UTC 2016


On 17/06/2016 09:05, john drake via freebsd-questions wrote:
> Am running FreeBSD 10.2 and installed gcc-4.8.4_3
>
> After installation received the following message from bcc:
> for linking use -Wl,
> -rparh=/usr/local/lib/gcc48
>
> For ports leveraging USE_GCC,
> USES=compiler, or
> USES=fortran,
> this happens transparently.

Firstly this only applies to using the FreeBSD ports system. For a
project that you manually compile within your home folder this will not
help.

See the porters handbook for help creating a port -
https://www.freebsd.org/doc/en/books/porters-handbook/

> (1). What does this mean, and how do I make it happen transparently?
 > How do I actually implement the USE approach?

In a port's Makefile you can add USE_GCC=4.8+ and the port will be built
using gcc v4.8 or higher. The ports infrastructure adds the relevant
settings to environment variables for this to work.

See /usr/ports/Mk/bsd.gcc.mk

There is also USE=compiler:ARGS for a more flexible approach. This
allows a port to specify it needs a compiler that supports C++11 and a
version of gcc or clang that supports c++11 will be chosen.

See /usr/ports/Mk/Uses/compiler

To work, both of these options rely on the projects build system
respecting environment variables such as CC CXX CFLAGS CXXFLAGS...
patches sometimes need to be applied otherwise.

USE=fortran is similar but only applies to using gcc or ifort as the
compiler when the project uses fortran.

> (2). Can I make this transparent by altering the path command by
> adding /usr/local/lib/gcc48?

In most cases, adding one of the above options to a port's Makefile is
all that is needed.

> (3)   Please supply me with answers to both approaches and their
> relative advantages/disadvantages?

USE_GCC - specifies that only gcc can be used on this project.

USE=compiler - is more flexible as gcc or clang may be used as long as
it supports the features you need for the project.

The USE=compiler also allows a user to set FAVORITE_COMPILER in their
make.conf to influence the compiler chosen.

> (4). Also, supply me with the best approach.

That's a matter of opinion with some dependency on the way the project
is compiled. I would say USE=compiler is a better option but some
projects will only compile with gcc so need to have USE_GCC

-- 
FreeBSD - the place to B...Software Developing

Shane Ambler



More information about the freebsd-questions mailing list