I stumbled onto this issue a couple weeks ago with a client that runs our shared library in an AWS Lambda Function environment (using an Amazon Linux 2 base image). Amazon Linux 2 uses a libc version without the pthreads and dl library integration changes, so trying to use our shared library built on the most recent stable Ubuntu release (or Fedora) results in an error.
Amazon is working on a new version of Amazon Linux (2022) with updated glibc support, but it does not seem ready yet and who knows when our client will decide to move over to that base image instead of AL2.
To address the problem, I am currently building a container based on Ubuntu 20.04 that will add the necessary dependencies to build FPC and Lazarus via fpcupdeluxe, and use distrobox to use that as my dedicated Lazarus build environment.
Alan