From owner-freebsd-questions@freebsd.org Fri Jun 17 02:39:46 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A60FA47C7A for ; Fri, 17 Jun 2016 02:39:46 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 0A2C9137D for ; Fri, 17 Jun 2016 02:39:46 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: by mailman.ysv.freebsd.org (Postfix) id 05D25A47C79; Fri, 17 Jun 2016 02:39:46 +0000 (UTC) Delivered-To: questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 031FEA47C78 for ; Fri, 17 Jun 2016 02:39:45 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net [150.101.137.129]) by mx1.freebsd.org (Postfix) with ESMTP id 8CAAA137C for ; Fri, 17 Jun 2016 02:39:45 +0000 (UTC) (envelope-from FreeBSD@shaneware.biz) Received: from ppp14-2-37-105.lns21.adl2.internode.on.net (HELO leader.local) ([14.2.37.105]) by ipmail06.adl2.internode.on.net with ESMTP; 17 Jun 2016 12:03:02 +0930 Subject: Re: gcc-4.8.4_3 To: john drake , questions@freebsd.org References: <78CEDABA-2A7F-4361-B626-D05CB2F966A0@yahoo.com> From: Shane Ambler Message-ID: <5763615C.70900@ShaneWare.Biz> Date: Fri, 17 Jun 2016 12:03:00 +0930 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <78CEDABA-2A7F-4361-B626-D05CB2F966A0@yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2016 02:39:46 -0000 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