Building Boost.Python against a debug build of Python

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Building Boost.Python against a debug build of Python

Adam Preble
I previously posted about runtime oddness when switching to a debug build of python.  I figured I needed to rebuild Boost.Python.  The build process is fixated on using the normal python.exe and python.lib paths, rather than python_d.exe and python_d.lib.  I have put those files in my Python26 directory, and then tried to get fancy by renaming them to their release names instead.  It gets mad at me . . .

 Creating library bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.lib and object bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.exp
module.obj : error LNK2019: unresolved external symbol __imp__Py_InitModule4 referenced in function "struct _object * __cdecl boost::python::detail::init_module(char const *,void (__cdecl*)(void))" (?init_module@detail@python@boost@@YAPAU_object@@PBDP6AXXZ@Z)
bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.dll : fatal error LNK1120: 1 unresolved externals

I'm thinking that isn't what I'm supposed to do anyways.  Is there something I need to do in my build string?  This is how I would do a full build.  Note all the baggage I added for building Python:

[FWIW I'm building Boost 1.47 with VS2010's toolchain]

set INCLUDE=D:\Python26\include;D:\Python26\include\Stackless
b2 --toolset=msvc-10.0 --build-type=complete stage
b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=32 stage
b2 --toolset=msvc-10.0 --with-python --build-type=complete --debug-configuration architecture=x86 address-model=32 stage debug-symbols=on debug-store=database python-debugging=on



_______________________________________________
Cplusplus-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/cplusplus-sig
Reply | Threaded
Open this post in threaded view
|

Re: Building Boost.Python against a debug build of Python

Jim Bosch-2
If you haven't already, you may need to take this to a Boost.Build list;
I avoid Boost's build system whenever possible, and I know even less
about using it on Windows.

Sorry!

Jim



On 02/15/2012 10:38 AM, Adam Preble wrote:

> I previously posted about runtime oddness when switching to a debug build
> of python.  I figured I needed to rebuild Boost.Python.  The build process
> is fixated on using the normal python.exe and python.lib paths, rather than
> python_d.exe and python_d.lib.  I have put those files in my Python26
> directory, and then tried to get fancy by renaming them to their release
> names instead.  It gets mad at me . . .
>
>   Creating library
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.lib
> and object
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.exp
> module.obj : error LNK2019: unresolved external symbol
> __imp__Py_InitModule4 referenced in function "struct _object * __cdecl
> boost::python::detail::init_module(char const *,void (__cdecl*)(void))"
> (?init_module@detail@python@boost@@YAPAU_object@@PBDP6AXXZ@Z)
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-multi\boost_python-vc100-mt-y-1_47.dll
> : fatal error LNK1120: 1 unresolved externals
>
> I'm thinking that isn't what I'm supposed to do anyways.  Is there
> something I need to do in my build string?  This is how I would do a full
> build.  Note all the baggage I added for building Python:
>
> [FWIW I'm building Boost 1.47 with VS2010's toolchain]
>
> set INCLUDE=D:\Python26\include;D:\Python26\include\Stackless
> b2 --toolset=msvc-10.0 --build-type=complete stage
> b2 --toolset=msvc-10.0 --build-type=complete architecture=x86
> address-model=32 stage
> b2 --toolset=msvc-10.0 --with-python --build-type=complete
> --debug-configuration architecture=x86 address-model=32 stage
> debug-symbols=on debug-store=database python-debugging=on
>
>
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/cplusplus-sig

_______________________________________________
Cplusplus-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/cplusplus-sig
Reply | Threaded
Open this post in threaded view
|

Re: Building Boost.Python against a debug build of Python

Dave Abrahams
In reply to this post by Adam Preble

Please read:
http://www.boost.org/doc/libs/1_49_0/libs/python/doc/building.html#python-debugging-builds

HTH,
Dave

on Wed Feb 15 2012, Adam Preble <adam.preble-AT-gmail.com> wrote:

