【问题标题】:Errors building Boost.Python tutorial example on Windows在 Windows 上构建 Boost.Python 教程示例时出错
【发布时间】:2013-10-04 15:57:55
【问题描述】:

我正在尝试在 Windows 7、python 2.7.3 上设置 Boost.Python 1.54.0。我安装了 boost_1_54_0 并使用 Visual Studio 2010 构建了它。我可以构建并运行发行版中的快速入门和教程示例(我必须在 Jamroot 中添加一些 MSVC 库目录作为库路径要求,但这没关系)。但是当我将教程示例复制到不同的目录时,而不是在 boost dist 目录中,以使其更像一个真实的项目时,bjam 会出现构建错误。我将 Jamroot 中的 use-project boost 位置更改为 /local/boost_1_54_0/,这是 boost 想要自行安装的位置,并添加了一个简单的单行 boost-build.jam(基于我在网上找到的内容):

boost-build C:/local/boost_1_54_0/tools/build/v2 ;

但最终 bjam 给了我这个错误:

% bjam
notice: no Python configured in user-config.jam
notice: will use default configuration
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:262: in find-jamfile from module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory '/local/boost_1_54_0'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:280: in load-jamfile from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:64: in load from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:89: in load-used-projects from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:75: in load from module project
C:/local/boost_1_54_0/tools/build/v2/build\project.jam:145: in project.find from module project
C:/local/boost_1_54_0/tools/build/v2\build-system.jam:535: in load from module build-system
C:\local\boost_1_54_0\tools\build\v2/kernel\modules.jam:289: in import from module modules
C:\local\boost_1_54_0\tools\build\v2/kernel/bootstrap.jam:139: in boost-build from module
C:\tmp\tutorial\boost-build.jam:1: in module scope from module

我还需要补充什么,或者我做错了什么?

【问题讨论】:

    标签: python boost


    【解决方案1】:

    我最终为此放弃了 bjam,只使用了 SCons。一个简单的 SConstruct 就足够了:

    # SConstruct for building boost python tutorial example
    
    import os
    
    boost_python_lib = 'boost_python-vc100-gd-1_54'
    boost_top        = 'c:/boost'
    python_top       = 'c:/python27'
    
    env=Environment(TARGET_ARCH='x86',
                    CCFLAGS=['/MDd', '/DEBUG', '/EHsc'],
                    CPPPATH=[os.path.join(boost_top,'include/boost-1_54'),
                             os.path.join(python_top, 'include')],
                    LIBPATH=[os.path.join(boost_top, 'lib/i386'),
                             os.path.join(python_top, 'libs')])
    dll=env.SharedLibrary('hello_ext', 'hello.cpp',
                          LIBS=boost_python_lib)
    env.InstallAs('hello_ext.pyd', dll[0])
    # Copy the boost python lib into this dir so hello_ext will find it at runtime
    env.Install('.', os.path.join(boost_top, 'lib/i386', '%s.dll'%boost_python_lib))
    

    当然,您可以从中制作出真正的 SCons Tool,但这足以让我继续前进。希望对其他人有用。

    【讨论】:

      猜你喜欢
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多