启动rocketmq-client-python测试遇到的问题解决方法记录

环境和方式

macOS MoJave

采取动态库方式

error1

➜  test git:(master) ✗ /usr/bin/python TestSendMessages.py
__________Python Version:___________
2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]
______Add Path /usr/local/lib_______
Traceback (most recent call last):
  File "TestSendMessages.py", line 19, in <module>
    from librocketmqclientpython import *
ImportError: dlopen(/usr/local/lib/librocketmqclientpython.so, 2): Library not loaded: libboost_python.dylib
  Referenced from: /usr/local/lib/librocketmqclientpython.so
  Reason: unsafe use of relative rpath libboost_python.dylib in /usr/local/lib/librocketmqclientpython.so with restricted binary

解决

install_name_tool -change librocketmq.dylib /usr/local/lib/librocketmq.dylib /usr/local/lib/librocketmqclientpython.so

参考

https://www.jianshu.com/p/bfa05ef3c482

error2

➜  test git:(master) ✗ /usr/bin/python TestSendMessages.py
__________Python Version:___________
2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]
______Add Path /usr/local/lib_______
Traceback (most recent call last):
  File "TestSendMessages.py", line 19, in <module>
    from librocketmqclientpython import *
ImportError: dlopen(/usr/local/lib/librocketmqclientpython.so, 2): Library not loaded: libboost_python.dylib
  Referenced from: /usr/local/lib/librocketmqclientpython.so
  Reason: unsafe use of relative rpath libboost_python.dylib in /usr/local/lib/librocketmqclientpython.so with restricted binary

解决

➜  test git:(master) ✗ install_name_tool -change libboost_python.dylib /usr/local/lib/libboost_python.dylib /usr/local/lib/librocketmqclientpython.so

参考

https://blog.csdn.net/robertsong2004/article/details/54911034

 

查看库依赖

➜  lib otool -L librocketmq.dylib
librocketmq.dylib:
    @rpath/librocketmq.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
➜  lib otool -L librocketmqclientpython.so
librocketmqclientpython.so:
    @rpath/librocketmqclientpython.so (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    @rpath/librocketmq.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FeelTouch Labs

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值