Re: git: f9df60975087 - main - Add support for host32 for DIRDEPS_BUILD

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 24 Sep 2023 00:28:22 UTC
On Sep 23, 2023, at 15:51, Simon J. Gerraty <sjg@juniper.net> wrote:

> Simon J. Gerraty <sjg@juniper.net> wrote:
>>> Looks like this broke lib32 builds via it ending up using
>>> the default:
>>> 
>>> -target armv7-unknown-freebsd
>>> 
>>> instead of the correct:
>>> 
>>> -target armv7-unknown-freebsd15.0-gnueabihf
>> 
>> Sorry.
>> 
>> That would be easier to fix/control if a separate variable
>> is used to hold just the -target flag 
>> 
>> That way bsd.compat.mk could reset that varaible if needed with no harm
>> done.
>> 
> 
> Does the following look like it would DTRT for you?
> Not sure about COMPILER_TYPE vs COMPAT_COMPILER_TYPE

I reported strictly based on noticing the official FreeBSD
Jenkins activity having build failures. My environment is
currently based on a commit that is a day or two before
your change, so I'd need to progress in order to be able
to test anything that fixed the operation.

I expect that Mike Karels would be a better one to comment
on any alternate structuring for having the build environment
always be explicit for its aarch64 -m32 use, at least based
on preexisting familiarity with where and how things are used.

Last I tried, gcc12 based builds did not work/finish for
aarch64, even though amd64 was working at the time. It seemed
that the status was not a surprise to folks. Correctly
covering gcc12 use for this issue may well still end up with
a broken/incomplete aarch64+LIB32 build via gcc12 --for other
reasons.

(E-mail has a tendency to not preserve leading whitespace.)

> diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk
> index 0c387bcb020c67ea6eda8fc1f4956eebf098e2a2..1e82df42391c4cec341ad368cb477fe4a14c84b8 100644
> --- a/share/mk/bsd.compat.mk
> +++ b/share/mk/bsd.compat.mk
> @@ -26,16 +26,18 @@ COMPAT_COMPILER_TYPE=${COMPILER_TYPE}
> 
> # -------------------------------------------------------------------
> # 32 bit world
> +LIB32CPUFLAGS= ${LIB32CPUFLAGS.${COMPAT_COMPILER_TYPE}:U}
> +LIB32CPUFLAGS.clang= -target ${CROSS_TARGET.clang}
> .if ${COMPAT_ARCH} == "amd64"
> HAS_COMPAT+= 32
> .if empty(LIB32CPUTYPE)
> -LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
> +LIB32CPUFLAGS+= -march=i686 -mmmx -msse -msse2
> .else
> -LIB32CPUFLAGS= -march=${LIB32CPUTYPE}
> +LIB32CPUFLAGS+= -march=${LIB32CPUTYPE}
> .endif
> .if ${COMPAT_COMPILER_TYPE} == gcc
> .else
> -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd${OS_REVISION}
> +CROSS_TARGET.clang= x86_64-unknown-freebsd${OS_REVISION}
> .endif
> LIB32CPUFLAGS+= -m32
> LIB32_MACHINE= i386
> @@ -47,15 +49,15 @@ LIB32WMAKEFLAGS= \
> .elif ${COMPAT_ARCH} == "powerpc64"
> HAS_COMPAT+= 32
> .if empty(LIB32CPUTYPE)
> -LIB32CPUFLAGS= -mcpu=powerpc
> +LIB32CPUFLAGS+= -mcpu=powerpc
> .else
> -LIB32CPUFLAGS= -mcpu=${LIB32CPUTYPE}
> +LIB32CPUFLAGS+= -mcpu=${LIB32CPUTYPE}
> .endif
> 
> .if ${COMPAT_COMPILER_TYPE} == "gcc"
> LIB32CPUFLAGS+= -m32
> .else
> -LIB32CPUFLAGS+= -target powerpc-unknown-freebsd${OS_REVISION}
> +CROSS_TARGET.clang= powerpc-unknown-freebsd${OS_REVISION}
> .endif
> 
> LIB32_MACHINE= powerpc
> @@ -66,15 +68,15 @@ LIB32WMAKEFLAGS= \
> .elif ${COMPAT_ARCH} == "aarch64"
> HAS_COMPAT+= 32
> .if empty(LIB32CPUTYPE)
> -LIB32CPUFLAGS= -march=armv7
> +LIB32CPUFLAGS+= -march=armv7
> .else
> -LIB32CPUFLAGS= -mcpu=${LIB32CPUTYPE}
> +LIB32CPUFLAGS+= -mcpu=${LIB32CPUTYPE}
> .endif
> 
> LIB32CPUFLAGS+= -m32
> .if ${COMPAT_COMPILER_TYPE} == "gcc"
> .else
> -LIB32CPUFLAGS+= -target armv7-unknown-freebsd${OS_REVISION}-gnueabihf
> +CROSS_TARGET.clang= armv7-unknown-freebsd${OS_REVISION}-gnueabihf
> .endif
> 
> LIB32_MACHINE= arm
> diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk
> index eb21380f051c4ec8434301ed16c881d07a83dddf..dae540261f7961937db9101da32acc8dfca20e8f 100644
> --- a/share/mk/local.sys.mk
> +++ b/share/mk/local.sys.mk
> @@ -97,7 +97,9 @@ META_DEPS+= ${META_NOPHONY}
> 
> .if ${MACHINE:Nhost*:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
> # cross-building
> -CROSS_TARGET_FLAGS?= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
> +CROSS_TARGET.clang?= ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
> +CROSS_TARGET_FLAGS.clang?= -target ${CROSS_TARGET.clang}
> +CROSS_TARGET_FLAGS?= ${CROSS_TARGET_FLAGS.${COMPILER_TYPE}}
> CFLAGS+= ${CROSS_TARGET_FLAGS}
> ACFLAGS+= ${CROSS_TARGET_FLAGS}
> .endif

I see that you have since disabled the new share/mk/local.sys.mk
code unless ${MK_DIRDEPS_BUILD} == "yes" --thus giving time
for considering alternatives.


===
Mark Millard
marklmi at yahoo.com