$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] Compile boost python extension using IDE on windows
From: Raul Durand (raul.durand_at_[hidden])
Date: 2011-01-12 08:15:20
Hi guys,
I have a extension on Linux that uses boost python with no problems.
Now I want to compile my extension on Windows, so I downloaded the
precompiled boost libraries from:
http://www.boostpro.com/download/boost_1_44_setup.exe
I tried to compile my extension on windows using Visual Studio c++ 2008
express edition.
I followed all the instructions from:
http://boost.cppll.jp/HEAD/libs/python/doc/building.html
to use an IDE to compile my own project and obtain a dll. I included all
sources and libs and turned on RTTI and changed the debug and release builds
to Multi-thread dll debug and Multi-thread dll release.
All compilation process is successful. The problem is during linking appears
*some warnings as*:
1> Creating library C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.lib and
object C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.exp
1>libfembase.obj : warning LNK4217: locally defined symbol
??0str_base_at_detail@python_at_boost@@IAE_at_PBD@Z (protected: __thiscall
boost::python::detail::str_base::str_base(char const *)) imported in
function "public: __thiscall boost::python::str::str(char const *)"
(??0str_at_python@boost@@QAE_at_PBD@Z)
1>libfembase.obj : warning LNK4217: locally defined symbol ??
1str_base_at_detail@python_at_boost@@QAE_at_XZ (public: __thiscall
boost::python::detail::str_base::~str_base(void)) imported in function
"public: __thiscall boost::python::str::~str(void)" (??1str_at_python@boost@
@QAE_at_XZ)
1>libfembase.obj : warning LNK4217: locally defined symbol
?throw_error_already_set_at_python@boost@@YAXXZ (void __cdecl
boost::python::throw_error_already_set(void)) imported in function "int
__cdecl boost::python::len(class boost::python::api::object const &)"
(?len_at_python@boost@@YAHABVobject_at_api@12@@Z)
*and some errors as:*
1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved
external symbol __imp__PyDict_Items referenced in function "public: class
boost::python::list __thiscall
boost::python::detail::dict_base::items(void)const " (?items_at_dict_base
@detail_at_python@boost@@QBE?AVlist_at_34@XZ)
1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved
external symbol __imp__PyDict_Keys referenced in function "public: class
boost::python::list __thiscall
boost::python::detail::dict_base::keys(void)const " (?keys_at_dict_base
@detail_at_python@boost@@QBE?AVlist_at_34@XZ)
1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved
external symbol __imp__PyDict_Update referenced in function "public: void
__thiscall boost::python::detail::dict_base::update(class
boost::python::api::object const &)" (?update_at_dict_base_at_detail@python_at_boost@
@QAEXABVobject_at_api@34@@Z)
1>boost_python-vc90-mt-gd-1_44.lib(dict.obj) : error LNK2019: unresolved
external symbol __imp__PyDict_Values referenced in function "public: class
boost::python::list __thiscall
boost::python::detail::dict_base::values(void)const " (?values_at_dict_base
@detail_at_python@boost@@QBE?AVlist_at_34@XZ)
1>C:\My Dropbox\codes\fem\pyfem\Debug\pyfem.dll : fatal error LNK1120: 133
unresolved externals
1>Build log was saved at "file://c:\My
Dropbox\codes\fem\pyfem\Debug\BuildLog.htm"
1>pyfem - 230 error(s), 56 warning(s)
*#############*
I got the same warnings and errors using bjam.
I have been successful compiling and linking as a static library pyfem.lib
using VS, but it does not work as a python extension even renaming to .pyd.
- What I am missing to obtain the dll for my extension using VS?
- Is it possible to create a boost python extension using VS C++ 2008
express edition?
- I am using Win7 64 bits and Python 2.6 64 bits, so using boost 64 bit
binaries is mandatory?
Thanks.
Raul Durand