PDA

View Full Version : Building PythonQt with MinGW



givemeaname
1st January 2010, 21:07
Hello,


i try to build PythonQt with the actual version of Qt(4.6) and MinGW as Compiler and Python x86 2.6.
Compiling runs fine .. but i got unresolved linker errors.Ive searched the web and it seems that the static python library is intended for use with MSVC.
Has someone ever tried to compile PythonQt with MinGW?

I already tried to convert the static python ".lib" in ".a" format with the tools pexports and dlltool.
I got a ".def" file from pexports but dlltool fails with:
dlltool.exe: Syntax error in def file python26.def:0

Does anyone have an idea what else i could try?

givemeaname
7th January 2010, 13:28
got it working!

the solution:
1. get the latest builds of pexports and dlltool from mingw.sourceforge
2. run pexorts and dlltool on python26.dll .. should generate a static library
3. change reference in .pro files link against ".a" library .. and maybe update paths

jasonknight
4th March 2010, 13:27
Hey

Do you mind sharing how you compiled PythonQt with MinGW?

I have installed it, and GNU Make, however, I have encountered alot of errors:



PythonQtConversion.cpp:568: error: invalid conversion from `Py_UNICODE*' to `con
st ushort*'
...
PythonQtConversion.cpp:568: error: initializing argument 1 of `static QString
QString::fromUtf16(const ushort*, int)'
...


I am pretty new to Qt and c++ in general, so if you have a moment, maybe you can explain the process a little bit?

Many thanks in advance,
Jason

jasonknight
4th March 2010, 13:47
Well,

I rooted around in those files and explicitly casted, which got rid of those errors, now I got a crazy one:


g++: /python26_d.lib: No such file or directory

Course, I am now trying to build with QT Creator itself, it's like 90% there...

JPNaude
5th March 2010, 10:10
Hi

Got the same error when building it yesterday.

Look in Python.prf and change the win32:LIBS to:

win32:LIBS += $(PYTHON_LIB)/libpython$${PYTHON_VERSION}.a

I had to change it in about 3 prf files, can't remember now.

Hope you get it right, if not ask again. Was not able to run the generator on Qt 4.6 libraries though, and some of the examples has some bugs in them which makes them crash under certain circumstances. In the Console GUI example , for example when you put the cursor above the command prompt and press enter it crashes. Fixed most of the errors though. If you want details let me know.

Cheers
Jaco

jasonknight
6th March 2010, 12:50
Hey JP,

I did manage to get PythonQt to compile, unfortunately, absolutely everything I did, even calling PythonQt::init() etc caused the whole thing to go down in smoke with nary an error message, just instadeath.

I am debating whether I want to use PythonQt or give up the ghost on this one.

What I did manage to do is manually embed Python 2.6 into the app so that it executes python code in a file, it's a bit hackish, i.e. I call Py_RunSimpleString("execfile(<the filename>)") to get it to run. Attempting to use anything more completely crashes everything.

I have successfully integrated Qt Script into the application as well, and haven't hit too many problems with that.

The issue I have is this:

I need for users to be able to: Interact with a Database (SQLite), read and write files, access network stuff etc, and I don't want to implement that in c++ myself. Most modern scripting languages usually have some kind of framework with an ORM implementation for SQLite, or MySQL, and ability to download from the internet, and access the filesystem. If possible, I would also like them to have some limited control the GUI.
The Gui is dead simple, it's just a WebView. I guess my question is, could I do this with just Qt Script? How difficult will it be to do this with PythonQt? Essentially, all I would really need is for them to be able to add content, get content from the frame, maybe access a few utility functions like findFirstElement etc. Can I just do it all from Qt Script?

If you have some advice on whether or not I should even attempt embedding Python, i'd love to here it, also you can check out the project on google code Wiji Project on GoogleCode (http://code.google.com/p/wiji/)

This is my first c++ experience, and it's been fun, but there are some subtleties I simply don't grok.

JPNaude
9th March 2010, 08:20
Hi

I don't have a lot of experience with either PythonQt or QtScript. As far as I know QtScript is the best when you only want to manipulate Qt classes etc. I need to do math stuff and intend to use SciPy for that, thus I need PythonQt.

Not sure why PythonQt is so unstable. It is used in a mature product so it should be stable. Maybe its because the latest SVN trunk is unstable... In any case I will see what it is like as I go along.

Cheers,
Jaco