You are not logged in.

#1 2009-04-28 23:54:14

Hessiess
Member
Registered: 2008-07-21
Posts: 75

[solved] Problem compialing boost python example on Arch.

I have bean trying to compile the basic boost.python example program on arch, but g++ is spitting out errors stating that it cannot find Python.h and so on.

#include <boost/python.hpp>

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

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}
g++ boost_python_test.cpp 
In file included from /usr/include/boost/python/detail/prefix.hpp:13,
                 from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from boost_python_test.cpp:1:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: error: pyconfig.h: No such file or directory
/usr/include/boost/python/detail/wrap_python.hpp:75:24: error: patchlevel.h: No such file or directory
/usr/include/boost/python/detail/wrap_python.hpp:78:2: error: #error Python 2.2 or higher is required for this version of Boost.Python.
/usr/include/boost/python/detail/wrap_python.hpp:142:21: error: Python.h: No such file or directory
^C
... 
tonnes of errors.

Last edited by Hessiess (2009-04-30 21:25:26)

Offline

#2 2009-04-29 06:58:33

krigun
Member
From: Norway
Registered: 2005-06-06
Posts: 122
Website

Re: [solved] Problem compialing boost python example on Arch.

This should compile:

g++ boost_py.cpp -lboost_python -lpython2.6 -I /usr/include/python2.6/ -o boost_py.so -shared

Offline

#3 2009-04-29 08:11:10

Hessiess
Member
Registered: 2008-07-21
Posts: 75

Re: [solved] Problem compialing boost python example on Arch.

Thanks, that compiles, however the module fails to import.

>>> import boost_py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initboost_py)
>>>

Offline

#4 2009-04-29 08:59:54

krigun
Member
From: Norway
Registered: 2005-06-06
Posts: 122
Website

Re: [solved] Problem compialing boost python example on Arch.

Rename

BOOST_PYTHON_MODULE(hello_ext)

to

BOOST_PYTHON_MODULE(boost_py)

Offline

#5 2009-04-29 09:14:23

Hessiess
Member
Registered: 2008-07-21
Posts: 75

Re: [solved] Problem compialing boost python example on Arch.

Thanks, it works:).

Offline

#6 2009-04-29 14:46:56

JK3mp
Member
Registered: 2009-03-25
Posts: 105

Re: [solved] Problem compialing boost python example on Arch.

Don't forget to put SOLVED in the title on your solved issue's please. smile

Offline

#7 2009-04-30 21:26:51

Hessiess
Member
Registered: 2008-07-21
Posts: 75

Re: [solved] Problem compialing boost python example on Arch.

JK3mp wrote:

Don't forget to put SOLVED in the title on your solved issue's please. smile

Done wink

Offline

Board footer

Powered by FluxBB