[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Need Help Building PythonQt on Windows

Jeff Schiller

3/9/2008 5:27:00 PM

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

Diez B. Roggisch

3/9/2008 5:36:00 PM

0

Jeff Schiller schrieb:
> 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... 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/lis...)

- 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

Jeff Schiller

3/9/2008 5:44:00 PM

0

I said "PythonQt" not PyQt. That's an important distinction, I think :)

See http://pythonqt.source...

Regards,
Jeff

On 3/9/08, Diez B. Roggisch <deets@nospam.web.de> wrote:
> Jeff Schiller schrieb:
>
> > 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.source...#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/lis...)
>
> - 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
>
> --
> http://mail.python.org/mailman/listinfo/p...
>

Diez B. Roggisch

3/9/2008 7:31:00 PM

0

Jeff Schiller schrieb:
> I said "PythonQt" not PyQt. That's an important distinction, I think :)
>
> See http://pythonqt.source...

It sure is. Sorry, didn't realize the difference.

Diez

Martin v. Loewis

3/9/2008 10:35:00 PM

0

> 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