head -r320458 (e.g.) amd64 -> powerpc64 cross build's install32 during installworld: /usr/src/share/mk/bsd.linker.mk tried to use "head" when PATH provided no access (head is missing)

Mark Millard markmi at dsl-only.net
Thu Jun 29 22:33:35 UTC 2017


[This is a clang targetting powerpc64 context from my
experimentation efforts, not the normal gcc 4.2.1 context
for powerpc64.]

I break out the PATH into lines below to make it easier to scan.
See the later "sh: head: not found" line and the even later ls
of the directory with the x86-64 program directory in use: no
"head" is present to find.

--- install32 ---
cd /usr/src/lib; MACHINE=powerpc MACHINE_ARCH=powerpc MAKEOBJDIRPREFIX=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/world32
PATH=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/usr/sbin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/usr/bin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/bin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/usr/sbin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/usr/bin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/usr/sbin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/usr/bin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/legacy/bin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/usr/sbin
:/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp/usr/bin
:/tmp/install.7ljKosWa
SYSROOT=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32 LIBDIR=/usr/lib32 SHLIBDIR=/usr/lib32 DTRACE="dtrace" make LD="/usr/local/powerpc64-freebsd/bin/ld -m elf32ppc_fbsd" OBJCOPY="/usr/local/powerpc64-freebsd/bin/objcopy" NM="/usr/local/powerpc64-freebsd/bin/nm" -DCOMPAT_32BIT CC="cc -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -DCOMPAT_32BIT -mcpu=powerpc -m32  -L/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32  --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32  -B/usr/local/powerpc64-freebsd/bin/ -B/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32" CXX="c++  -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/  -DCOMPAT_32BIT -mcpu=powerpc -m32  -L/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32  --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32  -B/usr/local/powerpc64-freebsd/bin/ -B/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32" CPP="cpp -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -DCOMPAT_32BIT -mcpu=powerpc -m32  -L/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32  --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32  -B/usr/local/powerpc64-freebsd/bin/ -B/usr/obj/powerpc64vtsc_clang_altbinutils/powerpc.powerpc64/usr/src/lib32/usr/lib32" -DNO_CPU_CFLAGS MK_CTF=no -DNO_LINT MK_TESTS=no MK_MAN=no MK_HTML=no  MK_TOOLCHAIN=no   -DLIBRARIES_ONLY install
sh: head: not found
make[4]: "/usr/src/share/mk/bsd.linker.mk" line 47: Unable to determine linker type from XLD=/usr/local/powerpc64-freebsd/bin/ld
*** [install32] Error code 1

# ls -lT /tmp/install.7ljKosWa/
total 6151
-r-xr-xr-x    1 root  wheel    12592 Jun 29 14:02:46 2017 [
-r-xr-xr-x    1 root  wheel   207320 Jun 29 14:02:46 2017 awk
-r-xr-xr-x    1 root  wheel     8456 Jun 29 14:02:46 2017 cap_mkdb
-r-xr-xr-x    1 root  wheel    13272 Jun 29 14:02:46 2017 cat
. . .
-r-xr-xr-x    1 root  wheel    57632 Jun 29 14:02:46 2017 find
-r-xr-xr-x    1 root  wheel    99064 Jun 29 14:02:46 2017 grep
-r-xr-xr-x    1 root  wheel    13360 Jun 29 14:02:46 2017 id
. . .

So there is no "head" to find. Below uses "find" instead
to confirm the x86-64 ELF status:

# file /tmp/install.7ljKosWa/find
/tmp/install.7ljKosWa/find: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0 (1200036), FreeBSD-style, stripped



From /usr/src/share/mk/bsd.linker.mk :

.if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
.if !defined(${X_}LINKER_TYPE) || !defined(${X_}LINKER_VERSION)
_ld_version!=   ${${ld}} --version 2>/dev/null | head -n 1 || echo none
.if ${_ld_version} == "none"
.error Unable to determine linker type from ${ld}=${${ld}}
.endif


Trying the failing line interactively (no PATH
like above though):

# /usr/local/powerpc64-freebsd/bin/ld --version 2>/dev/null | head -n 1 || echo none
GNU ld (GNU Binutils) 2.28

So /tmp/install.7ljKosWa/ just needed a copy of head
in addition to what it already had.


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



More information about the freebsd-ppc mailing list