Cannot build for mediatek-mt7622

Hi!

I have some troubles building for mediatek-mt7622 platform.

First of all, I need to say that I have successfully built firmwares for various routers from most of the platforms:
bcm47xx-mips74k-*
bcm53xx-generic-*
ramips-mt7620-*
ramips-mt7621-*
ramips-mt76x8-*
mediatek-filogic-*
ath79-generic-*
ipq40xx-generic-*
qualcommax-ipq807x-*
sunxi-cortexa7-*
sunxi-cortexa53-*
rockchip-armv8-*
ramips-rt3883-*

But ONE platform gives me errors.
When I try to build whatever router from mediatek-mt7622, for example:
mediatek-mt7622-xiaomi_redmi-router-ax6s
or
mediatek-mt7622-bananapi_bpi-r64

It gives me this:

	/usr/bin/ld: /usr/lib/libcrypto.a(sha256-x86_64.o):fake:(.text+0x4d11): undefined reference to `__imp_RtlVirtualUnwind'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x20): undefined reference to `__mingw_vsscanf'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xa02): undefined reference to `__imp_GetCurrentThreadId'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xa93): undefined reference to `__imp_GetCurrentThreadId'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xbe4): undefined reference to `__imp_GetModuleHandleW'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xc00): undefined reference to `__imp_GetProcAddress'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xc22): undefined reference to `__imp_GetProcessWindowStation'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xc49): undefined reference to `__imp_GetUserObjectInformationW'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xc5c): undefined reference to `__imp_GetLastError'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xc93): undefined reference to `___chkstk_ms'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xd36): undefined reference to `__imp_GetStdHandle'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xd47): undefined reference to `__imp_GetFileType'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xd9e): undefined reference to `___chkstk_ms'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xdbf): undefined reference to `__imp_MultiByteToWideChar'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0xffc): undefined reference to `__imp__vsnwprintf'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x100b): undefined reference to `__imp_GetVersion'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x1030): undefined reference to `__imp_MessageBoxW'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x1063): undefined reference to `__imp_RegisterEventSourceW'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x10ae): undefined reference to `__imp_ReportEventW'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x10b7): undefined reference to `__imp_DeregisterEventSource'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x1114): undefined reference to `__imp__vsnprintf'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x1139): undefined reference to `__imp_WriteFile'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x117a): undefined reference to `__imp_MultiByteToWideChar'
	/usr/bin/ld: /usr/lib/libcrypto.a(cryptlib.o):cryptlib.c:(.text+0x13b8): undefined reference to `__imp___acrt_iob_func'
	/usr/bin/ld: /usr/lib/libcrypto.a(mem_dbg.o):mem_dbg.c:(.text+0x4a3): undefined reference to `__imp__localtime64'
	/usr/bin/ld: /usr/lib/libcrypto.a(mem_dbg.o):mem_dbg.c:(.text+0x1099): undefined reference to `__imp__time64'
	/usr/bin/ld: /usr/lib/libcrypto.a(obj_dat.o):obj_dat.c:(.text+0x1413): undefined reference to `__imp_isalnum'
	/usr/bin/ld: /usr/lib/libcrypto.a(obj_dat.o):obj_dat.c:(.text+0x141f): undefined reference to `__imp_isspace'
	/usr/bin/ld: /usr/lib/libcrypto.a(bn_print.o):bn_print.c:(.text+0x61d): undefined reference to `__imp_isxdigit'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0xa0): undefined reference to `__imp_MultiByteToWideChar'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0xcc): undefined reference to `___chkstk_ms'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x173): undefined reference to `__imp_GetLastError'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x1b4): undefined reference to `__imp__wfopen'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x1c0): undefined reference to `__imp__errno'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x2d3): undefined reference to `__imp_GetLastError'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x5c6): undefined reference to `__imp__fileno'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x5dd): undefined reference to `__imp__setmode'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x6ff): undefined reference to `__imp__setmode'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x742): undefined reference to `__imp_GetLastError'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x8ba): undefined reference to `__imp_GetLastError'
	/usr/bin/ld: /usr/lib/libcrypto.a(bss_file.o):bss_file.c:(.text+0x90e): undefined reference to `__imp__errno'
	/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.38 assertion fail ../../bfd/reloc.c:8580
	/usr/lib/libcrypto.a(sha256-x86_64.o):fake:(.xdata+0x4): dangerous relocation: collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped

Any ideas?
Building latest snapshot on Ubuntu 22.04

On what host operating system?

Ubuntu-2204-jammy-amd64-base

Clean the build tree, and check if all software requirements are installed as packages..

Tanks for your advice
I ran

sudo apt update
sudo apt install build-essential clang flex bison g++ gawk \
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \
python3-distutils python3-setuptools rsync swig unzip zlib1g-dev file wget

as per https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntumint

The output was uneventful

bison is already the newest version (2:3.8.2+dfsg-1build1).
build-essential is already the newest version (12.9ubuntu3).
flex is already the newest version (2.6.4-8build2).
g++ is already the newest version (4:11.2.0-1ubuntu1).
g++-multilib is already the newest version (4:11.2.0-1ubuntu1).
gcc-multilib is already the newest version (4:11.2.0-1ubuntu1).
gettext is already the newest version (0.21-4ubuntu4).
clang is already the newest version (1:14.0-55~exp2).
swig is already the newest version (4.0.2-1ubuntu1).
file is already the newest version (1:5.41-3ubuntu0.1).
gawk is already the newest version (1:5.1.0-1ubuntu0.1).
git is already the newest version (1:2.34.1-1ubuntu1.11).
libncurses-dev is already the newest version (6.3-2ubuntu0.1).
libncurses-dev set to manually installed.
libssl-dev is already the newest version (3.0.2-0ubuntu1.18).
python3-distutils is already the newest version (3.10.8-1~22.04).
python3-distutils set to manually installed.
python3-setuptools is already the newest version (59.6.0-1.2ubuntu0.22.04.2).
rsync is already the newest version (3.2.7-0ubuntu0.22.04.2).
unzip is already the newest version (6.0-26ubuntu3.2).
wget is already the newest version (1.21.2-2ubuntu1.1).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu9.2).

Then I ran make clean and tried to build again. Got the same error.

Here's last 5k lines of the logs if that helps... https://paste.ee/r/LXcF5/0

You need libcrypto -dev package and so on

In Ubuntu 22.04, the development package for libcrypto is named libssl-dev.
I have it installed:

libssl-dev is already the newest version (3.0.2-0ubuntu1.18).

Where can I find the list of "so on" if you suggest there is something besides what is listed in https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntumint ?

Verify your installation integrity, in one case you get mingw symbols, in other very basic system library absent when it is certainly in place. Things like preload, libpath etc.

I couldn't figure out what's wrong, so I ended up successfully building on another machine with Ubuntu 24.04.

You should report repeatable compiler crashes to ubuntu, though missing very common library hints corrupt system ie not repeatable.

I also feel it's probably latter, so no ubuntu fail here, more like the build script could have more checks in place. And before you say it's too basic things to check, look at OpenVPN makefile, they check for things like size_t or stdio.h, literally testing whether the compiler actually compiles during the ./configure stage to warn the user early if something isn't right. Yeah, I know, that's probably an exception and most projects don't do that, but I find it really cool the way they did it!

The cool way is that ubuntu compiler+linker is crashing while worked for millions of other installations just fine

1 Like

Let's keep it calm, I see no reason for attacking each other. Unless you have a real, non-ironic suggestion on fixing the problem, please don't bump the thread.

Thank you for confirming Ubuntu 22.04 has a bug.
Debian 11 and 12 work fine for me for compiling.