compile shared library that contains low-level static library

I have a tool that is compiled on Ubuntu 22.04, but this tool needs to run on a Centos 7 system. Ubuntu has a higher version of glibc and when running the compiled tool on Centos 7, it has error:

ImportError: /lib64/libm.so.6: version `GLIBC_2.27' not found

This error is from a shared library file that is needed in the tool. So I want to include the required low-level library into my tool. I do have libm.a file in the compile system and I want to merge it into the shared library.

I tried to merge it with command like:

  find_library(M_LIBRARY m REQUIRED)
  find_library(Z_LIBRARY z REQUIRED)
  target_link_options(onnx_cpp2py_export PRIVATE "-Wl,-Bstatic" "-lm" "-lc" "-lz")

and

target_link_libraries(onnx_proto PRIVATE "/usr/lib/x86_64-linux-gnu/libz.a"
                                         "/usr/lib/x86_64-linux-gnu/libm.a"
                                         "/usr/lib/x86_64-linux-gnu/libc.a"
                                         "-Wl,-fPIC")

and neither worked. I say it did not work based on the fact that onnx_cpp2py_export.so still repy on libm.so.6

root@75b3e00f1508:/static/build# ldd onnx_cpp2py_export.so
        linux-vdso.so.1 (0x00007ffeae184000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f68d55fd000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007f68d5516000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f68d54f6000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007f68d52cd000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f68d5fb9000)

What should I do here?