Need Help Building PythonQt on Windows

J

Jeff Schiller

Hello,

I'm creating an application using Qt (4.4 Beta atm). I have pretty
close to zero experience with Python (consisting of installing the
Python interpreter, downloading a python programming and executing it
on the command-line).

I would like to invoke a Python script from my C++ Qt program and
capture its output as a C++ structure. It seems that PythonQt might
be suitable for my needs.

Being a Qt program, I want this thing to be cross-platform. I'm
having trouble getting things set up in Windows. Has anyone had any
experience with this?

I've built Qt from source using the mingw32 compiler. I installed
Python 2.5 binary. I am trying to build PythonQt from source. As per
http://pythonqt.sourceforge.net/#Building it says I need a "developer
installation" of Python containing the header files and the library
files. When I look at my system after installing the Python 2.5
binary, I can see I have header files (C:\Python25\include), a 199k
python25.lib (C:\Python25\libs) and a 2MB python25.dll
(C:\Windows\System32\). Have I got what I need?

I have tried to set up my symbols (PYTHON_PATH, PYTHON_LIB,
PYTHONQT_ROOT). I generate the Makefile (using qmake) and it starts
to build but then it fails:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -shared
-Wl,--out-implib,lib\libPythonQt.a -o lib\PythonQt.dll
object_script.PythonQt.Debug -L"c:\Qt\4.4.0-beta1\lib"
"c:\Python25\libs"/python25.lib -lQtGuid4 -lQtCored4
../debug\PythonQt.o: In function `ZN8PythonQtC2Ei':
C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
`_imp__Py_NoSiteFlag'
../debug\PythonQt.o: In function `ZN8PythonQtC1Ei':
C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
`_imp__Py_NoSiteFlag'
../debug\PythonQt.o: In function `ZN15PythonQtPrivate11wrapQObjectEP7QObject':
C:/PythonQt-1.0/src/PythonQt.cpp:256: undefined reference to
`_imp___Py_NoneStruct'
C:/PythonQt-1.0/src/PythonQt.cpp:257: undefined reference to
`_imp___Py_NoneStruct'
../debug\PythonQt.o: In function `ZN15PythonQtPrivate7wrapPtrEPvRK10QByteArray':
C:/PythonQt-1.0/src/PythonQt.cpp:281: undefined reference to
`_imp___Py_NoneStruct'
C:/PythonQt-1.0/src/PythonQt.cpp:282: undefined reference to
`_imp___Py_NoneStruct'
../debug\PythonQt.o: In function
`ZN8PythonQt13introspectionEP7_objectRK7QStringNS_10ObjectTypeE':
C:/PythonQt-1.0/src/PythonQt.cpp:620: undefined reference to
`_imp__PyClass_Type'
C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
`_imp__PyClass_Type'
C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
`_imp__PyCFunction_Type'
....

Since I'm new to compiling Qt with mingw and completely new to python,
I was hoping for tips on why I'm getting these errors. If anyone has
a better suggestion for a forum/mailing list then please let me know.

Thanks,
Jeff
 
D

Diez B. Roggisch

Jeff said:
Hello,

I'm creating an application using Qt (4.4 Beta atm). I have pretty
close to zero experience with Python (consisting of installing the
Python interpreter, downloading a python programming and executing it
on the command-line).

I would like to invoke a Python script from my C++ Qt program and
capture its output as a C++ structure. It seems that PythonQt might
be suitable for my needs.

Being a Qt program, I want this thing to be cross-platform. I'm
having trouble getting things set up in Windows. Has anyone had any
experience with this?

I've built Qt from source using the mingw32 compiler. I installed
Python 2.5 binary. I am trying to build PythonQt from source. As per
http://pythonqt.sourceforge.net/#Building it says I need a "developer
installation" of Python containing the header files and the library
files. When I look at my system after installing the Python 2.5
binary, I can see I have header files (C:\Python25\include), a 199k
python25.lib (C:\Python25\libs) and a 2MB python25.dll
(C:\Windows\System32\). Have I got what I need?

I have tried to set up my symbols (PYTHON_PATH, PYTHON_LIB,
PYTHONQT_ROOT). I generate the Makefile (using qmake) and it starts
to build but then it fails:

g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -shared
-Wl,--out-implib,lib\libPythonQt.a -o lib\PythonQt.dll
object_script.PythonQt.Debug -L"c:\Qt\4.4.0-beta1\lib"
"c:\Python25\libs"/python25.lib -lQtGuid4 -lQtCored4
./debug\PythonQt.o: In function `ZN8PythonQtC2Ei':
C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
`_imp__Py_NoSiteFlag'
./debug\PythonQt.o: In function `ZN8PythonQtC1Ei':
C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
`_imp__Py_NoSiteFlag'
./debug\PythonQt.o: In function `ZN15PythonQtPrivate11wrapQObjectEP7QObject':
C:/PythonQt-1.0/src/PythonQt.cpp:256: undefined reference to
`_imp___Py_NoneStruct'
C:/PythonQt-1.0/src/PythonQt.cpp:257: undefined reference to
`_imp___Py_NoneStruct'
./debug\PythonQt.o: In function `ZN15PythonQtPrivate7wrapPtrEPvRK10QByteArray':
C:/PythonQt-1.0/src/PythonQt.cpp:281: undefined reference to
`_imp___Py_NoneStruct'
C:/PythonQt-1.0/src/PythonQt.cpp:282: undefined reference to
`_imp___Py_NoneStruct'
./debug\PythonQt.o: In function
`ZN8PythonQt13introspectionEP7_objectRK7QStringNS_10ObjectTypeE':
C:/PythonQt-1.0/src/PythonQt.cpp:620: undefined reference to
`_imp__PyClass_Type'
C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
`_imp__PyClass_Type'
C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
`_imp__PyCFunction_Type'
...

Since I'm new to compiling Qt with mingw and completely new to python,
I was hoping for tips on why I'm getting these errors. If anyone has
a better suggestion for a forum/mailing list then please let me know.


A few of suggestions:

- take this to the PyQt mailing list
(http://www.riverbankcomputing.com/mailman/listinfo/pyqt)

- you only *need* pyqt if what you want to do in python has really to
deal with Qt-objects - maybe "simple" embedding is enough for your needs

- I don't see why you need to compile PyQt yourself at all - are you
sure you can't use the stock PyQt for windows? What makes you believe
you really need this to be self-compiled?

Diez
 
M

Martin v. Löwis

Since I'm new to compiling Qt with mingw and completely new to python,
I was hoping for tips on why I'm getting these errors. If anyone has
a better suggestion for a forum/mailing list then please let me know.

These symbols are all from pythonxy.dll. You need to add the
corresponding import library (libpythonxy.a/pythonxy.lib) into
the linker line, using a -l option.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top