Bug 175252 - [patch]bsd.gcc.mk, USE_GCC=any when no gcc in base and ...
Summary: [patch]bsd.gcc.mk, USE_GCC=any when no gcc in base and ...
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: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-13 06:00 UTC by yamayan
Modified: 2013-03-16 13:17 UTC (History)
0 users

See Also:


Attachments
file.diff (1.78 KB, patch)
2013-01-13 06:00 UTC, yamayan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yamayan 2013-01-13 06:00:01 UTC
When no gcc in base, some ports using USE_GCC=any can not build.
bsd.gcc.mk checks OSVERSION only, and sets CC=gcc CXX=g++.

For example:
#cd /usr/ports/graphics/evas-core
#make test-gcc
USE_GCC=any
USE_FORTRAN=
Port can use later versions.
GCC version: 3.4 - OSVERSION from 502126 to 700042
GCC version: 4.2 (base) - OSVERSION from 700042 to 9999999
GCC version: 4.4 - OSVERSION from 0 to 0
GCC version: 4.6 (port) - OSVERSION from 0 to 0
GCC version: 4.7 - OSVERSION from 0 to 0
GCC version: 4.8 - OSVERSION from 0 to 0
Using GCC version 4.2
CC=gcc - CXX=g++ - CPP=cpp - CFLAGS="-O2 -pipe -march=native -I/usr/local/include -fno-strict-aliasing"
F77= - FC=f77 - FFLAGS="-O"
LDFLAGS=" -L/usr/local/lib"
BUILD_DEPENDS= pkgconf:/usr/ports/devel/pkgconf
RUN_DEPENDS= pkgconf:/usr/ports/devel/pkgconf

#ls /usr/bin/gcc
ls: /usr/bin/gcc: No such file or directory


another problem:
_GCCVERSION_OKAY check logic is broken.
comparing _USE_GCC to OSVERSION is wrong.

Fix: patch my patch.

First problem:
Add exists(/usr/bin/gcc) logic.

Second problem:
Compare _USE_GCC to only _GCCVERSION_${v}_V.


result:
#cd /usr/ports/graphics/evas-core
#make test-gcc
USE_GCC=any
USE_FORTRAN=
Port can use later versions.
GCC version: 3.4 - OSVERSION from 502126 to 700042
GCC version: 4.2 - OSVERSION from 700042 to 9999999
GCC version: 4.4 - OSVERSION from 0 to 0
GCC version: 4.6 (port) - OSVERSION from 0 to 0
GCC version: 4.7 - OSVERSION from 0 to 0
GCC version: 4.8 - OSVERSION from 0 to 0
Using GCC version 4.6
CC=gcc46 - CXX=g++46 - CPP=cpp46 - CFLAGS="-O2 -pipe -march=native -I/usr/local/include -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing"
F77= - FC=f77 - FFLAGS="-O"
LDFLAGS=" -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc46"
BUILD_DEPENDS=gcc46:/usr/ports/lang/gcc /usr/local/bin/as:/usr/ports/devel/binutils  pkgconf:/usr/ports/devel/pkgconf
RUN_DEPENDS=gcc46:/usr/ports/lang/gcc  pkgconf:/usr/ports/devel/pkgconf


Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-01-13 06:00:42 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gerald

