uwsgs loading shared libraries: libicui18n.so.58 异常处理

> 前景

  • 想使用 ningx + uwsgi + flask 搭建 python 应用环境
  • Python使用的是anaconda3(pyhton 3.7)
  • 依赖包安装完毕,但是执行 uwsgi 的时候出现如下异常

> 错误信息

(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~]# uwsgi
uwsgi: error while loading shared libraries: libicui18n.so.58: cannot open shared object file: No such file or directory

> 解决错误

查看 uwsgi所在地址,然后使用 LDD 查看缺少的包
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~]# which uwsgi
/root/anaconda3/envs/roots/bin/uwsgi
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~]# ldd /root/anaconda3/envs/roots/bin/uwsgi
linux-vdso.so.1 =>  (0x00007ffc14fc7000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff6b0347000)
    libm.so.6 => /lib64/libm.so.6 (0x00007ff6b0045000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007ff6afe40000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007ff6afbde000)
    libxml2.so.2 => /lib64/libxml2.so.2 (0x00007ff6af874000)
    libz.so.1 => /lib64/libz.so.1 (0x00007ff6af65d000)
    liblzma.so.5 => /lib64/liblzma.so.5 (0x00007ff6af437000)
    libicui18n.so.58 => not found
    libicuuc.so.58 => not found
    libicudata.so.58 => not found
    libutil.so.1 => /lib64/libutil.so.1 (0x00007ff6af233000)
    librt.so.1 => /lib64/librt.so.1 (0x00007ff6af02a000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007ff6aedf3000)
    libc.so.6 => /lib64/libc.so.6 (0x00007ff6aea30000)
    /lib64/ld-linux-x86-64.so.2 (0x00005634c289c000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007ff6ae82c000)

通过 LDD 发现 uwsgi 找不到三个包(具体就是 not found 的三个)

于是就把anaconda3/lib 下相应的包软链到/lib64下去(64bit 机器,如果时32bit 机器则软链到/lib下)
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~] ln -s /root/anaconda3/lib/libicui18n.so.58 /lib64/libicui18n.so.58
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~] ln -s /root/anaconda3/lib/libicuuc.so.58 /lib64/libicuuc.so.58
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~] ln -s /root/anaconda3/lib/libicudata.so.58 /lib64/libicudata.so.58

这样缺失的三个包补充了,那么在使用ldd 测试结果如下

(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# strings /usr/lib64/libstdc++.so.6|grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

确实没有CXXABI_1.3.8 、CXXABI_1.3.9 ,那么就把 anaconda3/lib 下的libstdc++.so.6移到/lib64下面, libstdc++.so.6就是libstdc++.so.6.0.24的软链(可以去/lib64下查看ll libstc),既然确实,那就把 anconda3/lib下的高版本 copy 过去,就行了*

(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# ll libstdc*
lrwxrwxrwx 1 root root      19 Jun 28 11:57 /lib64/libstdc++.so.6 
-rwxr-xr-x 1 root root  991616 Apr 24 22:24 /lib64/libstdc++.so.6.0.19
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib]# ll libstdc*
lrwxrwxrwx 1 root root      19 Apr  2 18:43 libstdc++.so 
lrwxrwxrwx 1 root root      19 Apr  2 18:43 libstdc++.so.6
-rwxrwxr-x 2 root root 9536208 Aug 17  2018 libstdc++.so.6.0.25
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib]# cp libstdc++.so.6.0.25 /lib64/
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# ll libstdc*
libstdc++.so.6       libstdc++.so.6.0.19  libstdc++.so.6.0.25  
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# rm -rf libstdc++.so.6
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# ln -s libstdc++.so.6.0.25 libstdc++.so.6
(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z lib64]# ldd /root/anaconda3/envs/roots/bin/uwsgi
	linux-vdso.so.1 =>  (0x00007ffc4f272000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f811eced000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f811e9eb000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f811e7e7000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f811e5d1000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f811e36f000)
	libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f811e16a000)
	libxml2.so.2 => /lib64/libxml2.so.2 (0x00007f811de00000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f811dbda000)
	libicui18n.so.58 => /lib64/libicui18n.so.58 (0x00007f811d765000)
	libicuuc.so.58 => /lib64/libicuuc.so.58 (0x00007f811d3b7000)
	libicudata.so.58 => /lib64/libicudata.so.58 (0x00007f811b8b7000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00007f811b6b4000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f811b4ac000)
	libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f811b275000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f811aea8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f811ef09000)
	libstdc++.so.6 => /lib64/./libstdc++.so.6 (0x00007f811efd3000)
	libgcc_s.so.1 => /lib64/./libgcc_s.so.1 (0x00007f811ac92000)
	libfreebl3.so => /lib64/libfreebl3.so (0x00007f811aa8f000)

这应该就成功了,可以测试一下

> 测试

(roots) [root@iZ2ze5lq5zpd6lctghc8x3Z ~]# uwsgi
*** Starting uWSGI 2.0.18 (64bit) on [Fri Jun 28 11:58:05 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-36) on 28 June 2019 03:13:50
os: Linux-3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019
nodename: iZ2ze5lq5zpd6lctghc8x3Z
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /root
detected binary path: /root/anaconda3/envs/roots/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7270
your memory page size is 4096 bytes
detected max file descriptor number: 65535
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
The -s/--socket option is missing and stdin is not a socket

这就说明成功了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值