Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 下编译错误求助 #34

Open
ZhengHui-Z opened this issue Jan 10, 2025 · 0 comments
Open

Linux 下编译错误求助 #34

ZhengHui-Z opened this issue Jan 10, 2025 · 0 comments

Comments

@ZhengHui-Z
Copy link

ZhengHui-Z commented Jan 10, 2025

环境描述:Ubuntu22.04

python: 3.10

报错一:

/usr/bin/ld: cannot find -lthosttraderapi_se: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/_thosttraderapi.dir/build.make:98: _thosttraderapi.so] Error 1
make[2]: Leaving directory '/mnt/e/ctp/openctp-ctp-python/CTPAPI/build'
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/_thosttraderapi.dir/all] Error 2
make[1]: Leaving directory '/mnt/e/ctp/openctp-ctp-python/CTPAPI/build'
make: *** [Makefile:91: all] Error 2

排查原因是找不到 thosttraderapi_se.so

通过修改出 CMakeLists.txt 文件可以解决,

修改

target_link_libraries(${tdapi} thosttraderapi_se.so -lboost_locale -lboost_system)
target_link_libraries(${mdapi} thostmduserapi_se.so -lboost_locale -lboost_system)

target_link_libraries(${tdapi} -I${PROJECT_SOURCE_DIR}/linux/thosttraderapi_se.so -lboost_locale -lboost_system)
target_link_libraries(${mdapi} -I${PROJECT_SOURCE_DIR}/linux/thostmduserapi_se.so -lboost_locale -lboost_system)

但是产生了新的问题

编译后运行md_demo.py报如下错误:

Traceback (most recent call last):
  File "/mnt/e/ctp/openctp-ctp-python/CTPAPI/build/md_demo.py", line 12, in <module>
    import thostmduserapi as mdapi # manual mode
  File "/mnt/e/ctp/openctp-ctp-python/CTPAPI/build/thostmduserapi.py", line 48, in <module>
    import _thostmduserapi
ImportError: /mnt/e/ctp/openctp-ctp-python/CTPAPI/build/_thostmduserapi.so: undefined symbol: _ZN15CThostFtdcMdApi13GetApiVersionEv 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant