[CMake] Linking boost python with mingw

Pau Garcia i Quiles pgquiles at elpauer.org
Mon Nov 12 17:08:48 EST 2007

Quoting Christiaan Putter <ceputter at googlemail.com>:

Are you using a mingw-compiled Python? In case you are using a  
VC++-compiled version of Python (which is the one you download from  
python.org), have you created import libraries for MinGW?

> Hi guys and girls,
> I'm new to this wonderful CMake thingy and I'm having some problems linking
> to boost.python.
> My setup on windows xp:
> mingw       5.1.3  (with gcc 3.4.5)
> boost        1.34.1
> python      2.5
> I compiled boost as per instructions with mingw without any problems.
> With some simple code using boost/python I can compile without errors, but
> when ld tries linking I get "undefined reference to '_imp____  ...." errors.
> In my CMakeLists file I have
>         ${BOOST_PYTHON_LIB}
>     )
> With the BOOST_PYTHON_LIB pointing directly to
> C:/Boost/lib/libboost_python-mgw34-1_34_1.a
> Removing code using boost.python stuff and just using the normal python lib
> compiles and links fine.
> What am I doing wrong?  I've tried every version of the boost_python lib by
> the way, -mt, -s, -d, and combinations thereof.  Which one should I use, is
> there a way to chose the correct library automatically, the
> FindBoost.cmakeinclude doesn't seem to do it.
> And what exactly is the -s library for? I though lib*.a files were already
> static?
> If anyone out there has gotten boost.python to work with mingw please let me
> in on your secrets.  Any suggestions are welcome...
> Have a nice day,
> cputter

Pau Garcia i Quiles
(Due to my workload, I may need 10 days to answer)

More information about the CMake mailing list