Lazarus
Programming => Widgetset => QT => Topic started by: Fred vS on February 05, 2013, 10:49:05 pm
-
Hello everybody ;)
It is maybe a strange question, but could it be possible to load Qt dynamically ?
I do not talk about the conversion of qt4.pas into dyn_qt4.pas ( easy 8-) ) but after that at init of your prog you must specify where are the qt4pas libraries... and that is the question : is it possible ?
EDIT : ( easy 8-) )
Hum, not so easy, more than hundreds procedures :-X
-
the problem with qt is that it is a c++ library and does not have a plain C header aka flat header. QT4Pas flats out the object of the qt library to that c header which is then used by your application the problem is not to make those 100 function load dynamicaly the problem is to create a qt4pas dll that will load dynamically the required dlls and that requires c programming not pascal.
I do not know if it possible or how easy it will be but I guess if it was easy to do then it would have been done by the author in the first place instead of static linking.
Let me say at this point that I know less than nothing regarding c programming so I really hope that the swig extension to create mapping for free pascal takes some momentum. I'm sure to use if it does after I find out how to use it :-[
-
qt4pas dll that will load dynamically the required dlls
Yes, it is what i fear :-[
It was too easy to only load libQt4Pas.so dynamically :'(
-
After thinking, it must be possible to load dynamically libQt4Pas.so.
Of course if they are some lib missing, libQt4Pas.so gonna complain but it is the same for all dynamically loaded libraries.
Ok, if i have some free time, gonna try the conversion into dyn_qt4.pas.
EDIT Oops, it is not hundreds but thousands of procedures :o
No, sorry, i never can find that free time... :-[
-
After thinking, it must be possible to load dynamically libQt4Pas.so.
Of course if they are some lib missing, libQt4Pas.so gonna complain but it is the same for all dynamically loaded libraries.
Ok, if i have some free time, gonna try the conversion into dyn_qt4.pas.
Yep, in theory, I suppose you could load the dependent .sos using Pascal... in practice, there's a lot of them so you'd have to have some way to automatically parse dependencies, load them etc.
No idea if this is simple or difficult...
-
I don't understand why you want to do this.
If your libraries are not in the standard paths on Linux, you can write a start script for your application setting:
#/bin/sh
export LD_LIBRARY_PATH=<Your Path To Libs>
MyApplication
-
@ BigChimp and Theo : many thanks for answers. ::)
I don't understand why you want to do this.
To reduce the lots of "I can not use your program, i get a message "Qt4pas is missing..."
or
Where must i install qt4pas libraries?
or
Where can i find qt4pas lib ?
or
The version of Qt4pas in not compatible...
Etc...
-
It's an installation problem, no?
-
I'm also fan of dynamic libs loading because my applications are mostly "out of the box" for simple users. User just download it and run. On windows it is easy to deploy, just put all libs in application dir, but on linux it is more complicated. On linux solutions is create distro package (deb, rpm) with dependencies or prepare sh script which temporary add own path to library path. Anyway, I would like to have dynamic QT ;)
-
It's an installation problem, no?
Of course, but like Dibo said, users (and me too) do not like to be obliged to install static libraries, you must have root permission, it change your /usr/lib content,...etc.
And with dynamic load of Qt, bye-bye all that problems.
-
And with dynamic load of Qt, bye-bye all that problems.
It think a start script would be much easier.
export LD_LIBRARY_PATH=<Your Path To Libs>
-
Hello everybody. ;)
One more problem with static libraries :
How can i do for loading qt4pas libraries with multi-arch system ?
I have enabled multi-arch system on my Ubuntu 13.04 64 bit system.
Perfect, i can load all the 32 bit applications i have but only one do not want to load : the one using qt4pas libraries, i get :
error while loading shared libraries: libQt4Pas.so.5: cannot open shared object file: No such file or directory
Of course, the static installed libQt4Pas.so.5 lib is 64 bit and not compatible with the 32 bit applications. :-[
-
I have no experience with multiarch, however I found this: http://askubuntu.com/questions/145688/multi-architectures-and-their-binaries (http://askubuntu.com/questions/145688/multi-architectures-and-their-binaries)
So you should download the 32-bit version from here: http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html (http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html)
and copy it (as "sudo") to the path described in the first link, probably: /usr/lib/i386-linux-gnu/ - if you have it there :)
Maybe you should create the symlinks too, I mean finally you should have:
/usr/lib/i386-linux-gnu/libQt4Pas.so
/usr/lib/i386-linux-gnu/libQt4Pas.so.5
/usr/lib/i386-linux-gnu/libQt4Pas.so.5.2
/usr/lib/i386-linux-gnu/libQt4Pas.so.5.2.5
-
@ Blaazen : many thanks ( but i have already do it :-X ).
With libQt4pas.o 32 bits in /lib/i386-linux-gnu i get that message :
/usr/lib/codetyphon/fpc/bin/x86_64-linux/i386-linux-ld: warning: link.res contains output sections; did you forget -T?
/usr/lib/codetyphon/fpc/bin/x86_64-linux/i386-linux-ld: warning: libGL.so.1, needed by /usr/lib/i386-linux-gnu//libQtWebKit.so.4, not found (try using -rpath or -rpath-link)
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glGetDoublev'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXCreatePixmap'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXMakeCurrent'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glClearDepth'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glClearIndex'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glIsTexture'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXCreateGLXPixmap'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glMatrixMode'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glHint'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glClearColor'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPopClientAttrib'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glLineWidth'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTranslated'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPushClientAttrib'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glEndList'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDepthRange'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glFlush'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glGetTexImage'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glVertexPointer'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexImage1D'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDepthFunc'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDrawElements'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glDisableClientState'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glLoadIdentity'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glColorMask'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glFrontFace'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glOrtho'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glIsEnabled'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXChooseFBConfig'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetConfig'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXQueryVersion'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glVertex2d'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPointSize'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGenTextures'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPolygonMode'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glViewport'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glCompressedTexImage2D'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetString'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexGeni'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDepthMask'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPopAttrib'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetCurrentDrawable'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetVisualFromFBConfig'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glVertex2f'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXUseXFont'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glDrawPixels'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glPolygonOffset'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glTexParameterf'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glEnable'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glClear'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glScissor'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetCurrentContext'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXQueryExtensionsString'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glReadPixels'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetBooleanv'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexCoord2f'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXQueryServerString'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glStencilMask'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPushMatrix'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glNewList'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glBitmap'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glDrawBuffer'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXSwapBuffers'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glStencilFunc'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXDestroyGLXPixmap'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetFloatv'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glTexSubImage2D'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glTexParameteri'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetFBConfigAttrib'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glStencilOp'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glEnableClientState'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glCompressedTexSubImage2D'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXIsDirect'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glClearStencil'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexCoord4f'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetTexParameteriv'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glRotatef'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glShadeModel'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetIntegerv'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexEnvf'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glFinish'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glGetTexLevelParameteriv'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXChooseVisual'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glEnd'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXDestroyPixmap'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glAlphaFunc'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPushAttrib'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDisable'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glCopyTexSubImage2D'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXWaitX'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glPixelStorei'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glBegin'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPopMatrix'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glLoadMatrixd'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXCreateContext'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexCoordPointer'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDeleteTextures'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetError'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glTexImage2D'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glTexGenfv'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glCopyTexImage2D'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glColor4f'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glBlendFunc'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glDrawArrays'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXDestroyContext'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXQueryExtension'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glLoadMatrixf'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glIndexi'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glBindTexture'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glCullFace'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glPixelTransferi'
/usr/lib/i386-linux-gnu//libQtWebKit.so.4: undefined reference to `glGetTexParameterfv'
/usr/lib/i386-linux-gnu//libQtOpenGL.so.4: undefined reference to `glXGetClientString'
Error: Error while linking
There were 1 errors compiling module, stopping
PS : Cross-compiling with GTK2 widgetset : no problem, compile ok and running 32 bit app ok as well. :-[
-
Hmm, it seems you are missing more 32 bit dependencies.
-
@ Blaazen : many thanks ( but i have already do it :-X ).
With libQt4pas.o 32 bits in /lib/i386-linux-gnu i get that message :
/usr/lib/codetyphon/fpc/bin/x86_64-linux/i386-linux-ld: warning: link.res contains output sections; did you forget -T?
/usr/lib/codetyphon/fpc/bin/x86_64-linux/i386-linux-ld: warning: libGL.so.1, needed by /usr/lib/i386-linux-gnu//libQtWebKit.so.4, not found
....
...
Error: Error while linking
There were 1 errors compiling module, stopping
PS : Cross-compiling with GTK2 widgetset : no problem, compile ok and running 32 bit app ok as well. :-[
1st error message says all: You need libQtOpenGL library. libQtWebKit won't link because of that (looks like a ld/packager dependencies problem, because usually libQtOpenGL does not need to be installed).
-
BTW: Anyone know what is a road map of Qt4Pas?
I'm wondering if it is possible to use Qt4Pas to write complex QT application (without LCL). Can Qt4Pas be compared to e.g. python Qt wrapper? It would be nice to use Lazarus and Qt4Pas as replacement of Qt Creator to write native QT applications (like FPC JVM for native android apps). Visual designer could be added in future. I wrote one project in QT Creator, QT widgets are just amazing. FPC + Qt widgets = awesome :D
Main feature for Qt4Pas is that it should be splitted for Qt modules. For example, now simple "hello world" require all QT modules (like webkit, network etc)
-
BTW: Anyone know what is a road map of Qt4Pas?
I'm wondering if it is possible to use Qt4Pas to write complex QT application (without LCL). Can Qt4Pas be compared to e.g. python Qt wrapper? It would be nice to use Lazarus and Qt4Pas as replacement of Qt Creator to write native QT applications (like FPC JVM for native android apps). Visual designer could be added in future. I wrote one project in QT Creator, QT widgets are just amazing. FPC + Qt widgets = awesome :D
Main feature for Qt4Pas is that it should be splitted for Qt modules. For example, now simple "hello world" require all QT modules (like webkit, network etc)
Fell free to create patches and modularized qt C bindings.