Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jan 2014 14:35:19 -0500
From:      Nathan Dorfman <na@rtfm.net>
To:        freebsd-mips@freebsd.org
Subject:   Couple of snags cross-installing after cross-compiling
Message-ID:  <CADgEyUuGxaydh%2BwiHR8Z%2BAS4AUAFDV%2B8CqC7xNVP1HeDKiBPdA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello all,

I have a small FreeBSD/mips machine (the EdgeRouter Lite), and I want to
cross-build world and kernel on my larger amd64 machine, then install the
result on the target system. I'm doing this by exporting via NFS from the b=
uild
machine, and it seems to be working well, just two small snafus along the w=
ay.
Hopefully this isn't considered crazy and unsupported, because it almost
works. :)

Note: this is releng/10 (r260251), not head.

The only trouble is that buildworld produces a toolchain for the host, not
target, machine in $WORLDTMP, which is first in the PATH for subsequent
commands. So, when installkernel is run on the mips64 target, it tries to
execute those amd64 binaries:

    --------------------------------------------------------------
    >>> Installing kernel ERL
    --------------------------------------------------------------
    cd /usr/obj/usr/src/sys/ERL; [...]
PATH=3D/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr=
/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/legacy/bin:=
/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src=
/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin
 make  KERNEL=3Dkernel install

    cc: Exec format error
    make[2]: "/usr/src/share/mk/bsd.compiler.mk" line 9: warning: "cc
--version" returned non-zero status
    [...]

If for some reason installworld is run first, it fails similarly. To get ar=
ound
this, all that's needed is rm -rf $WORLDTMP. The install proceeds using the
tools in /bin and /usr/bin. I also tried changing the definition of WORLDTM=
P in
Makefile.inc1 from just 'tmp' to 'tmp.$(MACHINE_ARCH)' before running the
buildworld, and that works to stop this error before it occurs.

This probably isn't right since I think I want to be running new, not
previously installed, binaries here. There's no cross-compiling of $WORLDTM=
P,
but can I just point it at the entire freshly built world, /usr/obj/usr/src=
,
instead? In any case, for the time being, with the wrong-arch $WORLDTMP not
there, installkernel succeeds and installworld proceeds to fail slightly la=
ter,
with this:

    =3D=3D=3D> lib/libc (install)
    install -C -o root -g wheel -m 444   libc.a /usr/lib
    install -C -o root -g wheel -m 444   libc_p.a /usr/lib
    install -s -o root -g wheel -m 444   -fschg -S  libc.so.7 /lib
    install: exec(strip): No such file or directory

Here, the default system path (/usr/bin, etc.) is not in the PATH; it consi=
sts
only of the various subdirs of $WORLDTMP, followed by one new directory
/tmp/install.3aqj2XwQ. I noticed that this path was only just created by a
preceding step, and easily fixed the error by adding strip to the list of
ITOOLS=3D in Makefile.inc1.

Here's what's confusing: why does that /tmp/install directory exist in the
first place? It's behind $WORLDTMP in the path, so under normal circumstanc=
es,
it wouldn't be used. I began to suspect that might be unintentional, but I
don't know much about the FreeBSD build system, so I'd like to ask someone =
who
does!

Anyway, after adding strip to ITOOLS, installworld also succeeds, and life =
is
good.

Thanks,
-nd.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADgEyUuGxaydh%2BwiHR8Z%2BAS4AUAFDV%2B8CqC7xNVP1HeDKiBPdA>