我花了相当于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”文件: / p>
/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
答案 0 :(得分:3)
解: 问题是上面的前两个条目(符号链接)被破坏了。
首先,目标目录不正确:
/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
当我弄清楚第二个链接应该是什么时(如果有必要),或者如果我在实施的更正中遇到任何运行时错误,我将更新/编辑此帖子。
我希望这有助于某人。
诺尔
答案 1 :(得分:1)
在Ubuntu 13.04中遇到同样的问题。配置了python支持并使用默认目标(/ usr / local / ...)。在成功编译之后,通过以下步骤制定了类似的解决方案;
创建缺少的文件/符号链接;
cd / usr / local / lib
sudo ln -s libquickfix_python.so _quickfix.so
sudo ln -s _quickfix.so _quickfix.dylib
将现有符号链接更改/更新到新位置:
cd /usr/lib/python2.7/dist-packages /
sudo ln -s /usr/local/lib/_quickfix.so _quickfix.so
sudo ln -s /usr/local/lib/_quickfix.so _quickfix.dylib
添加新的库路径
export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH $ {LD_LIBRARY_PATH:+:} / usr / local / lib
答案 2 :(得分:1)
您不需要创建多个符号链接 - 您只需要删除错误的符号链接并为_quickfix.so创建一个新的符号链接,以便一切正常工作:
rm /usr/local/lib/python2.7/site-packages/_quickfix.dylib
rm /usr/local/lib/python2.7/site-packages/_quickfix.so
ln -s /usr/local/lib/libquickfix_python.dylib /usr/local/lib/python2.7/site-packages/_quickfix.so
这是在OS X上。对于Linux,您需要使用以下内容(因为dylib扩展名是OS X特定的)
ln -s /usr/local/lib/libquickfix_python.so /usr/local/lib/python2.7/site-packages/_quickfix.so