I tried to cross-compile sparc64 distribution on amd64 platform. Build host is FreeBSD 10.1-STABLE, updated yesterday (sources and host itself). Build fails on ncurses, trying to execute fresh built make_keys. It fails to run because it was built for sparc64. [root@alba ncurses]$ make buildworld TARGET=sparc64 MAKEOBJDIRPREFIX=/usr/obj-sparc64 [...] ===> lib/ncurses/ncurses (obj,depend,all,install) sed </usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/curses.h.in >curses.head -e "/@BROKEN_LINKER@/s%%0%" -e "/@HAVE_VSSCANF@/s%%1%" -e "/@NCURSES_CH_T@/s%%chtype%" -e "/@NCURSES_CONST@/s%%const%" -e "/@NCURSES_EXT_COLORS@/s%%0%" -e "/@NCURSES_EXT_FUNCS@/s%%1%" -e "/@NCURSES_INLINE@/s%%inline%" -e "/@NCURSES_LIBUTF8@/s%%0%" -e "/@NCURSES_MAJOR@/s%%5%" -e "/@NCURSES_MBSTATE_T@/s%%0%" -e "/@NCURSES_MINOR@/s%%7%" -e "/@NCURSES_MOUSE_VERSION@/s%%1%" -e "/@NCURSES_OK_WCHAR_T@/s%%%" -e "/@NCURSES_OPAQUE@/s%%0%" -e "/@NCURSES_PATCH@/s%%20081102%" -e "/@NCURSES_SIZE_T@/s%%short%" -e "/@NCURSES_TPARM_VARARGS@/s%%1%" -e "/@NCURSES_WCHAR_T@/s%%0%" -e "/@NCURSES_WCHAR_T@/s%%0%" -e "/@NCURSES_WINT_T@/s%%0%" -e "/@NEED_WCHAR_H@/s%%0%" -e "/@USE_CXX_BOOL@/s%%defined(__cplusplus)%" -e "s%@cf_cv_1UL@%1UL%g" -e "s%@cf_cv_builtin_bool@%1%g" -e "s%@cf_cv_enable_lp64@%0%g" -e "s%@cf_cv_enable_opaque@%NCURSES_OPAQUE%g" -e "s%@cf_cv_enable_reentrant@%0%g" -e "s%@cf_cv_header_stdbool_h@%1%g" -e "s%@cf_cv_type_of_bool@%unsigned char%g" -e "s%@cf_cv_typeof_chtype@%long%g" -e "s%@cf_cv_typeof_mmask_t@%long%g" -e "s/ _WCHAR_T/ __wchar_t/g" -e "s/ _WINT_T/ __wint_t/g" cat curses.head > curses.h.new AWK=awk _POSIX2_VERSION=199209 sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/MKkey_defs.sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/Caps >> curses.h.new cat /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/curses.tail >> curses.h.new mv -f curses.h.new curses.h sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/MKhashsize.sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/Caps > hashsize.h AWK=awk sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses/tinfo/MKkeys_list.sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/Caps | LC_ALL=C sort > keys.list awk -f /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses/tinfo/MKnames.awk bigstrings=1 /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/Caps > names.c AWK=awk sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/MKncurses_def.sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/ncurses_defs > ncurses_def.h sed </usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/MKterm.h.awk.in >MKterm.h.awk -e "/@BROKEN_LINKER@/s%%0%" -e "/@NCURSES_MAJOR@/s%%5%" -e "/@NCURSES_MINOR@/s%%7%" -e "/@NCURSES_CONST@/s%%const%" -e "/@NCURSES_TPARM_VARARGS@/s%%1%" -e "/@NCURSES_SBOOL@/s%%char%" -e "/@NCURSES_XNAMES@/s%%1%" -e "/@HAVE_TERMIOS_H@/s%%1%" -e "/@HAVE_TERMIO_H@/s%%0%" -e "/@HAVE_TCGETATTR@/s%%1%" -e "s%@cf_cv_enable_reentrant@%0%g" awk -f MKterm.h.awk /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/Caps > term.h.new sh /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/edit_cfg.sh /usr/src/lib/ncurses/ncurses/ncurses_cfg.h term.h.new ** edit: HAVE_TCGETATTR 1 ** edit: HAVE_TERMIOS_H 1 ** edit: HAVE_TERMIO_H 0 ** edit: BROKEN_LINKER 0 mv -f term.h.new term.h sed </usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/termcap.h.in >termcap.h -e "/@NCURSES_MAJOR@/s%%5%" -e "/@NCURSES_MINOR@/s%%7%" -e "/@NCURSES_CONST@/s%%const%" -e "/@NCURSES_OSPEED@/s%%short%" sed </usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include/unctrl.h.in >unctrl.h -e "/@NCURSES_MAJOR@/s%%5%" -e "/@NCURSES_MINOR@/s%%7%" cc -o make_keys -O2 -pipe -I. -I/usr/obj-sparc64/usr/src/lib/ncurses/ncurses/../ncurses -I/usr/src/lib/ncurses/ncurses/../ncurses -I/usr/src/lib/ncurses/ncurses/../ncurses -I/usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/include -I/usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses -Wall -DNDEBUG -DHAVE_CONFIG_H -DFREEBSD_NATIVE -DTERMIOS -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign /usr/src/lib/ncurses/ncurses/../../../contrib/ncurses/ncurses/tinfo/make_keys.c ./make_keys keys.list > init_keytry.h ./make_keys: Exec format error *** Error code 126 Stop. make[4]: stopped in /usr/src/lib/ncurses/ncurses *** Error code 1 Stop. make[3]: stopped in /usr/src *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src
Found answer about location of the variable MAKEOBJDIRPREFIX. So, the bug is really in wiki.freebsd.org, here: https://wiki.freebsd.org/A_Brief_Guide_To_Cross_Compiling_FreeBSD