|
Boost-Build : |
From: John Reid (j.reid_at_[hidden])
Date: 2006-12-13 05:51:49
Hi,
I'm cross posting this here as it didn't get a response on the python list.
When I create a static library that uses boost.python and subsequently
link this into an extension some boost.python functions are multiply
defined. These are inlined template functions.
I've attached a minimal test case that shows this problem. The output
from bjam --v2 -q is in bjam.out.
If I have this right the inlined functions handle::~handle()
instantiated in the static library should not conflict with the same
function instantiated in the boost python extension. What could be
causing this?
Is there some way to tell msvc 8 not to include the inlined boost.python
functions in the static library? Or should this be fixed in the
boost.python code? I could turn my static lib into a dll but I'd rather
not. I could also move the offending code into the extension but again
I'd rather not.
I'm on windows XP, using boost build v2 with the latest CVS version of
RC_1_34_0. My compiler is the latest patched version of VC++ express.
John.
bjam.out:
Building Boost.Regex with the optional Unicode/ICU support disabled.
Please refer to the Boost.Regex documentation for more information
(and if you don't know what ICU is then you probably don't need it).
...patience...
...found 1139 targets...
...updating 2 targets...
msvc.link.dll bin\msvc-8.0\debug\threading-multi\test_ext.pyd
bin\msvc-8.0\debug\threading-multi\test_ext.lib
boost_python-vc80-mt-gd-1_34.lib(boost_python-vc80-mt-gd-1_34.dll) :
error LNK2005: "public: __thiscall boost::python::handle<struct
_object>::~handle<struct _object>(void)"
(??1?$handle_at_U_object@@@python_at_boost@@QAE_at_XZ) already defined in
libtest_lib.lib(lib_src.obj)
boost_python-vc80-mt-gd-1_34.lib(boost_python-vc80-mt-gd-1_34.dll) :
error LNK2005: "public: __thiscall boost::python::handle<struct
_object>::handle<struct _object>(void)"
(??0?$handle_at_U_object@@@python_at_boost@@QAE_at_XZ) already defined in
libtest_lib.lib(lib_src.obj)
Creating library bin\msvc-8.0\debug\threading-multi\test_ext.lib and
object bin\msvc-8.0\debug\threading-multi\test_ext.exp
bin\msvc-8.0\debug\threading-multi\test_ext.pyd : fatal error LNK1169:
one or more multiply defined symbols found
call "C:\Program Files\Microsoft Visual Studio
8\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /subsystem:console
/out:"bin\msvc-8.0\debug\threading-multi\test_ext.pyd"
/IMPLIB:"bin\msvc-8.0\debug\threading-multi\test_ext.lib"
/LIBPATH:"C:\apps\Python24\libs"
@"bin\msvc-8.0\debug\threading-multi\test_ext.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
if exist
"bin\msvc-8.0\debug\threading-multi\test_ext.pyd.manifest" (
mt -nologo -manifest
"bin\msvc-8.0\debug\threading-multi\test_ext.pyd.manifest"
"-outputresource:bin\msvc-8.0\debug\threading-multi\test_ext.pyd;2"
)
...failed msvc.link.dll bin\msvc-8.0\debug\threading-multi\test_ext.pyd
bin\msvc-8.0\debug\threading-multi\test_ext.lib...
...removing bin\msvc-8.0\debug\threading-multi\test_ext.lib
...failed updating 1 target...
ext_src.cpp:
#include <boost/python.hpp>
using namespace boost::python;
void lib_fn();
void dummy_fn()
{
handle< > test;
}
BOOST_PYTHON_MODULE( _pyker )
{
def( "fn", lib_fn );
}
lib_src.cpp:
#include <boost/python.hpp>
using namespace boost::python;
void lib_fn()
{
handle< > test;
}
Jamfile.v2:
import python ;
project test
: requirements
<use>/boost/python//boost_python # gets python include path
<define>BOOST_ALL_NO_LIB # disable boost auto-linking
: usage-requirements
;
lib test_lib
:
lib_src.cpp
:
<link>static
;
python-extension test_ext
:
ext_src.cpp
test_lib
/boost/python//boost_python
;
project-root.jam:
path-constant TOP : . ;
use-project /boost : $(BOOST_ROOT) ;
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