3

我花了相当于 1/2 天的时间才弄清楚这一点,所以我想分享一下我遇到的 Quickfix Engine 编译问题和解决方案。

我没有从此处指向的“Quickfix Engine”帮助资源中得到回复:“ http://quickfixengine.org/help ”......因此我提供这个的另一个原因。

环境:Fedora 18 -and- CentOS6 (64bit)。

在成功编译带有 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
4

3 回答 3

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

当我弄清楚第二个链接应该是什么时(如果有必要),或者如果我在实施的更正过程中遇到任何运行时错误,我将更新/编辑这篇文章。

我希望这可以帮助别人。

诺埃尔

于 2013-04-13T01:21:21.550 回答
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
于 2014-06-23T11:21:23.410 回答
1

在 Ubuntu 13.04 中遇到了同样的问题。配置了 python 支持并使用了默认目标 (/usr/local/...)。编译成功后,通过以下步骤制定了类似的解决方案;

  1. 创建丢失的文件/符号链接;

    cd /usr/local/lib

    sudo ln -s libquickfix_python.so _quickfix.so

    sudo ln -s _quickfix.so _quickfix.dylib

  2. 将现有符号链接更改/更新到新位置:

    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

  3. 添加新的库路径

    导出 LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}/usr/local/lib

于 2013-07-25T17:12:47.227 回答