boost python无法创建扩展dll
boost python fails to create extension dll
我正在尝试编译boost python教程文件。发生的情况是,运行bjam时,我得到了在bin/msvc-11.0/debug目录中创建的以下文件:
hello.obj、hello.obj.rsp、hello_ext.exp、hello_ext.lib、hello_text.pdb、hello_ext.pyd、hello_text.pdb.manifest、hello_xt.pyd.rsp。
但是没有创建dll。如果我运行hello.py,我得到:
导入错误:DLL加载失败。找不到特定的模块。
为什么bjam不生成dll?
下面的文件来自我的一个项目,应该会给你一个想法。请注意,它试图找到要链接的Python的默认版本。也许有更好的方法可以做到这一点。如果有不清楚的地方,可以在评论中提问。使用此SConstruct构建的Boost Python模块称为genocpp
。如果您克隆,您应该能够构建它项目代码,假设您使用的是Linux。使用Windows会更加困难。
你也可以在网上找到这个文件https://bitbucket.org/faheem/snppy/src/tip/SConstruct?at=default作为SNPPy项目代码的一部分。
#!/usr/bin/python
import commands, glob, os
# Common file, for both executables and Python Interface
common_files = """geno print"""
def pyversion():
pystr = commands.getoutput('python -V')
version = pystr.split(' ')[1]
major, minor = version.split('.')[:2]
return major + '.' + minor
common_base = Split(common_files)
common = [f + ".cpp" for f in common_base]
common_obj = [f+".o" for f in common_base]
# For Python interface only
pif_conv = Split("cppvec_conv cppmap_conv cppset_conv cppunicode_conv")
pif_conv_files = [t+"_pif.cpp" for t in pif_conv]
pif = Split("geno")
pif_files = [t+"_pif.cpp" for t in pif]
# Boost Python Environment
boost_python_env = Environment(
#CXX="g++-4.4",
CPPPATH=["/usr/include/python"+pyversion(), "."],
CXXFLAGS='-ftemplate-depth-100 -fPIC -Wall -Werror -pedantic -pipe -O3 -ffast-math -march=opteron',
CPPDEFINES=['BOOST_PYTHON_DYNAMIC_LIB'],
LIBPATH=["/usr/lib/python"+pyversion()+"/config"],
LIBS=["python"+pyversion(), "m", "boost_python"],
SHLIBPREFIX="", #gets rid of lib prefix
SHOBJSUFFIX = ".bpo"
)
test_env = Environment(
#CXX="g++-4.4",
CXXFLAGS='-Wall -Werror -pedantic -O0 -g',
)
# Build boost python module
boost_python_env.SharedLibrary(target='genocpp', source = common + pif_conv_files + pif_files)
test_env.Program(target='geno_test', source = common + ["geno_test.cpp"])
相关文章:
- 挂起和取消挂起一个文件DLL
- 是否可以通过C++扩展强制多个python进程共享同一内存
- std::threads可以从Windows DLL中的全局变量创建/销毁吗?
- 导入库可以跨dll版本工作吗
- static_assert在宏中,但也可以扩展到可以用作函数参数的东西
- 复制C DLL以构建任何C#项目的输出,以扩展为参考
- dll 外壳扩展如何知道要执行的程序位置?
- 在 MFC 扩展 DLL 中使用 BCGControlBar
- MFC扩展dll资源加载问题
- boost python无法创建扩展dll
- 在 AIR 本机扩展中包含外部 DLL
- 外壳扩展:C/C++运行时DLL的静态链接与动态链接
- 在资源管理器左窗格上两次调用Windows 7外壳扩展dll Initialize方法
- 如何用多类创建MFC扩展dll
- 从DLL调用的C++方法返回Adobe Air本机扩展中以前调用的数据
- 外壳扩展DLL-如果用户在文件夹空白区域内单击,如何捕获文件夹路径
- 与开发SNMP扩展代理DLL相关
- 重新编译MFC扩展DLL会更改导出函数的入口点
- 在MFC中使用扩展dll时进行断言
- 如何建立一个Visual Studio 2010项目,为Slickedit 17构建64位扩展dll ?