Bug 81116 - USE_GCC=X.Y+ should prefer the stock compiler
Summary: USE_GCC=X.Y+ should prefer the stock compiler
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Edwin Groothuis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 19:00 UTC by David E. O'Brien
Modified: 2005-06-03 02:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David E. O'Brien freebsd_committer freebsd_triage 2005-05-16 19:00:19 UTC
	USE_GCC=3.2+ on a 6-CURRENT system prefers the GCC 3.2 compiler
	instead of the GCC 3.4 default system compiler.
	One often uses USE_GCC=3.2+ to enable a port to build on RELENG_4,
	but that does not mean a 6-CURRENT user doesn't want to use the
	native compiler.
	I also argue that the correct algorithm for USE_GCC=3.2+ is:
	1. Use system compiler if it's version is allowable by the USE_GCC
	   invocation.
	2. Prefer the highest version # found already installed and allowed
	   by the USE_GCC invocation, rather than the lowest.
	3. Install the specified GCC version and use if, if no other already
	   installed compiler meets the USE_GCC invocation.
Comment 1 edwin 2005-05-19 01:00:11 UTC
On Mon, May 16, 2005 at 10:50:01AM -0700, David O'Brien wrote:
> >Synopsis:       USE_GCC=X.Y+ should prefer the stock compiler

Can you show what the output of "make test-gcc" is?

Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2005-05-19 01:17:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->edwin

Mine.
Comment 3 edwin 2005-05-22 05:38:37 UTC
Please try this patch, it works here as you described:

[~/cvs/ports/games/enigma] edwin@k7>make test-gcc
USE_GCC=2.7+
Port can use later versions.
GCC version: 2.7 - OSVERSION from 000000 to 400012
GCC version: 2.95 (port) - OSVERSION from 400012 to 500035
GCC version: 3.1 - OSVERSION from 500035 to 500039
GCC version: 3.2 - OSVERSION from 500039 to 501103
GCC version: 3.3 (base) - OSVERSION from 501103 to 502126
GCC version: 3.4 (port) - OSVERSION from 502126 to 999999
GCC version: 4.0 - OSVERSION from 999999 to 999999
GCC version: 4.1 - OSVERSION from 999999 to 999999
Using GCC vesion 3.3
CC:cc - CXX:c++ - F77: - BUILD_DEPENDS:/usr/local/lib/libzipios.a:/usr/ports/archivers/zipios++ /usr/local/bin/tolua:/usr/ports/lang/tolua4 /usr/local/bin/sdl11-config:/usr/ports/devel/sdl12 gmake:/usr/ports/devel/gmake


Index: bsd.gcc.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.gcc.mk,v
retrieving revision 1.2
diff -u -r1.2 bsd.gcc.mk
--- bsd.gcc.mk	21 May 2005 11:34:43 -0000	1.2
+++ bsd.gcc.mk	22 May 2005 04:36:02 -0000
@@ -99,14 +99,23 @@
 #
 # If the GCC package defined in USE_GCC does not exist, but a later
 # version is allowed (for example 3.1+), see if there is a later.
-# The first available version will be used.
+# First check if the base installed version is good enough, otherwise
+# get the first available version.
 #
 .if defined(_GCC_ORLATER)
 . for v in ${GCCVERSIONS}
 .  if ${_USE_GCC} == ${_GCCVERSION_${v}_V}
-_GCC_MIN:=	true
+_GCC_MIN1:=	true
 .  endif
-.  if defined(_GCC_MIN) && defined(_GCC_FOUND${v}) && !defined(_GCC_FOUND)
+.  if defined(_GCC_MIN1) && defined(_GCC_FOUND${v}) && ${_GCC_FOUND${v}}=="base" && !defined(_GCC_FOUND)
+_GCC_FOUND:=	${_GCCVERSION_${v}_V}
+.  endif
+. endfor
+. for v in ${GCCVERSIONS}
+.  if ${_USE_GCC} == ${_GCCVERSION_${v}_V}
+_GCC_MIN2:=	true
+.  endif
+.  if defined(_GCC_MIN2) && defined(_GCC_FOUND${v}) && !defined(_GCC_FOUND)
 _GCC_FOUND:=	${_GCCVERSION_${v}_V}
 .  endif
 . endfor

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 4 Edwin Groothuis freebsd_committer freebsd_triage 2005-05-22 05:38:52 UTC
State Changed
From-To: open->feedback

Patch submitted, please test
Comment 5 edwin 2005-05-27 10:43:41 UTC
Can you tell me if the submitted patch did what you have in mind?

Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 6 edwin 2005-05-30 02:19:35 UTC
----- Forwarded message from Edwin Groothuis <edwin@mavetju.org> -----

Date: Fri, 27 May 2005 19:43:40 +1000
From: Edwin Groothuis <edwin@mavetju.org>
To: David O'Brien <obrien@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/81116: USE_GCC=X.Y+ should prefer the stock compiler

Can you tell me if the submitted patch did what you have in mind?

Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

----- End forwarded message -----

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 7 Edwin Groothuis freebsd_committer freebsd_triage 2005-06-02 08:34:12 UTC
----- Forwarded message from Edwin Groothuis <edwin@mavetju.org> -----

Date: Mon, 30 May 2005 11:19:35 +1000
From: Edwin Groothuis <edwin@mavetju.org>
To: David O'Brien <obrien@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: [edwin@mavetju.org: Re: ports/81116: USE_GCC=X.Y+ should prefer the stock compiler]

----- Forwarded message from Edwin Groothuis <edwin@mavetju.org> -----

Date: Fri, 27 May 2005 19:43:40 +1000
From: Edwin Groothuis <edwin@mavetju.org>
To: David O'Brien <obrien@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/81116: USE_GCC=X.Y+ should prefer the stock compiler

Can you tell me if the submitted patch did what you have in mind?

Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

----- End forwarded message -----

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

----- End forwarded message -----

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/
Comment 8 David E. O'Brien freebsd_committer freebsd_triage 2005-06-02 09:22:26 UTC
On Sun, May 22, 2005 at 02:38:37PM +1000, Edwin Groothuis wrote:
> Please try this patch, it works here as you described:

I tested this patch using /usr/ports/misc/bidwatcher.  I had the gcc31,
gcc32, gcc33 ports installed.

It did exactly what I wanted it to on 6-current.  Looking at the patch
I'm not sure what would happen on a releng4 machine.  Would gcc33 or
gcc31 be used?  I mostly think that the newest compiler installed should
be used if the base system compiler isn't suitable.
 
-- 
-- David  (obrien@FreeBSD.org)
Comment 9 Edwin Groothuis freebsd_committer freebsd_triage 2005-06-03 02:43:09 UTC
State Changed
From-To: feedback->closed

Commited. See the commit log for a detailed description. 
Thanks.