[C++-sig] strange error

David Abrahams dave at boost-consulting.com
Wed Oct 16 18:13:19 CEST 2002


Stefan Seefeld <seefeld at sympatico.ca> writes:

> David Abrahams wrote:
> 
> > Can you post code which reproduces the problem?
> > A Jamfile, too, please, if possible.
> 
> ok, attached is a trivial test that exhibits the
> problem. 

Surely you don't just get the problem by compiling and linking? What
Python do you have to execute?  My tests fail to reproduce your
problem. I can import the module and call the wrapped function. The
enclosed files can be unpacked to libs/python/test to demonstrate,
using bjam. I'm quite sure that your problem has to do with the build
system you're using, and nothing else... you can use "bjam -n -a test"
to view all of the build/test commands, so just make sure your build
system is doing the equivalent.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021016/8145f877/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021016/8145f877/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Jamfile
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021016/8145f877/attachment-0002.txt>
-------------- next part --------------


> As the whole thing is part of a much bigger
> system, I use the integrated build system (autotools /
> make based), i.e. there is no Jamfile. But here are
> the compiler options I used:



> to compile:
> 
> CC -DBOOST_PYTHON_DYNAMIC_LIB
> -I/usr/local/include/boost/compatibility/cpp_c_headers -D_REENTRANT
> -I/usr/local/include/python2.2 -I/usr/local/include -n32 -mips4
> -no_auto_include -LANG:std -O0 -OPT:Olimit=0 -OPT:IEEE_NaN_inf=ON -c
> -o
> test.o test.cc
> 
> and to link:
> 
> CC -shared -Wl,-no_unresolved -Wl,-LD_MSG:error=157 -n32 -mips4
> -no_auto_include -LANG:std -O0 -OPT:Olimit=0 -OPT:IEEE_NaN_inf=ON
> -L/usr/local/lib -L/usr/local/lib/python2.2/config -o test.so test.o
> -lboost_python -lpython2.2 -lpthread -lm
> 
> Stefan
> #include <boost/python/module.hpp>
> #include <boost/python/extract.hpp>
> #include <boost/python/list.hpp>
> #include <boost/python/scope.hpp>
> #include <boost/python/enum.hpp>
> #include <boost/python/class.hpp>
> #include <boost/python/return_internal_reference.hpp>
> #include <boost/python/manage_new_object.hpp>
> #include <boost/python/def.hpp>
> #include <boost/python/operators.hpp>
> #include <boost/python/detail/api_placeholder.hpp>
> 
> 
> #include <iostream>
> #include <fstream>
> #include <sstream>
> #include <memory>
> #include <string>
> 
> namespace python = boost::python;
> 
> namespace
> {
> void foo() {}
> }
> 
> BOOST_PYTHON_MODULE(test)
> {
>    python::def("foo", foo);
> }

-- 
           David Abrahams * Boost Consulting
dave at boost-consulting.com * http://www.boost-consulting.com


More information about the Cplusplus-sig mailing list