Results 1 to 7 of 7

Thread: Building PythonQt with MinGW

  1. #1
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Building PythonQt with MinGW

    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?

  2. #2
    Join Date
    Nov 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Building PythonQt with MinGW

    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

  3. #3
    Join Date
    Mar 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building PythonQt with MinGW

    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:

    Qt Code:
    1. PythonQtConversion.cpp:568: error: invalid conversion from `Py_UNICODE*' to `con
    2. st ushort*'
    3. ...
    4. PythonQtConversion.cpp:568: error: initializing argument 1 of `static QString
    5. QString::fromUtf16(const ushort*, int)'
    6. ...
    To copy to clipboard, switch view to plain text mode 

    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

  4. #4
    Join Date
    Mar 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building PythonQt with MinGW

    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...

  5. #5
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Re: Building PythonQt with MinGW

    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

  6. #6
    Join Date
    Mar 2010
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building PythonQt with MinGW

    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

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

  7. #7
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Re: Building PythonQt with MinGW

    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

Similar Threads

  1. Building Qt with MinGW - strange dependencies
    By gluke in forum Installation and Deployment
    Replies: 2
    Last Post: 20th October 2008, 12:50
  2. Qt + boost + MinGW on Windows
    By akos.maroy in forum Newbie
    Replies: 3
    Last Post: 12th June 2008, 15:53
  3. Building Qt 4.3.4 on Win Vista & MinGW
    By Sirow in forum Installation and Deployment
    Replies: 2
    Last Post: 28th April 2008, 19:27
  4. Failure when building QT on Windows with MinGW
    By sharon in forum Installation and Deployment
    Replies: 2
    Last Post: 23rd August 2007, 14:38
  5. PythonQt 1.0
    By florianlin in forum Qt-based Software
    Replies: 6
    Last Post: 3rd July 2007, 11:35

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.