help linking to python for dbus-python bindings

Mark Mikofski bwanamarko at
Wed Jul 4 22:08:46 PDT 2012

Simon, thanks so much for helping me (and others) in getting dbus-python built for windows! I will try out the wip-windows branch and let you know how it goes. 


Also, I'm hopeful for the cmake build, because the win32 python is build on msvc90, and uses that redist for extensions, altho supposedly alt compilers can also be used (I've yet to test this - but I guess mingw-gcc-4.7  works!). Of course this will pose another issue for dbus-glib, which I haven't successfully built with msvc.

Question on merging the cmake branch - have Ralf Habacker's KDE patches [1] been merged? I don't think they were merged in choeger's fork, and they probably have some redundancies. I guess maybe it would be nice to have all of the windows ports sync'd upstream (as was done for dbus) so there is a single source.

Also, maybe I should have filed a bug, but I think it's an automake bug in python.m4 [2] not in dbus-python. The command that finds the python package directory, gets mangled on windows because it doesn't pad the backslashes with an extra backslash, so everything get run together, e.g. ${prefix}Libsite-packages, instead of ${prefix}\\Lib\\site-packages. My fix is to edit the configure file and add ".replace('\\\\\','/')" to those lines. Then it works on windows.

Also, I am still getting the following warnings during make:

    libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 sharedlibraries

Anyway, thanks again!



Mark Mikofski

 From: Simon McVittie <simon.mcvittie at>
To: dbus at 
Sent: Wednesday, July 4, 2012 4:29 AM
Subject: Re: help linking to python for dbus-python bindings
On 04/07/12 01:44, Mark Mikofski wrote:
> I have passed PYTHON_LIBS="-L/c/python27/libs -llibpython27.a" with and
> without the "a" extension.

The right syntax for -l (at least on Unix...) looks like "-lpython27".
You shouldn't specify the "lib" at the beginning, or the extension (.a,
.dll, .lib) at the end - the compiler should add those automatically.

If you have libraries visible to your compiler in
/c/python27/libs/libpython27.a, /c/python27/libs/libpython27.lib and/or
/c/python27/libs/libpython27.dll (probably easiest to copy them all into
the same directory?) then the correct value for PYTHON_LIBS would be:

    PYTHON_LIBS="-L/c/python27/libs -lpython27"

Please try this patched version of the dbus-python source, which should
hopefully improve matters on Windows:

or get the 'wip-windows' branch from the dbus-python git repository
(it's the same code). Let me know if this works better, I'll merge it if
there's positive feedback.

> I also made my own library from python27.dll using the directions on
> mingw faqs [1], then linking using PYTHON_LIBS="-L/mingw/lib
> -libpython27" which is where I copied the library too, both with and
> without the "a" extension.

When reporting a bug or asking for help, a good format is:

* what you did (in enough detail that someone else could do exactly the
same - so in this case, please include the exact configure and make
commands you used)

* what you expected to happen (presumably "a _dbus_bindings.pyd that I
can import" in this case)

* what actually happened, including the exact text of any error messages

dbus mailing list
dbus at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the dbus mailing list