網(wǎng)站首頁 編程語言 正文
python使用ctypes調(diào)用第三方庫時出現(xiàn)undefined?symbol錯誤詳解_python
作者:liguiyuan112 ? 更新時間: 2023-05-22 編程語言今天在用python 調(diào)用c++庫文件時出現(xiàn)了一個錯誤,這里主要記錄一下解決問題的思路。
1.出現(xiàn)錯誤
在使用python 中使用中調(diào)用第三方so庫時
import ctypes
cpp = ctypes.CDLL('./detector.so')
出現(xiàn)如下錯誤:
Traceback (most recent call last):
File “detection.py”, line 143, in
face_detection(image_path)
File “detection.py”, line 52, in face_detection
cpp = ctypes.CDLL(’./detector.so’)
File “/usr/lib/python3.8/ctypes/init.py”, line 373, in init
self._handle = _dlopen(self._name, mode)
OSError: ./detector.so: undefined symbol: __powf_finite
這是由于未定義__powf_finite引起的。
2.分析步驟
(1)使用file命令檢查so庫的架構(gòu),看是否平臺一致
file detector.so
輸出:
detector.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=8ac2d2c5490394447e21cf383f1428d8ad70be7a, with debug_info, not stripped
發(fā)現(xiàn)平臺是沒有問題的。
(2)使用 ldd -r xxx.so 查看so庫鏈接狀態(tài)和錯誤信息
ldd -r detector.so
輸出如下:
確實(shí)存在 undefined symbol: __powf_finite (./detector.so) 等問題,
(3)使用c++filt 定位錯誤位置
使用以下命令來查找在c++代碼中的位置
c++filt __powf_finite
最后面發(fā)現(xiàn)是我c++代碼的問題,我在c++代碼中又引用了第三方庫.a文件,是.a文件的問題,這個文件是以前的老代碼生成的,自己重新編譯源碼生成新的 .a文件就可以解決了。
總結(jié)
原文鏈接:https://blog.csdn.net/u012505617/article/details/119248870
- 上一篇:沒有了
- 下一篇:沒有了
相關(guān)推薦
- 2022-07-14 Python?socket如何實(shí)現(xiàn)服務(wù)端和客戶端數(shù)據(jù)傳輸(TCP)_python
- 2022-04-11 python中pip安裝、升級以及升級固定的包_python
- 2022-03-19 .NET6使WebApi獲取訪問者IP地址_基礎(chǔ)應(yīng)用
- 2022-06-26 詳解Go語言中的作用域和變量隱藏_Golang
- 2022-09-08 pytorch中函數(shù)tensor.numpy()的數(shù)據(jù)類型解析_python
- 2022-05-09 Python實(shí)現(xiàn)連接FTP并下載文件夾_python
- 2023-03-22 gin正確多次讀取http?request?body內(nèi)容實(shí)現(xiàn)詳解_Golang
- 2022-07-09 Python?對數(shù)字的千分位處理方式_python
- 欄目分類
-
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支