網站首頁 編程語言 正文
今天在用python 調用c++庫文件時出現了一個錯誤,這里主要記錄一下解決問題的思路。
1.出現錯誤
在使用python 中使用中調用第三方so庫時
import ctypes
cpp = ctypes.CDLL('./detector.so')
出現如下錯誤:
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庫的架構,看是否平臺一致
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
發現平臺是沒有問題的。
(2)使用 ldd -r xxx.so 查看so庫鏈接狀態和錯誤信息
ldd -r detector.so
輸出如下:
確實存在 undefined symbol: __powf_finite (./detector.so) 等問題,
(3)使用c++filt 定位錯誤位置
使用以下命令來查找在c++代碼中的位置
c++filt __powf_finite
最后面發現是我c++代碼的問題,我在c++代碼中又引用了第三方庫.a文件,是.a文件的問題,這個文件是以前的老代碼生成的,自己重新編譯源碼生成新的 .a文件就可以解決了。
總結
原文鏈接:https://blog.csdn.net/u012505617/article/details/119248870
- 上一篇:沒有了
- 下一篇:沒有了
相關推薦
- 2022-11-29 C#復制數組的兩種方式及效率比較_C#教程
- 2023-04-06 C#?Csv實現基本的讀寫和轉換DataTable_C#教程
- 2022-07-09 利用go語言實現查找二叉樹中的最大寬度_Golang
- 2021-12-16 .NET?Core配置TLS?Cipher(套件)的詳細過程_實用技巧
- 2022-03-25 C++實現希爾排序算法實例_C 語言
- 2021-11-02 Linux環境下生成openssl證書注意細節介紹_Linux
- 2022-07-25 SQL?Server系統函數介紹_MsSql
- 2022-03-16 Linux下安裝軟件包報依賴等相關問題的解決方法_Linux
- 欄目分類
-
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支