Strongswan fails to build for ipq40xx

Hello everyone,

I have to build OpenWRT for my router because of a relatively new patch that fixes VLAN support for my device. I recently switched from OpenVPN to IPSec on my server and would like to build OpenWRT with strongswan-ipsec installed.

My problem is that the build fails with the following error(s):

Build Errors: make -j1 V=s
...

make[3]: Entering directory '/home/colin/Documents/code/openwrt/feeds/packages/net/strongswan'
mkdir -p /home/colin/Documents/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/root-ipq40xx/stamp
SHELL= flock /home/colin/Documents/code/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/.pkgdir/strongswan/. /home/colin/Documents/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/root-ipq40xx/'
touch /home/colin/Documents/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/root-ipq40xx/stamp/.strongswan_installed
mkdir -p /home/colin/Documents/code/openwrt/bin/targets/ipq40xx/generic/packages /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/CONTROL /home/colin/Documents/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/pkginfo
install -d -m0755 /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/etc/ /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/usr/sbin
install -m0600 /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-install/etc/ipsec.conf /home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/etc/
install: cannot stat '/home/colin/Documents/code/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-install/etc/ipsec.conf': No such file or directory
make[3]: *** [Makefile:669: /home/colin/Documents/code/openwrt/bin/packages/arm_cortex-a7_neon-vfpv4/packages/strongswan-ipsec_5.9.7-8.1_arm_cortex-a7_neon-vfpv4.ipk] Error 1
make[3]: Leaving directory '/home/colin/Documents/code/openwrt/feeds/packages/net/strongswan'
time: package/feeds/packages/strongswan/compile#0.40#0.22#0.54
    ERROR: package/feeds/packages/strongswan failed to build.
make[2]: *** [package/Makefile:116: package/feeds/packages/strongswan/compile] Error 1
make[2]: Leaving directory '/home/colin/Documents/code/openwrt'
make[1]: *** [package/Makefile:110: /home/colin/Documents/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/colin/Documents/code/openwrt'
make: *** [/home/colin/Documents/code/openwrt/include/toplevel.mk:231: world] Error 2

I am using the following strongswan modules:

cat .config | grep ^CONFIG_PACKAGE_strongswan
CONFIG_PACKAGE_strongswan=y
CONFIG_PACKAGE_strongswan-charon=y
CONFIG_PACKAGE_strongswan-charon-cmd=y
CONFIG_PACKAGE_strongswan-ipsec=y
CONFIG_PACKAGE_strongswan-libtls=y
CONFIG_PACKAGE_strongswan-mod-aes=y
CONFIG_PACKAGE_strongswan-mod-curve25519=y
CONFIG_PACKAGE_strongswan-mod-des=y
CONFIG_PACKAGE_strongswan-mod-eap-identity=y
CONFIG_PACKAGE_strongswan-mod-eap-md5=y
CONFIG_PACKAGE_strongswan-mod-eap-mschapv2=y
CONFIG_PACKAGE_strongswan-mod-eap-tls=y
CONFIG_PACKAGE_strongswan-mod-kernel-libipsec=y
CONFIG_PACKAGE_strongswan-mod-led=y
CONFIG_PACKAGE_strongswan-mod-md4=y
CONFIG_PACKAGE_strongswan-mod-pem=y
CONFIG_PACKAGE_strongswan-mod-pkcs1=y
CONFIG_PACKAGE_strongswan-mod-pkcs11=y
CONFIG_PACKAGE_strongswan-mod-pkcs12=y
CONFIG_PACKAGE_strongswan-mod-pkcs7=y
CONFIG_PACKAGE_strongswan-mod-pkcs8=y
CONFIG_PACKAGE_strongswan-mod-pubkey=y
CONFIG_PACKAGE_strongswan-mod-sha1=y
CONFIG_PACKAGE_strongswan-mod-sha2=y
CONFIG_PACKAGE_strongswan-mod-uci=y
CONFIG_PACKAGE_strongswan-mod-unity=y
CONFIG_PACKAGE_strongswan-mod-vici=y
CONFIG_PACKAGE_strongswan-swanctl=y

Without any strongswan modules, the firmware builds without any issues.
Help is very much appreciated as I am not very familiar with building OpenWRT.

The branch I am running make on is [1cefb14230] archs38: switch to 5.15 by default (output of git show-branch --sha1-name)

Thank you in advance,
Colin

The error seems to be this one above.

:pencil: EDIT:
I was able to locate where in the Makefile the error was caused by relating the script with the error output:

feeds/packages/net/strongswan/Makefile
541| define Package/strongswan-ipsec/install
542| 	$(INSTALL_DIR) $(1)/etc/ $(1)/usr/sbin
#> install -d -m0755 ~openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/etc/ ~openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/usr/sbin
543| 	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/ipsec.conf $(1)/etc/
#> install -m0600 ~openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-install/etc/ipsec.conf ~openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-arm_cortex-a7_neon-vfpv4/strongswan-ipsec/etc/
#> install: cannot stat '~openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/strongswan-5.9.7/ipkg-install/etc/ipsec.conf': No such file or directory
544| 	echo -e "\ninclude /var/ipsec/ipsec.conf" >> $(1)/etc/ipsec.conf
545| 	$(INSTALL_CONF) ./files/ipsec.secrets $(1)/etc/
546| 	echo -e "\ninclude /var/ipsec/ipsec.secrets" >> $(1)/etc/ipsec.secrets
547| 	$(INSTALL_CONF) ./files/ipsec.user $(1)/etc/
548| 	$(INSTALL_DIR) $(1)/etc/init.d
549| 	$(INSTALL_BIN) ./files/ipsec.init $(1)/etc/init.d/ipsec
550| 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ipsec $(1)/usr/sbin/
551| endef

Related: Unable to build strongswan on 19.07.2