> I previously posted about runtime oddness when switching to a debug
> build of python.  I figured I needed to rebuild Boost.Python.  The
> build process is fixated on using the normal python.exe and python.lib
> paths, rather than python_d.exe and python_d.lib.  I have put those
> files in my Python26 directory, and then tried to get fancy by
> renaming them to their release names instead.  It gets mad at me . . .
>
>
>  Creating library
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.lib and object
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.exp
> module.obj : error LNK2019: unresolved external symbol
> __imp__Py_InitModule4 referenced in function "struct _object * __cdecl
> boost::python::detail::init_module(char const *,void (__cdecl*)
> (void))" (?init_module@detail@python@boost@@YAPAU_object@@PBDP6AXXZ@Z)
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.dll : fatal error LNK1120: 1
> unresolved externals
>
> I'm thinking that isn't what I'm supposed to do anyways.  Is there
> something I need to do in my build string?  This is how I would do a
> full build.  Note all the baggage I added for building Python:
>
> [FWIW I'm building Boost 1.47 with VS2010's toolchain]
>
> set INCLUDE=D:\Python26\include;D:\Python26\include\Stackless
> b2 --toolset=msvc-10.0 --build-type=complete stage
> b2 --toolset=msvc-10.0 --build-type=complete architecture=x86
> address-model=32 stage
> b2 --toolset=msvc-10.0 --with-python --build-type=complete
> --debug-configuration architecture=x86 address-model=32 stage
> debug-symbols=on debug-store=database python-debugging=on
>
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/cplusplus-sig

--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

_______________________________________________
Cplusplus-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/cplusplus-sig
Reply | Threaded
Open this post in threaded view
|

Re: Building Boost.Python against a debug build of Python

Adam Preble
Too late--I managed to get it to build a bit ago.  But that being said, I had read that little blurb while trying to figure out what was going on.  Unfortunately it's the kind of thing that makes sense if you already know what to do, but it didn't make any sense to me when I was stammering through the process.  That happens all the time and I'm sure I have plenty of stuff just like that lying around too.  

I'll probably post some blog thing somewhere on personal hosting and get it harvested onto Google soon, but in the meantime, I figure it would be best for the list to briefly go over the building process for those that just use Boost.Build enough to build Boost:

1. Build a debug python.
2. Develop a Boost.Build user config to select the debug python and build against it, in a way consistent with your other already-built Boost stuff (see example).
3. Run the bjam command against the user config to build Boost.Python for debugging.
4. Rebuild your target project, enabling BOOST_DEBUG_PYTHON, and potentially BOOST_PYTHON_NO_LIB (that was what killed me).

For me, the user config:
using python : 2.6 : D:\\temp\\stackless_src\\python-2.6.5-stackless\\PCbuild\\python_d.exe
  : D:\\Python26\\Include
  : D:\\temp\\stackless_src\\python-2.6.5-stackless\\PCbuild
  : <python-debugging>on ;

And the bjam command:
bjam --user-config=user-config.jam --with-python python-debugging=on threading=multi variant=debug-python link=static stage

Granted, there's probably been, like, five of us that have ever wanted to do this.

On Tue, Feb 28, 2012 at 3:18 PM, Dave Abrahams <[hidden email]> wrote:

Please read:
http://www.boost.org/doc/libs/1_49_0/libs/python/doc/building.html#python-debugging-builds

HTH,
Dave

on Wed Feb 15 2012, Adam Preble <adam.preble-AT-gmail.com> wrote:

> I previously posted about runtime oddness when switching to a debug
> build of python.  I figured I needed to rebuild Boost.Python.  The
> build process is fixated on using the normal python.exe and python.lib
> paths, rather than python_d.exe and python_d.lib.  I have put those
> files in my Python26 directory, and then tried to get fancy by
> renaming them to their release names instead.  It gets mad at me . . .
>
>
>  Creating library
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.lib and object
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.exp
> module.obj : error LNK2019: unresolved external symbol
> __imp__Py_InitModule4 referenced in function "struct _object * __cdecl
> boost::python::detail::init_module(char const *,void (__cdecl*)
> (void))" (?init_module@detail@python@boost@@YAPAU_object@@PBDP6AXXZ@Z)
> bin.v2\libs\python\build\msvc-10.0\release\address-model-32\architecture-
> x86\debug-store-database\debug-symbols-on\python-debugging-on\threading-
> multi\boost_python-vc100-mt-y-1_47.dll : fatal error LNK1120: 1
> unresolved externals
>
> I'm thinking that isn't what I'm supposed to do anyways.  Is there
> something I need to do in my build string?  This is how I would do a
> full build.  Note all the baggage I added for building Python:
>
> [FWIW I'm building Boost 1.47 with VS2010's toolchain]
>
> set INCLUDE=D:\Python26\include;D:\Python26\include\Stackless
> b2 --toolset=msvc-10.0 --build-type=complete stage
> b2 --toolset=msvc-10.0 --build-type=complete architecture=x86
> address-model=32 stage
> b2 --toolset=msvc-10.0 --with-python --build-type=complete
> --debug-configuration architecture=x86 address-model=32 stage
> debug-symbols=on debug-store=database python-debugging=on
>
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/cplusplus-sig

--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

_______________________________________________
Cplusplus-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/cplusplus-sig


_______________________________________________
Cplusplus-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/cplusplus-sig