Solved How to cross compile port in AMD64 for ARMV7?

To set those variables on tcsh:
setenv TARGET arm
setenv TARGET_ARCH armv6
pkg install autoconf automake libtool <<<< These packages are needed to build barnyard2 <<<<
cd /usr/src
make -j3 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} toolchain

make -j3 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} buildenv

Entering world for armv6:arm
cd /usr/ports/security/barnyard2
make

With those instruction I was able to build (without qemu emulation) for armv7 :)

Code:
% file work/stage/usr/local/bin/entr
work/stage/usr/local/bin/entr: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.1, FreeBSD-style, stripped

But I cannot build programs which need m4, eg sysutils/htop or security/barnyard2:
Code:
...
checking for gcc... cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... Unable to load interpreter
configure: error: in `/usr/ports/sysutils/htop/work/htop-2.2.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
===>  Script "configure" failed unexpectedly.

config.log
Code:
...
configure:3325: checking for C compiler version
configure:3334: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin --version >&5
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: armv7-unknown-freebsd12.1-gnueabihf
Thread model: posix
InstalledDir: /usr/bin
configure:3345: $? = 0
configure:3334: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -v >&5
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: armv7-unknown-freebsd12.1-gnueabihf
Thread model: posix
InstalledDir: /usr/bin
configure:3345: $? = 0
configure:3334: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -V >&5
cc: error: argument to '-V' is missing (expected 1 value)
cc: error: no input files
configure:3345: $? = 1
configure:3334: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -qversion >&5
cc: error: unknown argument '-qversion', did you mean '--version'?
cc: error: no input files
configure:3345: $? = 1
configure:3365: checking whether the C compiler works
configure:3387: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -O -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -fstack-protector-strong  conftest.c -L/usr/local/lib >&5
configure:3439: result: yes
configure:3442: checking for C compiler default output file name
configure:3444: result: a.out
configure:3450: checking for suffix of executables
configure:3457: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -o conftest -O -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -fstack-protector-strong  conftest.c -L/usr/local/lib >&5
configure:3483: result: 
configure:3513: cc -target armv7-gnueabihf-freebsd12.1 --sysroot=/usr/obj/usr/src/arm.armv7/tmp -B/usr/obj/usr/src/arm.armv7/tmp/usr/bin -o conftest -O -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -fstack-protector-strong  conftest.c -L/usr/local/lib >&5
configure:3517: $? = 0
configure:3524: ./conftest
configure:3528: $? = 255
configure:3535: error: in `/usr/ports/sysutils/htop/work/htop-2.2.0':
configure:3539: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
...
All required packages (m4 included) are installed on host.

I can build it with QEMU jail but that is 4x slower than native build on ARM board (110 seconds vs around 25).

How ports from FreeBSD.org for armv7 are built?
 
Back
Top