Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2013 05:56:45 GMT
From:      Yamaya Takashi <yamayan@kbh.biglobe.ne.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/175252: [patch]bsd.gcc.mk, USE_GCC=any when no gcc in base and ...
Message-ID:  <201301130556.r0D5ujiK088007@red.freebsd.org>
Resent-Message-ID: <201301130600.r0D601HX050290@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175252
>Category:       ports
>Synopsis:       [patch]bsd.gcc.mk, USE_GCC=any when no gcc in base and ...
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 13 06:00:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Yamaya Takashi
>Release:        10-CURRENT
>Organization:
>Environment:
FreeBSD genius 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r245356M: Sun Jan 13 12:51:15 JST 2013     root@genius:/usr/obj/usr/src/sys/NYANCO  amd64

>Description:
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.
>How-To-Repeat:

>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:

Index: bsd.gcc.mk
===================================================================
--- bsd.gcc.mk	(revision 310139)
+++ bsd.gcc.mk	(working copy)
@@ -131,11 +131,9 @@
 
 # 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)
@@ -151,7 +149,9 @@
 . endif
 . if ${OSVERSION} >= ${_GCCVERSION_${v}_L} && ${OSVERSION} < ${_GCCVERSION_${v}_R}
 _GCCVERSION:=		${v}
+.  if exists(/usr/bin/gcc)
 _GCC_FOUND${v}:=	base
+.  endif
 . endif
 .endfor
 .if !defined(_GCCVERSION)
@@ -198,7 +198,7 @@
 # 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}
@@ -223,7 +223,7 @@
 # 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 # ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R} || !exists(/usr/bin/gcc)
 CC:=			gcc
 CXX:=			g++
 .   if exists(/usr/bin/gcpp)
@@ -231,7 +231,7 @@
 .   else
 CPP:=			cpp
 .   endif
-.  endif # ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R}
+.  endif # ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R} || !exists(/usr/bin/gcc)
 . endif # ${_USE_GCC} == ${_GCCVERSION_${v}_V}
 .endfor
 .undef V


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301130556.r0D5ujiK088007>