tech-pkg archive

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

Cross-compiling pkgsrc



Is this the best reference for how to cross-compile pkgsrc?

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

To test this, I have tried to compile misc/screen on Darwin for ebvarm-earamv7hf.  The NetBSD tools, etc. are all built with build.sh and the release image works fine on the target arm machine.  

My mk.conf file has the following block, in addition to all the stuff I normally use for pkgsrc on Darwin:

.ifdef BSD_PKG_MK	# cross-compile setup

# see https://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/doc/HOWTO-use-crosscompile
#
# Cross-compile by default.
#
# XXX This currently can't be set to `yes' on the command line,
# which is a bug.
USE_CROSS_COMPILE?=  yes

# Point pkgsrc at the NetBSD tooldir and destdir.  These are used
# only for cross-builds.
#
# XXX There is no obvious variable that is set to amd64 so that we
# could use
#
#    TOOLDIR=        /usr/obj/tooldir.${OPSYS}-${OS_VERSION}-${NATIVE_xyz}
#
# MACHINE is amd64 but, since it's not NATIVE_xyz, it's wrong.
# NATIVE_MACHINE_ARCH is x86_64, not amd64.
TOOLDIR=             /Users/brook/NetBSD/NetBSD/evbarm-earmv7hf-beaglebone/tools
CROSS_DESTDIR=       /Users/brook/NetBSD/NetBSD/evbarm-earmv7hf-beaglebone/destdir

# Specify the machine architecture of target packages.
#
# XXX This currently can't be set on the command line, which is a
# bug.
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
MACHINE_ARCH=        evbarm
.endif

.if empty(USE_CROSS_COMPILE:M[yY][eE][sS])
ABI=    64 # set for native amd64 build
.else
ABI=    # empty for earmv7hf cross-build
.endif

.endif			# cross-compile setup

Part way through the build of screen dependencies I get the following error:

=> Full dependency pkg_install-info-[0-9]*: NOT found
=> Verifying package-install for ../../pkgtools/pkg_install-info
===> Installing dependencies for pkg_install-info-4.5nb3
=> Tool dependency mktools-[0-9]*: found mktools-20220614
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
===> Skipping vulnerability checks.
WARNING: No /Users/brook/NetBSD/NetBSD/evbarm-earmv7hf-beaglebone/destdir/Users/brook/Pkgsrc/pkg-2023Q2-evbarm/pkgdb/pkg-vulnerabilities file found.
WARNING: To fix run: `/Users/brook/Pkgsrc/pkg-2023Q2-evbarm/sbin/pkg_admin -K /Users/brook/NetBSD/NetBSD/evbarm-earmv7hf-beaglebone/destdir/Users/brook/Pkgsrc/pkg-2023Q2-evbarm/pkgdb fetch-pkg-vulnerabilities'.
===> Overriding tools for pkg_install-info-4.5nb3
===> Extracting for pkg_install-info-4.5nb3
===> Patching for pkg_install-info-4.5nb3
===> Creating toolchain wrappers for pkg_install-info-4.5nb3
ln: /Users/brook/Pkgsrc/pkgsrc-2023Q2/pkgtools/pkg_install-info/work.evbarm/.cwrapper/bin/clang++: File exists
*** Error code 1

At this point pkg_install-info has already been installed.

# pkg_info -e pkg_install-info
pkg_install-info-4.5nb3

From the WRKDIR it looks like this is supposed to be a cross-compiled version, whereas the installed one is perhaps not.

I also get this same error when building other packages; the first attempt to cross-compile (judging from WRKDIR) gives this.

I would greatly appreciate help understanding how this is supposed to work (if at all).

Thanks a lot.

Cheers,
Brook





Home | Main Index | Thread Index | Old Index