Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Dec 2016 18:20:27 +0100
From:      Harry Schmalzbauer <freebsd@omnilan.de>
To:        freebsd-stable@freebsd.org
Subject:   share/mk/bsd.cpu.mk disables lang/gcc48 build with CPUTYPE
Message-ID:  <584C395B.8050000@omnilan.de>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060203010603070007040309
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

 Hello,

I'm unsure if I'd better file a bug report, but I'm also unsure if it's
ports or base…

When one defines CPUTYPE in make.conf(5), share/mk/bsd.cpu.mk translates
'core-avx-i' into 'ivybridge' e.g.
This breaks building e.g. ports/lang/gcc48:
configure:3374:
/usr/local/ports-wrktree/lang/gcc48/work/.build/./gcc/xgcc
-B/usr/local/ports-wrktree/lang/gcc48/work/.build/./gcc/
-B/usr/local/x86_64-portbld-f
reebsd11.0/bin/ -B/usr/local/x86_64-portbld-freebsd11.0/lib/ -isystem
/usr/local/x86_64-portbld-freebsd11.0/include -isystem
/usr/local/x86_64-portbld-freebsd11.
0/sys-include -o conftest -g -O2 -pipe -march=ivybridge -DLIBICONV_PLUG
-fno-strict-aliasing conftest.c >&5
conftest.c:1:0: error: bad value (ivybridge) for -march= switch

Translating reverse would require a second point of maintenance.
So it was better to have the translation beeing contitional.

But I'm not really familar with the share/mk make conventions.
So I can just provide one quick workarround (in case anyone searched for
a momentary solution to the build problem, see the attached patch).

This workarround changes the following:
· In /usr/share/mk/bsd.cpu.mk do _CPUFLAGS assignings _before_ alias
settings.
· Instead of usual variable expansion, use := to immediately set the
value, before aliasing "does the wrong thing"…

Note that the patch attached isn't verified for anything but amd64 and
core-avx-i vs. ivybridge (in /etc/make.conf CPUTYPE) and not suitable
for general usage, just if you want to get binaries of lang/gcc48 using
today's 11-stable with CPUTYPE.

Best,

-harry



--------------060203010603070007040309
Content-Type: text/x-patch;
 name="usr_share_mk_bsd.cpu.mk.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="usr_share_mk_bsd.cpu.mk.patch"

--- usr/share/mk/bsd.cpu.mk.orig	2016-12-10 15:16:39.625929000 +0100
+++ usr/share/mk/bsd.cpu.mk	2016-12-10 18:14:10.294579000 +0100
@@ -25,62 +25,6 @@
 . endif
 .else
 
-# Handle aliases (not documented in make.conf to avoid user confusion
-# between e.g. i586 and pentium)
-
-. if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
-.  if ${CPUTYPE} == "barcelona"
-CPUTYPE = amdfam10
-.  elif ${CPUTYPE} == "core-avx2"
-CPUTYPE = haswell
-.  elif ${CPUTYPE} == "core-avx-i"
-CPUTYPE = ivybridge
-.  elif ${CPUTYPE} == "corei7-avx"
-CPUTYPE = sandybridge
-.  elif ${CPUTYPE} == "corei7"
-CPUTYPE = nehalem
-.  elif ${CPUTYPE} == "slm"
-CPUTYPE = silvermont
-.  elif ${CPUTYPE} == "atom"
-CPUTYPE = bonnell
-.  elif ${CPUTYPE} == "core"
-CPUTYPE = prescott
-.  endif
-.  if ${MACHINE_CPUARCH} == "amd64"
-.   if ${CPUTYPE} == "prescott"
-CPUTYPE = nocona
-.   endif
-.  else
-.   if ${CPUTYPE} == "k7"
-CPUTYPE = athlon
-.   elif ${CPUTYPE} == "p4"
-CPUTYPE = pentium4
-.   elif ${CPUTYPE} == "p4m"
-CPUTYPE = pentium4m
-.   elif ${CPUTYPE} == "p3"
-CPUTYPE = pentium3
-.   elif ${CPUTYPE} == "p3m"
-CPUTYPE = pentium3m
-.   elif ${CPUTYPE} == "p-m"
-CPUTYPE = pentium-m
-.   elif ${CPUTYPE} == "p2"
-CPUTYPE = pentium2
-.   elif ${CPUTYPE} == "i686"
-CPUTYPE = pentiumpro
-.   elif ${CPUTYPE} == "i586/mmx"
-CPUTYPE = pentium-mmx
-.   elif ${CPUTYPE} == "i586"
-CPUTYPE = pentium
-.   endif
-.  endif
-. elif ${MACHINE_ARCH} == "sparc64"
-.  if ${CPUTYPE} == "us"
-CPUTYPE = ultrasparc
-.  elif ${CPUTYPE} == "us3"
-CPUTYPE = ultrasparc3
-.  endif
-. endif
-
 ###############################################################################
 # Logic to set up correct gcc optimization flag.  This must be included
 # after /etc/make.conf so it can react to the local value of CPUTYPE
