just a quick update about this in case someone else wandered about it.<br><br>I gave up trying to get boost.python to work with Python. I'm sure it would if I could get mingw to build Python, but the only project I could find that was supporting this (the Python source needs to be modified apparently) doesn't do so any more since several releases of Python because the windows libraries supplied by python "should" be compatible. And they are, just not with
boost.python built with mingw for some reason.<br><br>So it ended up being way to much trouble to try and get boost.python to work and I switched to Swig.<br><br>Swig works great, the cmake support could be better but there're no problems with linking to the Python libs.
<br><br>Of course some people might say that one should stick with msvc for compiling stuff on windows because everything (is forced to) support it, and it's free like beer. Though when using free Qt you have to use mingw, no way around that. But that ain't the point, I like stuff that's free like speech and will struggle to only use stuff that's free like speech. Even if it means recompiling stuff until everything else broke.
<br><br><br>ciao<br><br>cputter<br><br><br><br><div><span class="gmail_quote">On 13/11/2007, <b class="gmail_sendername">Christiaan Putter</b> <<a href="mailto:ceputter@googlemail.com">ceputter@googlemail.com</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks Pau, I'll build <span id="st" name="st" class="st">Python</span> with mingw and give it a try.
<br><br>I'll let you guys know how that worked out...<br><br>Have a nice evening.<div><span class="e" id="q_116362533a1c8cd7_1"><br><br><br><div><span class="gmail_quote">On 13/11/2007, <b class="gmail_sendername">
Pau Garcia i Quiles</b> <<a href="mailto:pgquiles@elpauer.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">pgquiles@elpauer.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Quoting Christiaan Putter <<a href="mailto:ceputter@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ceputter@googlemail.com</a>>:<br><br>(Returning this to the mailing list, as you mistakenly replied to me
<br>in private)<br><br>> Hi Pau,<br>>
<br>> Thanks for the swift reply.<br>><br>> From the boost website page on building boost there's a section on Mingw,<br>> quoting:<br>><br>> "If you are using a version of Python prior to 2.4.1
with a MinGW prior to<br>> 3.0.0 (with binutils-2.13.90-20030111-1), you will need to create a<br>> MinGW-compatible version of the Python library; the one shipped with Python<br>> will only work with a Microsoft-compatible linker..."
<br>><br>> The mingw site says something similar.<br>><br>> I assumed this meant that using an up to date version of python (2.5) and<br>> mingw meant it should work 'out of the box'.<br><br>No, it means Python sources since
2.4 do not need to be patched to<br>build with MinGW:<br><a href="http://www.mingw.org/MinGWiki/index.php/Python" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.mingw.org/MinGWiki/index.php/Python
</a> extensions<br><br>> I forgot to mention though that I'm embedding pyhton into c++, so compiling
<br>> a normal c++ executable. Also, like I said, compiling and linking something<br>> using only the python25 lib works. I'm getting errors when linking to my<br>> boost.python libs.<br><br>Most probably your problem is due to different call conventions being
<br>used (__stdcall and __cdecl). Read about that here:<br><a href="http://www.geocities.com/yongweiwu/stdcall.htm" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.geocities.com/yongweiwu/stdcall.htm
</a><br><br>Either you build Python with MinGW, then try to link and make sure you
<br>are providing all the libraries you need, or you try to create your<br>own import libraries for VC++-compiled Python. I'd go for the former,<br>as it will be easier.<br><br>> In case someone else is following this thread that wants to extend python:
<br>><br>> If you're compiling python code with mingw you'll have to tell it to use<br>> mingw<br>> ie. something like: python setup.py build --compiler=mingw32<br>> There's a nice tutorial at<br>
> <a href="http://boodebr.org/main/python/build-windows-extensions" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://boodebr.org/main/python/build-windows-extensions</a><br>><br>> I don't know if this is applicable to embedding too.
<br><br>I have never embedded Python in an application and hardly programmed
<br>anything in Python ever. I'm a Ruby guy.<br><br>> Am I correct in assuming this Pau?<br>><br>><br>> On 12/11/2007, Pau Garcia i Quiles <<a href="mailto:pgquiles@elpauer.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
pgquiles@elpauer.org</a>
> wrote:<br>>><br>>> Quoting Christiaan Putter <<a href="mailto:ceputter@googlemail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ceputter@googlemail.com</a>>:<br>>>
<br>>> Are you using a mingw-compiled Python? In case you are using a
<br>>> VC++-compiled version of Python (which is the one you download from<br>>> <a href="http://python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">python.org</a>), have you created import libraries for MinGW?
<br>>><br>>> > Hi guys and girls,
<br>>> ><br>>> > I'm new to this wonderful CMake thingy and I'm having some problems<br>>> linking<br>>> > to boost.python.<br>>> ><br>>> > My setup on windows xp:
<br>>> ><br>>> > mingw 5.1.3 (with gcc 3.4.5)<br>>> > boost 1.34.1<br>>> > python 2.5<br>>> ><br>>> > I compiled boost as per instructions with mingw without any problems.
<br>>> ><br>>> > With some simple code using boost/python I can compile without errors,<br>>> but<br>>> > when ld tries linking I get "undefined reference to '_imp____ ...."
<br>>> errors.<br>>> ><br>>> > In my CMakeLists file I have<br>>> ><br>>> > TARGET_LINK_LIBRARIES(${EXE_NAME}<br>>> > ${BOOST_PYTHON_LIB}<br>>> > ${PYTHON_LIBRARIES}
<br>>> > )<br>>> ><br>>> > With the BOOST_PYTHON_LIB pointing directly to<br>>> > C:/Boost/lib/libboost_python-mgw34-1_34_1.a<br>>> ><br>>> > Removing code using
boost.python
stuff and just using the normal python<br>>> lib<br>>> > compiles and links fine.<br>>> ><br>>> > What am I doing wrong? I've tried every version of the boost_python lib<br>>> by
<br>>> > the way, -mt, -s, -d, and combinations thereof. Which one should I use,<br>>> is<br>>> > there a way to chose the correct library automatically, the<br>>> > FindBoost.cmakeinclude
doesn't seem to do it.<br>>> ><br>>> > And what exactly is the -s library for? I though lib*.a files were<br>>> already<br>>> > static?<br>>> ><br>>> > If anyone out there has gotten
boost.python to work with mingw please<br>>> let me<br>>> > in on your secrets. Any suggestions are welcome...<br>>> ><br>>> > Have a nice day,<br>>> > cputter<br>>> ><br>
>><br>>><br>>><br>>> --<br>>> Pau Garcia i Quiles<br>>> <a href="http://www.elpauer.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.elpauer.org</a>
<br>>> (Due to my workload, I may need 10 days to answer)<br>>>
<br>>> _______________________________________________<br>>> CMake mailing list<br>>> <a href="mailto:CMake@cmake.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">CMake@cmake.org
</a><br>>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.cmake.org/mailman/listinfo/cmake</a><br>>><br>><br><br><br><br>--<br>Pau Garcia i Quiles<br><a href="http://www.elpauer.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.elpauer.org
</a><br>(Due to my workload, I may need 10 days to answer)
<br><br></blockquote></div><br>
</span></div></blockquote></div><br>