使用boost build构建python扩展

时间:2012-10-28 23:16:43

标签: c++ python boost-python boost-build

我尝试使用boost.python并从c ++构建python扩展。

我的cpp文件使用名为' BZ2_bzopen'的函数。这是在图书馆' libbz2'在标准路径下(/ usr / lib /)。但是,当我尝试使用the instruction之后的boost版本构建扩展时,我收到一条错误:

====== BEGIN OUTPUT ======
Traceback (most recent call last):
  File "CrossTrade.py", line 11, in <module>
    from custom_c import GoThroughFile
ImportError: /home/jliu/toolpak/custom_c.so: undefined symbol: BZ2_bzopen

EXIT STATUS: 1
====== END OUTPUT ======

在我看来,这是因为没有链接到库的错误,这几乎与我编译cpp文件时没有&#39; -lbz2&#39;命令。

有人可以提供解决方案吗?

1 个答案:

答案 0 :(得分:0)

也许你没有链接到libbz2?在这种情况下,请按照http://www.boost.org/doc/libs/1_46_1/doc/html/bbv2/tutorial.html#bbv2.tutorial.prebuilt中的说明查看如何链接到库。