openctp-ctp-python icon indicating copy to clipboard operation
openctp-ctp-python copied to clipboard

docker python3.8 手动配置腾讯行情so和6.6.1,运行报错:缺少`GLIBCXX_3.4.29'

Open congcong009 opened this issue 5 months ago • 5 comments

在我的理解中,如果要运行腾讯行情,只能采取手动安装的模式。

代码部分

所以为了在docker里运行一个基于腾讯行情的采集服务,现手动安装6.6.1的ctp-python文件(路径)至目录openctp/linux,在同目录里导入ctp项目中的qq行情thostmduserapi_se.so库文件([路径])。

代码中,调用方式如下:

from openctp.linux.thostmduserapi import CThostFtdcDepthMarketDataField, CThostFtdcMdSpi, CThostFtdcReqUserLoginField, CThostFtdcSpecificInstrumentField, CThostFtdcRspInfoField, CThostFtdcRspUserLoginField, CThostFtdcMdApi

运行报错:

File "/openctp/linux/thostmduserapi.py", line 46, in <module>
   from . import _thostmduserapi
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /openctp/linux/_thostmduserapi.so)

容器排查

基础镜像采用的是基于 Debian 10(buster) 版本的 python:3.8.16-slim-buster

查看系统中 GLIBCXX 的版本

root@26cb220c5c97:~# strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_DEBUG_MESSAGE_LENGTH

确实没有该文件。

尝试安装

apt-get update
apt-get install gcc-4.9
apt-get upgrade libstdc++6
apt-get dist-upgrade

然后并没有成功。请问有什么办法来修复这个问题呢?我看到有类似的 issue,但我认为 pip 安装并不能解决使用行情服务的问题,请指导下面应该怎么办呢?

congcong009 avatar Sep 05 '24 06:09 congcong009