Quoting Christiaan Putter <[EMAIL PROTECTED]>:

(Returning this to the mailing list, as you mistakenly replied to me in private)

Hi Pau,

Thanks for the swift reply.

From the boost website page on building boost there's a section on Mingw,
quoting:

"If you are using a version of Python prior to 2.4.1 with a MinGW prior to
3.0.0 (with binutils-2.13.90-20030111-1), you will need to create a
MinGW-compatible version of the Python library; the one shipped with Python
will only work with a Microsoft-compatible linker..."

The mingw site says something similar.

I assumed this meant that using an up to date version of python (2.5) and
mingw meant it should work 'out of the box'.

No, it means Python sources since 2.4 do not need to be patched to build with MinGW:
http://www.mingw.org/MinGWiki/index.php/Python extensions

I forgot to mention though that I'm embedding pyhton into c++, so compiling
a normal c++ executable.  Also, like I said, compiling and linking something
using only the python25 lib works.  I'm getting errors when linking to my
boost.python libs.

Most probably your problem is due to different call conventions being used (__stdcall and __cdecl). Read about that here:
http://www.geocities.com/yongweiwu/stdcall.htm

Either you build Python with MinGW, then try to link and make sure you are providing all the libraries you need, or you try to create your own import libraries for VC++-compiled Python. I'd go for the former, as it will be easier.

In case someone else is following this thread that wants to extend python:

If you're compiling python code with mingw you'll have to tell it to use
mingw
ie. something like: python setup.py build --compiler=mingw32
There's a nice tutorial at
http://boodebr.org/main/python/build-windows-extensions

I don't know if this is applicable to embedding too.

I have never embedded Python in an application and hardly programmed anything in Python ever. I'm a Ruby guy.

Am I correct in assuming this Pau?


On 12/11/2007, Pau Garcia i Quiles <[EMAIL PROTECTED]> wrote:

Quoting Christiaan Putter <[EMAIL PROTECTED]>:

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
>
> TARGET_LINK_LIBRARIES(${EXE_NAME}
>         ${BOOST_PYTHON_LIB}
>         ${PYTHON_LIBRARIES}
>     )
>
> 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
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake





--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to