bsd.gcc.mk is gerald territory (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-03-02 01:06:29 UTC
Author: gerald
Date: Sat Mar  2 01:06:15 2013
New Revision: 313177
URL: http://svnweb.freebsd.org/changeset/ports/313177

Log:
  Remove a bogus old check that assumes that every version of FreeBSD has
  GCC in the base.
  
  Adjust a comment, now describing the real purpose of the code remaining
  in that block.
  
  PR:		175252

Modified:
  head/Mk/bsd.gcc.mk

Modified: head/Mk/bsd.gcc.mk
==============================================================================
--- head/Mk/bsd.gcc.mk	Sat Mar  2 00:40:53 2013	(r313176)
+++ head/Mk/bsd.gcc.mk	Sat Mar  2 01:06:15 2013	(r313177)
@@ -143,20 +143,16 @@ IGNORE=	Unknown version of GCC specified
 .endif
 
 #
-# Determine current GCCVERSION
+# Initialize _GCC_FOUND${v}.
 #
 .for v in ${GCCVERSIONS}
 . if exists(${LOCALBASE}/bin/gcc${_GCCVERSION_${v}_V:S/.//})
 _GCC_FOUND${v}=	port
 . endif
 . if ${OSVERSION} >= ${_GCCVERSION_${v}_L} && ${OSVERSION} < ${_GCCVERSION_${v}_R}
-_GCCVERSION:=		${v}
 _GCC_FOUND${v}:=	base
 . endif
 .endfor
-.if !defined(_GCCVERSION)
-IGNORE=		Couldn't find your current GCCVERSION (OSVERSION=${OSVERSION})
-.endif
 
 #
 # If the GCC package defined in USE_GCC does not exist, but a later
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-03-03 03:21:37 UTC
Author: gerald
Date: Sun Mar  3 03:21:29 2013
New Revision: 313323
URL: http://svnweb.freebsd.org/changeset/ports/313323

Log:
  Do not just rely on the version number of FreeBSD in deciding whether
  a certain version of GCC is in the base, but also check the existence
  of /usr/bin/gcc.
  
  This unbreaks systems where GCC is not built as part of the world, and
  instead relies on versions of GCC in the Ports Collection there.
  
  PR:		175252
  Submitted by:	Yamaya Takashi <yamayan@kbh.biglobe.ne.jp>

Modified:
  head/Mk/bsd.gcc.mk

Modified: head/Mk/bsd.gcc.mk
==============================================================================
--- head/Mk/bsd.gcc.mk	Sun Mar  3 02:51:25 2013	(r313322)
+++ head/Mk/bsd.gcc.mk	Sun Mar  3 03:21:29 2013	(r313323)
@@ -150,7 +150,9 @@ IGNORE=	Unknown version of GCC specified
 _GCC_FOUND${v}=	port
 . endif
 . if ${OSVERSION} >= ${_GCCVERSION_${v}_L} && ${OSVERSION} < ${_GCCVERSION_${v}_R}
+.  if exists(/usr/bin/gcc)
 _GCC_FOUND${v}:=	base
+.  endif
 . endif
 .endfor
 
@@ -194,7 +196,7 @@ _USE_GCC:=	${GCC_DEFAULT_VERSION}
 # dependencies, CC, CXX, CPP, and flags.
 .for v in ${GCCVERSIONS}
 . if ${_USE_GCC} == ${_GCCVERSION_${v}_V}
-.  if ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R}
+.  if ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R} || !exists(/usr/bin/gcc)
 V:=			${_GCCVERSION_${v}_V:S/.//}
 _GCC_PORT_DEPENDS:=	gcc${V}
 .   if ${_USE_GCC} == ${GCC_DEFAULT_VERSION}
@@ -219,7 +221,7 @@ FFLAGS+=		-Wl,-rpath=${_GCC_RUNTIME}
 # ever telling us; to be fixed.
 _GCC_BUILD_DEPENDS:=	${_GCC_PORT_DEPENDS}
 .   endif # ${_USE_GCC} != 3.4
-.  else # ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R}
+.  else # Use GCC in base.
 CC:=			gcc
 CXX:=			g++
 .   if exists(/usr/bin/gcpp)
@@ -227,7 +229,7 @@ CPP:=			gcpp
 .   else
 CPP:=			cpp
 .   endif
-.  endif # ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R}
+.  endif # Use GCC in base.
 . endif # ${_USE_GCC} == ${_GCCVERSION_${v}_V}
 .endfor
 .undef V
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-03-16 13:01:19 UTC
Author: gerald
Date: Sat Mar 16 13:01:12 2013
New Revision: 314352
URL: http://svnweb.freebsd.org/changeset/ports/314352

Log:
  Simplify (and strictly speaking, though not practically given version
  number schemes between FreeBSD and GCC, correct) the check for a valid
  version specified by USE_GCC. [1]
  
  If IGNORE is set, have test-gcc note that instead of showing its usual,
  and in that case incorrect and useless, debugging output.
  
  PR:		175252 [1]
  Submitted by:	Yamaya Takashi <yamayan@kbh.biglobe.ne.jp> [1]

Modified:
  head/Mk/bsd.gcc.mk

Modified: head/Mk/bsd.gcc.mk
==============================================================================
--- head/Mk/bsd.gcc.mk	Sat Mar 16 12:51:56 2013	(r314351)
+++ head/Mk/bsd.gcc.mk	Sat Mar 16 13:01:12 2013	(r314352)
@@ -131,11 +131,9 @@ _GCC_ORLATER:=	true
 
 # Check if USE_GCC points to a valid version.
 .for v in ${GCCVERSIONS}
-. for j in ${GCCVERSION_${v}}
-.  if ${_USE_GCC}==${j}
+. if ${_USE_GCC}==${_GCCVERSION_${v}_V}
 _GCCVERSION_OKAY=	true;
-.  endif
-. endfor
+. endif
 .endfor
 
 .if !defined(_GCCVERSION_OKAY)
@@ -251,6 +249,9 @@ USE_BINUTILS=	yes
 test-gcc:
 	@echo USE_GCC=${USE_GCC}
 	@echo USE_FORTRAN=${USE_FORTRAN}
+.if defined(IGNORE)
+	@echo "IGNORE: ${IGNORE}"
+.else
 .if defined(USE_GCC)
 .if defined(_GCC_ORLATER)
 	@echo Port can use later versions.
@@ -272,3 +273,4 @@ test-gcc:
 	@echo LDFLAGS=\"${LDFLAGS}\"
 	@echo "BUILD_DEPENDS=${BUILD_DEPENDS}"
 	@echo "RUN_DEPENDS=${RUN_DEPENDS}"
+.endif
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Gerald Pfeifer freebsd_committer freebsd_triage 2013-03-16 13:13:13 UTC
State Changed
From-To: open->closed

Thank you very much for your report and patches. 

As you see, there are further changes actually triggered by this, 
and there will be at least one further change I will commit that 
refers to this PR (to simplify things and avoid the duplicate 
check for /usr/bin/gcc you introduced). 

That said, since from a user perspective things should fully work 
now, I am marking this report as closed. 

If you have any further fixes or improvements, please let us know.