Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jun 2016 06:17:44 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        "Simon J. Gerraty" <sjg@juniper.net>
Cc:        Bryan Drewery <bdrewery@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: 11.0 -r301139: WITH_META_MODE=yes vs. "sh: ./make_keys: Exec format error"? [still true of -r301815]
Message-ID:  <AAA6AB83-2357-4677-88DF-BC375ADDC3EF@dsl-only.net>
In-Reply-To: <38443.1465735161@kaos.jnpr.net>
References:  <890D3808-1939-4BEA-886F-324EBA8C8671@dsl-only.net> <92116.1464890038@kaos.jnpr.net> <4a2034a9-a2e1-d951-aecf-43e043c48d75@FreeBSD.org> <55609B4E-DCC8-4666-BA15-17B6EF7D593F@dsl-only.net> <38443.1465735161@kaos.jnpr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2016-Jun-12, at 5:39 AM, Simon J. Gerraty <sjg at juniper.net> wrote:

> Mark Millard <markmi@dsl-only.net> wrote:
>>> --- build-tools_lib/ncurses/ncursesw ---
>>> Building =
/usr/obj/clang/arm.armv6/usr/src/lib/ncurses/ncursesw/make_keys
>=20
> I must have been looking at on of our internal FreeBSD trees last
> time...
>=20
> In FreeBSD lib/ncurses/ncursesw/Makefile and other places I checked
> just uses ${CC} for building make_keys - I don't see how that could =
work
> for cross-building.=20
>=20
> If you want cross-building to work, the simple solution is to ensure
> that you use HOST_CC rather than CC when building things that need to
> run on the build host.
>=20
> eg. in our internal tree - which cross builds fine:
>=20
> make_keys: make_keys.c names.c ncurses_def.h ${HEADERS}
>        ${HOST_CC} -o $@ ${HOST_CFLAGS} =
${NCURSES_DIR}/ncurses/tinfo/make_keys.c
>=20
> make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS}
>        ${HOST_CC} -o $@ ${HOST_CFLAGS} -DMAIN_PROGRAM \
> 	                ${NCURSES_DIR}/ncurses/tinfo/make_hash.c
>=20
> and in share/mk/local.init.mk
>=20
> HOST_CC?=3D /usr/bin/cc
>=20
> should do.

Cross builds work just fine based on the FreeBSD tree when omitting =
WITH_META_MODE=3D.

It is only when using WITH_META_MODE=3D that the cross build does not =
work.

So the ${CC} use must mix with some other aspect of WITH_META_MODE=3D =
operation if ${CC} use contributes to the failure.

As of -r301825 there is almost no use of HOST_CC at the upper levels or =
in share/mk/*:

> # grep HOST_CC /usr/src/Makefile*
> # grep HOST_CC /usr/src/share/mk/*
> /usr/src/share/mk/bsd.compiler.mk:.for var in CC CXX HOST_CC HOST_CXX

where that last does:

> .for var in CC CXX HOST_CC HOST_CXX
> .if defined(${var}) && ${${var}:M${CCACHE_BIN}} =3D=3D ""
> ${var}:=3D        ${CCACHE_BIN} ${${var}}
> .endif
> .endfor



Looking around more suggests that there is CC_FOR_BUILD and that HOST_CC =
is more historical:

> find /usr/src/ -name .svn -prune -o -exec grep HOST_CC {} ; -print | =
more
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/sqlite3/config.guess
>         * Makefile.in: rename HOST_CC to CC_FOR_BUILD
> /usr/src/contrib/binutils/ld/ChangeLog-9197
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/binutils/config.guess
>         (HOST_CC, HOST_PREFIX, HOST_PREFIX_1): Undefine, they should
>         (HOST_CC, HOST_PREFIX, HOST_PREFIX_1): New variables.
> /usr/src/contrib/binutils/ChangeLog
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/ntp/config.guess
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/ntp/sntp/config.guess
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/ntp/sntp/libevent/build-aux/config.guess
> # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
> # use `HOST_CC' if defined, but it is deprecated.
> case $CC_FOR_BUILD,$HOST_CC,$CC in
>  ,*,*)  CC_FOR_BUILD=3D$HOST_CC ;;
> /usr/src/contrib/ofed/librdmacm/config/config.guess
. . .


=3D=3D=3D
Mark Millard
markmi at dsl-only.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AAA6AB83-2357-4677-88DF-BC375ADDC3EF>