tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cross-compiling packages



I'm trying to cross-compile some packages following the information given here [1].  The target machine [2] is an ebvmips/mips64eb machine and I am starting with pkgsrc-2020Q3; the build machine is NetBSD-9/amd64.

I have built the tools from a recent -current; in fact, I have built the entire release for the target system with them and have the whole thing running fine on the target machine.  The tools are named with mips64 prefixes.

I have bootstrapped pkgsrc unprivileged and have etc/mk.conf as in [3].

I have built the cross/cross-libtool-base package as suggested in [1] and installed it with pkg_add -m mips64.  That seems to work; i.e., it is installed in ${PREFIX}/cross-mips64.

However, when I try to build packages (i.e., cd category/pkg && bmake package) I get various compiler errors depending on the package.  For example, building pkgtools/pkg_install yields the following:

mips64--netbsd-gcc -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -DDEF_UMASK=0022 -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libfetch -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64 -DHAVE_NBCOMPAT_H=1 -I/path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat -I/usr/include -D__DBINTERFACE_PRIVATE -I. -I.  -O2 -D_FORTIFY_SOURCE=2 -I/usr/include -DHAVE_CONFIG_H -c snprintf.c
In file included from /path/to/src/obj/destdir.evbmips/usr/include/stdio.h:602,
                 from /path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat/nbcompat/stdio.h:40,
                 from /path/to/pkgsrc/pkgtools/pkg_install/work.mips64/libnbcompat/nbcompat.h:61,
                 from snprintf.c:28:
snprintf.c:43:1: error: expected declaration specifiers or '...' before numeric constant
   43 | snprintf(char *str, size_t size, const char *format, ...)
      | ^~~~~~~~

Building other packages yields the following:

ERROR: [depends.mk] Installed package digest-20190127 has an
ERROR:     object format ``ELF'' which differs from ``a.out''.  Please
ERROR:     update the digest-20190127 package to a.out.
*** Error code 1

The installed digest, which seems to have been installed as a dependency for cross-libtool-base is identified as the following by file:

digest: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 9.0, stripped

This is all new territory for me, so am not even sure what exactly to expect.  Am I following the correct path?  Is it possible for this to be successful?

Am I messing up the choice of machine architecture?  It looks like the error message in depends.mk comes from the choice of object format in config.guess.  However, with all the mips variants I am confused about what is correct here.

More generally, I am not even sure what is the most relevant information to share, so I would greatly appreciate guidance.

Thanks for any help you can offer.

Cheers,
Brook

[1] https://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/doc/HOWTO-use-crosscompile

[2] NetBSD octeon 9.99.74 NetBSD 9.99.74 (OCTEON) #0: Tue Nov  3 09:58:45 MST 2020  root%xxx.net@localhost:/path/to/src/sys/arch/evbmips/compile/obj/OCTEON evbmips

[3] Contents of etc/mk.conf created by bootstrap:

.ifdef BSD_PKG_MK       # begin pkgsrc settings                                                                                                                                                             

ABI=                    64

UNPRIVILEGED=           yes
PKG_DBDIR=              /path/to/usr/pkg-2020Q3/pkgdb
LOCALBASE=              /path/to/usr/pkg-2020Q3
VARBASE=                /path/to/usr/pkg-2020Q3/var
PKG_TOOLS_BIN=          /path/to/usr/pkg-2020Q3/sbin
PKGINFODIR=             info
PKGMANDIR=              man

USE_CROSS_COMPILE?=  yes

.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
MACHINE_ARCH=        mips64
TOOLDIR=             /path/to/src/obj/tooldir.NetBSD-9.0-amd64
CROSS_DESTDIR=       /path/to/src/obj/destdir.evbmips
PACKAGES=            ${PKGSRCDIR}/packages.${MACHINE_ARCH}
WRKDIR_BASENAME=     work.${MACHINE_ARCH}
USE_CWRAPPERS=       no
.endif

.endif                  # end pkgsrc settings                                    



Home | Main Index | Thread Index | Old Index