@@ -99,10 +43,10 @@
 .  elif ${CPUTYPE} == "c7"
 _CPUCFLAGS = -march=c3-2
 .  else
-_CPUCFLAGS = -march=${CPUTYPE}
+_CPUCFLAGS := -march=${CPUTYPE}
 .  endif
 . elif ${MACHINE_CPUARCH} == "amd64"
-_CPUCFLAGS = -march=${CPUTYPE}
+_CPUCFLAGS := -march=${CPUTYPE}
 . elif ${MACHINE_CPUARCH} == "arm"
 .  if ${CPUTYPE} == "xscale"
 #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself
@@ -167,6 +111,62 @@
 _CPUCFLAGS = -mcpu=${CPUTYPE}
 . endif
 
+# Handle aliases (not documented in make.conf to avoid user confusion
+# between e.g. i586 and pentium)
+
+. if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+.  if ${CPUTYPE} == "barcelona"
+CPUTYPE = amdfam10
+.  elif ${CPUTYPE} == "core-avx2"
+CPUTYPE = haswell
+.  elif ${CPUTYPE} == "core-avx-i"
+CPUTYPE = ivybridge
+.  elif ${CPUTYPE} == "corei7-avx"
+CPUTYPE = sandybridge
+.  elif ${CPUTYPE} == "corei7"
+CPUTYPE = nehalem
+.  elif ${CPUTYPE} == "slm"
+CPUTYPE = silvermont
+.  elif ${CPUTYPE} == "atom"
+CPUTYPE = bonnell
+.  elif ${CPUTYPE} == "core"
+CPUTYPE = prescott
+.  endif
+.  if ${MACHINE_CPUARCH} == "amd64"
+.   if ${CPUTYPE} == "prescott"
+CPUTYPE = nocona
+.   endif
+.  else
+.   if ${CPUTYPE} == "k7"
+CPUTYPE = athlon
+.   elif ${CPUTYPE} == "p4"
+CPUTYPE = pentium4
+.   elif ${CPUTYPE} == "p4m"
+CPUTYPE = pentium4m
+.   elif ${CPUTYPE} == "p3"
+CPUTYPE = pentium3
+.   elif ${CPUTYPE} == "p3m"
+CPUTYPE = pentium3m
+.   elif ${CPUTYPE} == "p-m"
+CPUTYPE = pentium-m
+.   elif ${CPUTYPE} == "p2"
+CPUTYPE = pentium2
+.   elif ${CPUTYPE} == "i686"
+CPUTYPE = pentiumpro
+.   elif ${CPUTYPE} == "i586/mmx"
+CPUTYPE = pentium-mmx
+.   elif ${CPUTYPE} == "i586"
+CPUTYPE = pentium
+.   endif
+.  endif
+. elif ${MACHINE_ARCH} == "sparc64"
+.  if ${CPUTYPE} == "us"
+CPUTYPE = ultrasparc
+.  elif ${CPUTYPE} == "us3"
+CPUTYPE = ultrasparc3
+.  endif
+. endif
+
 # Set up the list of CPU features based on the CPU type.  This is an
 # unordered list to make it easy for client makefiles to test for the
 # presence of a CPU feature.

--------------060203010603070007040309--



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