如何使用Python支持(…“_quickfix”导入异常)使用quickfix(v1.13.3)更正编译/构建问题
作者:互联网
我花了相当于1/2天的时间来解决这个问题,所以我想分享我遇到的Quickfix Engine编译问题和解决方案.
我没有得到这里指向的“Quickfix Engine”帮助资源的回复:
“http://quickfixengine.org/help”…因此我提供这个的另一个原因.
环境:Fedora 18和CentOS6(64位).
在使用Python支持成功编译quickfix(即configure [opts]; make; make install)之后,我得到了以下python导入异常,指示找不到python模块“_quickfix”:
==============================================
user$python -c "import quickfix"
Traceback (most recent call last):
File " ", line 1, in
File "/home/user/APPS.d/ENTHOUGHT-PYTHON-IDE.d/x86_64.d/latest/lib/python2.7/site-packages/quickfix.py", line 7, in
import _quickfix
ImportError: No module named _quickfix
==============================================
问题似乎出现在“make install”调用的安装脚本中.
python解释器说“_quickfix”模块没有退出.从下面的“make install”安装的文件列表中可以看出,没有“_quickfix.py”文件,但是引用了“_quickfix.so”文件和“_quickfix.dylib”文件:
/home/user/.local/lib/python2.7/site-packages/_quickfix.dylib -> /home/user/APPS.d/QUICKFIX.d/latest/lib/python/_quickfix.dylib
/home/user/.local/lib/python2.7/site-packages/_quickfix.so -> /home/user/APPS.d/QUICKFIX.d/latest/lib/python/_quickfix.so
/home/user/.local/lib/python2.7/site-packages/quickfix40.py
/home/user/.local/lib/python2.7/site-packages/quickfix41.py
/home/user/.local/lib/python2.7/site-packages/quickfix42.py
/home/user/.local/lib/python2.7/site-packages/quickfix42.pyc
/home/user/.local/lib/python2.7/site-packages/quickfix43.py
/home/user/.local/lib/python2.7/site-packages/quickfix44.py
/home/user/.local/lib/python2.7/site-packages/quickfix50.py
/home/user/.local/lib/python2.7/site-packages/quickfix50sp1.py
/home/user/.local/lib/python2.7/site-packages/quickfix50sp2.py
/home/user/.local/lib/python2.7/site-packages/quickfix.py
/home/user/.local/lib/python2.7/site-packages/quickfix.pyc
/home/user/.local/lib/python2.7/site-packages/quickfixt11.py
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix.la
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix_python.la
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix_python.so.10.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix_python.so.10 -> libquickfix_python.so.10.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix_python.so -> libquickfix_python.so.10.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix.so.14.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix.so.14 -> libquickfix.so.14.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/libquickfix.so -> libquickfix.so.14.0.0
/home/user/APPS.d/QUICKFIX.d/latest/lib/pkgconfig/quickfix.pc
解决方法:
解:
问题是上面的前两个条目(符号链接)被破坏了.
首先,目标目录不正确:
/home/user/APPS.d/QUICKFIX.d/latest/lib/python/...
应该是:
/home/user/APPS.d/QUICKFIX.d/latest/lib/...
所以我们先解决这个问题:
user$cd /home/user/.local/lib/python2.7/site-packages
user$rm _quickfix.so _quickfix.dylib
user$ln -s /home/user/APPS.d/QUICKFIX.d/latest/lib/_quickfix.so _quickfix.so
user$ln -s /home/user/APPS.d/QUICKFIX.d/latest/lib/_quickfix.dylib _quickfix.dylib
接下来,在更正目标目录位置的情况下,符号链接仍然被破坏;这次是因为它们指向的那个(刚修正的)目标目录中的文件名不存在(即“_quickfix.so”和“_quickfix.dylib”不存在).
玩了一下后,我通过创建丢失的文件来完成工作:
user$cd /home/user/APPS.d/QUICKFIX.d/latest/lib
user$ln -s libquickfix_python.so _quickfix.so
user$ln -s <???> _quickfix.dylib # Actually I didn't create this one yet. It's not yet clear to me what it should point to. I Will update this post later.
–
Note: Because I compiled QuickFix so that it does not install to the traditional "/usr/local/" directory structure, I had to append my "LD_LIBRARY_PATH" to include: "/home/user/APPS.d/QUICKFIX.d/latest/lib"
通过最少的测试,事情似乎现在起作用(或者至少在正确的方向上):
user$python -c "import quickfix"; echo ${?}
0
user$python -c "import quickfix42"; echo ${?}
0
当我弄清楚第二个链接应该是什么时(如果有必要),或者如果我遇到任何与我实施的更正有关的运行时错误,我将更新/编辑这篇文章.
我希望这可以帮助别人.
诺埃尔
标签:python,compilation,quickfix 来源: https://codeday.me/bug/20190901/1780145.html