Re: 11.0 -r301139: WITH_META_MODE=yes vs. "sh: ./make_keys: Exec format error"? [still true of -r301815]

From: Mark Millard <markmi_at_dsl-only.net>
Date: Sun, 12 Jun 2016 06:17:44 -0700
On 2016-Jun-12, at 5:39 AM, Simon J. Gerraty <sjg at juniper.net> wrote:

> Mark Millard <markmi_at_dsl-only.net> wrote:
>>> --- build-tools_lib/ncurses/ncursesw ---
>>> Building /usr/obj/clang/arm.armv6/usr/src/lib/ncurses/ncursesw/make_keys
> 
> I must have been looking at on of our internal FreeBSD trees last
> time...
> 
> 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. 
> 
> 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.
> 
> eg. in our internal tree - which cross builds fine:
> 
> make_keys: make_keys.c names.c ncurses_def.h ${HEADERS}
>        ${HOST_CC} -o $_at_ ${HOST_CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c
> 
> make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS}
>        ${HOST_CC} -o $_at_ ${HOST_CFLAGS} -DMAIN_PROGRAM \
> 	                ${NCURSES_DIR}/ncurses/tinfo/make_hash.c
> 
> and in share/mk/local.init.mk
> 
> HOST_CC?= /usr/bin/cc
> 
> should do.

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

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

So the ${CC} use must mix with some other aspect of WITH_META_MODE= 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}} == ""
> ${var}:=        ${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=$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=$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=$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=$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=$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=$HOST_CC ;;
> /usr/src/contrib/ofed/librdmacm/config/config.guess
. . .


===
Mark Millard
markmi at dsl-only.net
Received on Sun Jun 12 2016 - 11:17:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:05 UTC