Unable to build OpenWrt with Ubuntu 20.04/21.04

Description

When trying to build OpenWrt with linux4sam-2020.10 tag, it fails to complete the build on an Ubuntu 20.04/21.04 machine.

Additional information

Info: Building on Ubuntu 18.04 works well.

The build machine pre-requisites are followed as specified in OpenWrt building page.

Info: libssl1.0-dev doesn't exists anymore on Ubuntu 20.04/21.04, replaced by libssl-dev package which is a 1.1 version.

Build log with make -j1 V=s:

echo '# CONFIG_INITRAMFS_FORCE is not set' >> /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.set
rm -rf /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/modules
cmp -s /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.set /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.prev || { cp /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.set /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config; cp /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.set /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.prev; }
export MAKEFLAGS= ; [ -d /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/user_headers ] || make -C /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10 HOSTCFLAGS="-O2 -I/data/test/openwrt-at91/staging_dir/host/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="arm-openwrt-linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="" KBUILD_BUILD_HOST="" KBUILD_BUILD_TIMESTAMP="Thu Feb 27 21:05:12 2020" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/data/test/openwrt-at91/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  cmd_syscalls= CC="arm-openwrt-linux-gnueabi-gcc" INSTALL_HDR_PATH=/data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/user_headers headers_install
grep '=[ym]' /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.config.set | LC_ALL=C sort | mkhash md5 > /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.vermagic
touch /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.configured
rm -f /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/vmlinux /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/System.map
make -C /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10 HOSTCFLAGS="-O2 -I/data/test/openwrt-at91/staging_dir/host/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="arm-openwrt-linux-gnueabi-" ARCH="arm" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="" KBUILD_BUILD_HOST="" KBUILD_BUILD_TIMESTAMP="Thu Feb 27 21:05:12 2020" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/data/test/openwrt-at91/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  cmd_syscalls= CC="arm-openwrt-linux-gnueabi-gcc" modules
make[5]: Entering directory '/data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10'
  HOSTCC  scripts/extract-cert
/usr/bin/ld: /data/test/openwrt-at91/tmp/ccSX9hmP.o: in function `main':
extract-cert.c:(.text.startup+0x22): undefined reference to `OPENSSL_add_all_algorithms_noconf'
/usr/bin/ld: extract-cert.c:(.text.startup+0x27): undefined reference to `ERR_load_crypto_strings'
collect2: error: ld returned 1 exit status
make[6]: *** [scripts/Makefile.host:107: scripts/extract-cert] Error 1
make[5]: *** [Makefile:1123: scripts] Error 2
make[5]: Leaving directory '/data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10'
make[4]: *** [Makefile:24: /data/test/openwrt-at91/build_dir/target-arm_cortex-a5_glibc_eabi/linux-at91_sama5/linux-github_com_linux4sam_linux_at91_git-linux4sam_2020_10/.modules] Error 2
make[4]: Leaving directory '/data/test/openwrt-at91/target/linux/at91'
make[3]: *** [Makefile:13: compile] Error 2
make[3]: Leaving directory '/data/test/openwrt-at91/target/linux'
time: target/linux/compile#1.03#0.39#1.78
make[2]: *** [target/Makefile:25: target/linux/compile] Error 2
make[2]: Leaving directory '/data/test/openwrt-at91'
make[1]: *** [target/Makefile:18: /data/test/openwrt-at91/staging_dir/target-arm_cortex-a5_glibc_eabi/stamp/.target_compile] Error 2
make[1]: Leaving directory '/data/test/openwrt-at91'
make: *** [/data/test/openwrt-at91/include/toplevel.mk:227 : world] Erreur 2

Work Around

Ubuntu 20.04

libssl provided by Ubuntu 20.04 doesn't fit with kernel necessities. The workaround for this is to install libssl1.0-dev as follows:
Edit /etc/apt/sources.list file and add the following line at the end:
deb http://security.ubuntu.com/ubuntu bionic-security main
Update:
sudo apt-get update
Install libssl1.0-dev:
$ sudo apt-get install libssl1.0-dev

Note You can install missing packages using yum install with Fedora or apt-get install with Ubuntu or Debian. These commands may require root privileges or being in a correct sudoers group.

Ubuntu 21.04

None found as of today.