It looks like I've been trying to put together an OpenWrt Build System on FreeBSD for over four years, and have only just started looking at it again to see what state it is in....
My latest script which I run in a jail on FreeBSD consists of:-
pkg bootstrap -y
# Install required pkgs
cat <<EOF | xargs pkg install -y
git
rsync
bash
gmake
gtar
gcc
gawk
ncurses
findutils
diffutils
patch
wget
getopt
coreutils
EOF
# Install OpenWrt Build System
mkdir ~/OpenWrt-BuildSystem
cd ~/OpenWrt-BuildSystem
git clone https://github.com/openwrt/openwrt.git
cd openwrt
# amend prereq-build.mk
sed -E -i "" -e "/^.getopt/a\\
\/usr\/local\/bin\/getopt -o t --long test -- --test \| grep '\^ \*--test \*--', \\\\" include/prereq-build.mk
# Let's go!!!
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
Unfortunately I get these errors which I'm having problems debugging.
Installing package 'sipp' from telephony
Installing package 'siproxd' from telephony
Installing package 'sngrep' from telephony
Installing package 'yate' from telephony
gmake[1]: Entering directory '/root/OpenWrt-BuildSystem/openwrt'
make -s -C scripts/config mconf: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
gmake[1]: *** [/root/OpenWrt-BuildSystem/openwrt/include/toplevel.mk:106: scripts/config/mconf] Error 1
gmake[1]: Leaving directory '/root/OpenWrt-BuildSystem/openwrt'
*** Error code 2
Stop.
make: stopped in /root/OpenWrt-BuildSystem/openwrt
Script done, output file is OpenWrt_Build-System-install_2211281717.log
656.68 real 290.41 user 39.91 sys
Exactly that part should give you further hints about what exactly is failing.
In theory it should be easy to build OpenWrt on FreeBSD, after all you can build it successfully on MacOS/ x86_64.
In practice, way too few users actually try this, so it remains largely untested (and broken).
gmake[4]: Entering directory '/root/OpenWrt-BuildSystem/openwrt/scripts/config'
; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh mconf-cfg.sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true ' UPD mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
*
* Unable to find the ncurses package.
* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution).
*
* You may also need to install pkg-config to find the
* ncurses installed in a non-default location.
*
Any advice on which ncurses pkg I need to install?
Not sure if I've done things properly but this is what get:-
Script started, output file is OpenWrt_Build-System-install_2212012218.log
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 32: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 41: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 80: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 120: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 131: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 133: Invalid line type
make: "/root/OpenWrt-BuildSystem/openwrt/scripts/config/Makefile" line 138: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /root/OpenWrt-BuildSystem/openwrt/scripts/config
Script done, output file is OpenWrt_Build-System-install_2212012218.log
0.00 real 0.00 user 0.00 sys
You'll have to look up specifics, but i'm fairly sure having read recently, that running the build-system scripts as root might lead to some strange build errors (at least on Linux and WSL) because of permission issues.