Cross-compile Strongswan on Openwrt SDK

Hello,

I am using openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64 for cross-compiling Strongswan.
I installed package Strongswan dependencies using:
scripts/feeds update
scripts/feeds install libgmp
scripts/feeds install strace
scripts/feeds install openSSL
scripts/feeds install libtool-bin
When I cross-compile strongswan it generated LDAP library not found.
I added openldap package and installed dependencies:
scripts/feeds install util-linux
scripts/feeds install db47
Also, I added to strongswan Makefile as a dependency
When I cross compile it I got lib lber error which is a library included in Openldap package.

/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/bin/../lib/gcc/x86_64-openwrt-linux-musl/7.5.0/../../../../x86_64-openwrt-linux-musl/bin/ar: `u' modifier ignored since `D' is the default (see `U')
/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/bin/../lib/gcc/x86_64-openwrt-linux-musl/7.5.0/../../../../x86_64-openwrt-linux-musl/bin/ar: creating liblutil.a
make[6]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58/libraries/liblutil'

Entering subdirectory liblber
make[6]: Entering directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58/libraries/liblber'
rm -f version.c
../../build/mkversion -v "2.4.58" liblber.la > version.c
/bin/sh ../../libtool --mode=compile x86_64-openwrt-linux-musl-gcc -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58:openldap-2.4.58 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -lpthread -DURANDOM_DEVICE="/dev/urandom" -I../../include -I../../include -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/usr/include -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/include -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/usr/include -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include/fortify -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include -DLBER_LIBRARY -c assert.c
../../libtool: 1: eval: base_compile+= x86_64-openwrt-linux-musl-gcc: not found
../../libtool: 1: eval: base_compile+= -Os: not found
../../libtool: 1: eval: base_compile+= -pipe: not found
../../libtool: 1: eval: base_compile+= -fno-caller-saves: not found
../../libtool: 1: eval: base_compile+= -fno-plt: not found
../../libtool: 1: eval: base_compile+= -fhonour-copts: not found
../../libtool: 1: eval: base_compile+= -Wno-error=unused-but-set-variable: not found
../../libtool: 1: eval: base_compile+= -Wno-error=unused-result: not found
../../libtool: 1: eval: base_compile+= -iremap/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58:openldap-2.4.58: not found
../../libtool: 1: eval: base_compile+= -Wformat: not found
../../libtool: 1: eval: base_compile+= -Werror=format-security: not found
../../libtool: 1: eval: base_compile+= -fstack-protector: not found
../../libtool: 1: eval: base_compile+= -D_FORTIFY_SOURCE=1: not found
../../libtool: 1: eval: base_compile+= -Wl,-z,now: not found
../../libtool: 1: eval: base_compile+= -Wl,-z,relro: not found
../../libtool: 1: eval: base_compile+= -fpic: not found
../../libtool: 1: eval: base_compile+= -lpthread: not found
../../libtool: 1: eval: base_compile+= -DURANDOM_DEVICE="/dev/urandom": not found
../../libtool: 1: eval: base_compile+= -I../../include: not found
../../libtool: 1: eval: base_compile+= -I../../include: not found
../../libtool: 1: eval: base_compile+= -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/usr/include: not found
../../libtool: 1: eval: base_compile+= -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/include: not found
../../libtool: 1: eval: base_compile+= -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/usr/include: not found
../../libtool: 1: eval: base_compile+= -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include/fortify: not found
../../libtool: 1: eval: base_compile+= -I/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include: not found
../../libtool: 1: eval: base_compile+= -DLBER_LIBRARY: not found
../../libtool: 1: eval: base_compile+= -c: not found
OpenWrt-libtool: compile: you must specify a compilation command
OpenWrt-libtool: compile: Try `libtool --help --mode=compile' for more information. make[6]: *** [Makefile:381: assert.lo] Error 1 make[6]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58/libraries/liblber' make[5]: *** [Makefile:296: all-common] Error 1 make[5]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58/libraries' make[4]: *** [Makefile:312: all-common] Error 1 make[4]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58' make[3]: *** [Makefile:221: /home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/build_dir/target-x86_64_musl/openldap-2.4.58/.built] Error 2 make[3]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/package/openldap' time: package/openldap/compile#41.57#11.55#52.16 make[2]: *** [package/Makefile:113: package/openldap/compile] Error 2 make[2]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64' make[1]: *** [package/Makefile:107: /home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64' make: *** [/home/hela/Documents/openwrt-sdk-19.07.7-x86-64_gcc-7.5.0_musl.Linux-x86_64/include/toplevel.mk:220: world] Error 2`

Any idea how to solve this issue please.

Thanks

strongswan is packaged for OpenWrt, there shouldn't be any need to build it externally.

Hello, thanks for your quick answer.
Actually I am working on strongswan and had to make changes on libcharon code. To make it work on openwrt, I had to cross-compile the modified package.