Boost logo

Boost-Build :

Subject: [Boost-build] Boost.Python build trouble
From: Îëåã Ñåëÿíèí (kolobok-s_at_[hidden])
Date: 2011-06-22 01:27:25


I'm trying to build "simple" tutorial described at http://www.boost.org/doc/libs/1_46_1/libs/python/doc/tutorial/doc/html/index.html

#include <boost/python/module.hpp>
#include <boost/python/def.hpp>

char const* greet()
{
  return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

I downloaded boost 1.46.1 sources, built them with bjam after a tons of
headache with Python 3.2.
My %HOME%\user-config.jam is

# MSVC configuration
using msvc : 9.0 ;

# Python configuration
using python : 3.2 : d:/Dev/Python.3.2.Source ;

I tried to build tutorial with bjam and ms vs 2008. The only but not
less persistent error I get in both cases is

Error 1 error LNK2019: unresolved external symbol
"__declspec(dllimport) struct _object * __cdecl
boost::python::detail::init_module(struct PyModuleDef &,void
(__cdecl*)(void))"
(__imp_?init_module_at_detail@python_at_boost@@YAPAU_object@@AAUPyModuleDef@@P6AXXZ_at_Z)
referenced in function _PyInit_hello_ext hello.obj

As deep as I can dig in Internet I encountered that error with this
function car appear while PY_VERSION_HEX definition is wrong
http://stackoverflow.com/questions/5810101/undefined-boost-python-symbol-boostpythondetailinit-module
boost::python::detail::init_module(char const*, void (*)()) - for Python 2.x
and
boost::python::detail::init_module(PyModuleDef&, void (*)()) - for Python 3.x

But the only definition for PY_VERSION_HEX I found is in %PYTHONROOT%\Include\patchlevel.h
and here it is

#define PY_MAJOR_VERSION 3
#define PY_MINOR_VERSION 2
#define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL
#define PY_RELEASE_SERIAL 0

#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \
                        (PY_MINOR_VERSION << 16) | \
                        (PY_MICRO_VERSION << 8) | \
                        (PY_RELEASE_LEVEL << 4) | \
                        (PY_RELEASE_SERIAL << 0))

as I can understand it is 0x030200xx00 that is greater then
0x03000000. And I'm still have the error.

I tried to locate *.lib's contain
init_module_at_detail@python_at_boost@@YAPAU_object@@AAUPyModuleDef@@P6AXXZ_at_Z.
THere are some in %BOOSTROOT%stage\lib\ folder

libboost_python-vc90-mt.lib
libboost_python-vc90-mt-1_46_1.lib
libboost_python-vc90-mt-gd.lib
libboost_python-vc90-mt-gd-1_46_1.lib
libboost_python3-vc90-mt.lib
libboost_python3-vc90-mt-1_46_1.lib
libboost_python3-vc90-mt-gd.lib
libboost_python3-vc90-mt-gd-1_46_1.lib

and in %BOOSTROOT%libs\python\example\tutorial\ (folder with C++ code
fron the tutorial) library

boost_python-vc90-mt-gd-1_46_1.lib

(near to which located boost_python-vc90-mt-gd-1_46_1.dll)
But even inserting each library with its full path in project
properties\linker\input\addiditional dependencies, as well as pointing
%BOOSTROOT%libs\python\example\tutorial\ in project
properties\linker\additional library directories have no positive
effect.

Can't even describe my emotions.

Will appreciate any help.

-- 
Ñ óâàæåíèåì,
 Îëåã                          mailto:kolobok-s_at_[hidden]

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk