Compile Server 8.0 fails on Debian 11 (aarch64): various `ld.lld` errors

Hello.
Firstly, thank you for all your work on Percona Server, it is greatly appreciated!

I’m moving from an amd64 environment with Percona-built packages to an aarch64 environment with source compilation, at least until Percona-built packages are generally available.

I’m attempting to compile Percona Server 8.0 from source tarball on Debian 11 (aarch64), but failing. My CMake fails with Configuring incomplete, errors occurred!, and I’m combing through the CMakeFiles/CMakeOutput.log & CMakeFiles/CMakeError.log to find & address the snags.

My CMake command is run from a /src-build/ directory to avoid building in-source, and is as follows:

cmake .. \
-Wdev \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DWITH_BOOST=[path to boost]

There are multiple errors relating to ld.lld, for example:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/pete/percona-server-mysql-source/percona-server-Percona-Server-8.0.32-24/src-build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_c3d38/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_c3d38.dir/build.make CMakeFiles/cmTC_c3d38.dir/build
gmake[1]: Entering directory '/home/pete/percona-server-mysql-source/percona-server-Percona-Server-8.0.32-24/src-build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c3d38.dir/src.c.o
/usr/bin/cc   -fno-omit-frame-pointer -ffp-contract=off -ftls-model=initial-exec  -moutline-atomics -DCMAKE_HAVE_LIBC_PTHREAD -fPIE -o CMakeFiles/cmTC_c3d38.dir/src.c.o -c /home/pete/percona-server-mysql-source/percona-server-Percona-Server-8.0.32-24/src-build/CMakeFiles/CMake>
Linking C executable cmTC_c3d38
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c3d38.dir/link.txt --verbose=1
/usr/bin/cc -fno-omit-frame-pointer -ffp-contract=off -ftls-model=initial-exec  -moutline-atomics -DCMAKE_HAVE_LIBC_PTHREAD  -fuse-ld=lld  CMakeFiles/cmTC_c3d38.dir/src.c.o -o cmTC_c3d38
ld.lld: error: undefined symbol: pthread_create
>>> referenced by src.c
>>>               CMakeFiles/cmTC_c3d38.dir/src.c.o:(main)

ld.lld: error: undefined symbol: pthread_detach
>>> referenced by src.c
>>>               CMakeFiles/cmTC_c3d38.dir/src.c.o:(main)

ld.lld: error: undefined symbol: pthread_cancel
>>> referenced by src.c
>>>               CMakeFiles/cmTC_c3d38.dir/src.c.o:(main)

ld.lld: error: undefined symbol: pthread_join
>>> referenced by src.c
>>>               CMakeFiles/cmTC_c3d38.dir/src.c.o:(main)
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_c3d38.dir/build.make:106: cmTC_c3d38] Error 1
gmake[1]: Leaving directory '/home/pete/percona-server-mysql-source/percona-server-Percona-Server-8.0.32-24/src-build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_c3d38/fast] Error 2


Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

Other (potentially) useful stuff:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110

I’ll attach the CMakeFiles/CMakeOutput.log & CMakeFiles/CMakeError.log files as a reply.

Edit: this was a lie, I can’t upload files yet…so here’s the gist:

https://forums.percona.com/t/compile-server-8-0-fails-on-debian-11-aarch64-various-ld-lld-errors/22394 · GitHub

I’d really appreciate any advice on further reading or suggestions for getting past the ld.lld errors.

Thank you for reading, and best wishes.

Following up…
I didn’t resolve the errors, but I have successfully compiled from the git release branch. It’s versioned, which is perfect for internal change control, and compiles just fine (but not quickly).