OpenWrt Build System on FreeBSD

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

# Install OpenWrt Build System

mkdir ~/OpenWrt-BuildSystem
cd ~/OpenWrt-BuildSystem
git clone
cd openwrt

# amend

sed -E -i "" -e "/^.getopt/a\\
        \/usr\/local\/bin\/getopt -o t --long test -- --test \| grep '\^ \*--test \*--', \\\\" include/

# 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/ scripts/config/mconf] Error 1
gmake[1]: Leaving directory '/root/OpenWrt-BuildSystem/openwrt'
*** Error code 2

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

Any pointers would be appreciated.

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).

I did manage to get things working last year with a previous release, but this is the first time I tried with the new release.

From what I can make out the error is triggered around this line in /include/ but this means nothing to me...

scripts/config/%onf: CFLAGS+= -O2                                                                                                                                                                   
scripts/config/%onf: FORCE                                                                                                                                                                          
        @$(_SINGLE)$(SUBMAKE) $(if $(findstring s,$(OPENWRT_VERBOSE)),,-s) \                                                                                                                        
                -C scripts/config $(notdir $@)

Not sure how to run 'make with -j1 V=s or V=sc'....

Do I just run 'make menuconfig -j1 V=s' or do I need to change anything?

make -j1 V=sc

Make your way backward through the output to find the failure.

Unfortunately I can't pinpoint the place where I need to run

make -j1 V=sc

Can I set this flag globally somewhere?

From your <buildroot> i.e. cd ~/openwrt ; make -j1 V=sc

1 Like

On further investigation, I get this error msg:-

gmake[4]: Entering directory '/root/OpenWrt-BuildSystem/openwrt/scripts/config'
; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/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?

Don't know if you can glean anything here. Unfortunately you seem to be in uncharted territory.

Edit. came across this:

Anyone know how the OpenWrt Build System tries to locate the ncurses package?

In your case it is not OpenWrt but Linux kconfig failing to locate ncurses. Try make -C scripts/config/ mconf

1 Like

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

I didn't have these sort of problems when trying to create this build system a year ago. Is there any way get hold of older versions of OpenWrt?

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.