earl86 发表于 2024-3-8 15:58:17

mysql shell 编译后 各种 xx.so 文件依赖问题

# ldd mysqlsh
      linux-vdso.so.1 =>(0x00007ffff7ffa000)
      libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffff7bbf000)
      libdl.so.2 => /lib64/libdl.so.2 (0x00007ffff79bb000)
      libssl.so.10 => /lib64/libssl.so.10 (0x00007ffff7749000)
      libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007ffff72e6000)
      libresolv.so.2 => /lib64/libresolv.so.2 (0x00007ffff70cc000)
      librt.so.1 => /lib64/librt.so.1 (0x00007ffff6ec4000)
      libprotobuf.so.30 => /opt/greatsql-shell-8.0.32-25-Linux-el7-glibc2.17-x86_64/bin/./../lib/mysqlsh/libprotobuf.so.30 (0x00007ffff6c01000)
      libssh.so.4 => /opt/greatsql-shell-8.0.32-25-Linux-el7-glibc2.17-x86_64/bin/./../lib/mysqlsh/libssh.so.4 (0x00007ffff7f44000)
      libutil.so.1 => /lib64/libutil.so.1 (0x00007ffff69fe000)
      libcurl.so.4 => /lib64/libcurl.so.4 (0x00007ffff6794000)
      libnode.so.93 => /lib64/libnode.so.93 (0x00007ffff360d000)
      libpython3.8.so.rh-python38-1.0 => /opt/greatsql-shell-8.0.32-25-Linux-el7-glibc2.17-x86_64/bin/./../lib/mysqlsh/libpython3.8.so.rh-python38-1.0 (0x00007ffff3251000)
      libm.so.6 => /lib64/libm.so.6 (0x00007ffff2f4f000)
      libantlr4-runtime.so.4.10 => /opt/greatsql-shell-8.0.32-25-Linux-el7-glibc2.17-x86_64/bin/./../lib/mysqlsh/libantlr4-runtime.so.4.10 (0x00007ffff7e16000)
      libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ffff2c47000)
      libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ffff2a31000)
      libc.so.6 => /lib64/libc.so.6 (0x00007ffff2663000)
      /lib64/ld-linux-x86-64.so.2 (0x00007ffff7ddb000)
      libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007ffff2416000)
      libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007ffff212d000)
      libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007ffff1f29000)
      libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007ffff1cf6000)
      libz.so.1 => /lib64/libz.so.1 (0x00007ffff1ae0000)
      libidn.so.11 => /lib64/libidn.so.11 (0x00007ffff18ad000)
      libssh2.so.1 => /lib64/libssh2.so.1 (0x00007ffff1680000)
      libssl3.so => /lib64/libssl3.so (0x00007ffff141b000)
      libsmime3.so => /lib64/libsmime3.so (0x00007ffff11f3000)
      libnss3.so => /lib64/libnss3.so (0x00007ffff0eb9000)
      libnssutil3.so => /lib64/libnssutil3.so (0x00007ffff0c88000)
      libplds4.so => /lib64/libplds4.so (0x00007ffff0a84000)
      libplc4.so => /lib64/libplc4.so (0x00007ffff087f000)
      libnspr4.so => /lib64/libnspr4.so (0x00007ffff0640000)
      liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007ffff0431000)
      libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00007ffff01dc000)
      libuv.so.1 => /lib64/libuv.so.1 (0x00007fffeffae000)
      libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007fffefda2000)
      libbrotlienc.so.1 => /lib64/libbrotlienc.so.1 (0x00007fffefb0f000)
      libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007fffef62a000)
      libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007fffef39a000)
      libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fffef163000)
      libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fffeef5e000)
      libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fffeed4e000)
      libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fffeeb4a000)
      libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fffee92d000)
      libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007fffee70c000)
      libfreebl3.so => /lib64/libfreebl3.so (0x00007fffee509000)
      libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fffee2e2000)
      libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fffee080000)

虚拟机内编译后 查看依赖如上,
程序本地的依赖目录里的文件如下:
<blockquote># pwd请教问题:
将程序 打包成tar文件后 拷贝到其他服务器执行,提示 缺少各种 so文件.
怎样 可以将这些so 在编译的时候 自动 的拷贝到 /opt/greatsql-shell-8.0.32-25-Linux-el7-glibc2.17-x86_64/lib/mysqlsh 程序自己的lib库里?








yejr 发表于 2024-3-8 17:37:25

一些系统层面共同的依赖库,像glibc这种好像没办法,只能依赖所在操作系统。

其他的一些依赖,例如 libprotobuf.so.30、libantlr4-runtime.so.4.10这种就可以放在自己的目录下,并通过patchelf修改。

可参考这篇文章中提到的patchelf做法:https://mp.weixin.qq.com/s/o7JDOaQl-xJI-Bod5Vu_1Q ,文中 "2.3 利用patchelf修改mysqlsh二进制文件" 这部分内容。
页: [1]
查看完整版本: mysql shell 编译后 各种 xx.so 文件依赖问题