PDA

View Full Version : Help: Qt crashed when linked against libSoQt



jwieland
3rd April 2009, 21:31
Hi all,

I've been scratching my head for this mysterious problem and hope you experts can help me out:

I use Qt-4.4.3 and am trying to build a gui that links with Coin3d. I tried several times the example I got off this forum and every time I ran the program it crashed. Finally i decided to start small and build one gui that just has one little label and take out all Coin3d stuffs. Good, it ran fine. I then just added libSoQt into the list of libraries that it links against (with not a single reference to SoQt in the program, just linked against it), and guess what: it crashed!??

I thought that Coin and SoQt weren't installed properly on my machine so I wiped out both of them, reinstalled a new one to make sure that I have everything properly installed (btw, I have Coin 2.5 and SoQt 1.4.1). Sure enough, the program still crashes if I link it against libSoQt.

Any idea what might be the problem here?

Thank you so much for all your help.

talk2amulya
3rd April 2009, 22:13
u say it crashes..which means it builds properly..are you able to debug the application?if not, try to debug and see where exactly is the problem..since u say it links properly and the application doesnt contain any reference to the library itself, it seems very uncanny it crashes like that..debuggin is the answer

andy.fillebrown
4th April 2009, 14:03
I had a similar issue when using Coin and SoQt on Windows and eventually identified it as a ANSI/Unicode character issue. The Systems In Motion libraries were built with ANSI characters, and my app was using Unicode characters. Maybe this is not the issue you're running into, but it might be and is worth checking out if you're not sure.

jwieland
6th April 2009, 21:00
Hi Andy,

Could you elaborate on your solution? How did you set the encoding method to ANSI? Is there anyway I can check to see that applies to my case?

Thank you very much.

jwieland
6th April 2009, 21:12
Hi Andy,

I checked the encoding values in QCoreApplication and see only 2 possibles: CodecForTr and Unicode UTF8. What value did you use to set the encoding to Ansi?

Thank you very much for your help.

wysota
6th April 2009, 21:12
Did you check if the Qt coin3D library was compiled against the same version and mode (release/debug) of Qt? Check what ldd returns on both sets of libraries (especially libSoQt).

jwieland
6th April 2009, 21:30
u say it crashes..which means it builds properly..are you able to debug the application?if not, try to debug and see where exactly is the problem..since u say it links properly and the application doesnt contain any reference to the library itself, it seems very uncanny it crashes like that..debuggin is the answer

I am using Qt 4.4.3, which does not support debug option. There is no core file generated. And yes, it built properly.

Thanks for your help.

jwieland
6th April 2009, 21:35
Did you check if the Qt coin3D library was compiled against the same version and mode (release/debug) of Qt? Check what ldd returns on both sets of libraries (especially libSoQt).

YEs, the look proper to me. Here is ldd agains libCoin.so:
linux-gate.so.1 => (0x00543000)
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00110000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00212000)
libbz2.so.1 => /lib/libbz2.so.1 (0x00331000)
libz.so.1 => /lib/libz.so.1 (0x0017b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00285000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x0018f000)
libdl.so.2 => /lib/libdl.so.2 (0x001be000)
libpthread.so.0 => /lib/libpthread.so.0 (0x001c3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00342000)
libm.so.6 => /lib/libm.so.6 (0x001dd000)
libc.so.6 => /lib/libc.so.6 (0x00e01000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00318000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb7eed000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00434000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x00206000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00fdc000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x0020b000)
libdrm.so.2 => /usr/lib/libdrm.so.2 (0x00326000)
libexpat.so.1 => /lib/libexpat.so.1 (0x00488000)
/lib/ld-linux.so.2 (0x00465000)
libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0x00210000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00444000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00460000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x004af000)

And here is ldd against libSoQt:
linux-gate.so.1 => (0x00d13000)
libqt-mt.so.3 => /usr/lib/qt-3.3/lib/libqt-mt.so.3 (0x00d14000)
libXi.so.6 => /usr/lib/libXi.so.6 (0x001f7000)
libCoin.so.40 => /usr/local/lib/libCoin.so.40 (0x0705a000)
libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00110000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00791000)
libbz2.so.1 => /lib/libbz2.so.1 (0x00c40000)
libz.so.1 => /lib/libz.so.1 (0x0017b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00200000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x0037c000)
libdl.so.2 => /lib/libdl.so.2 (0x003f4000)
libpthread.so.0 => /lib/libpthread.so.0 (0x0018f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0057d000)
libm.so.6 => /lib/libm.so.6 (0x001a9000)
libc.so.6 => /lib/libc.so.6 (0x00804000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x001d2000)
libmng.so.1 => /usr/lib/libmng.so.1 (0x00293000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00302000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00c17000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x001e0000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0x001e9000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x00ad9000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00369000)
libXft.so.2 => /usr/lib/libXft.so.2 (0x00325000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00339000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x0066f000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00349000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x003ab000)
libXxf86vm.so.1 => /usr/lib/libXxf86vm.so.1 (0x001f0000)
libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x00351000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x00354000)
libdrm.so.2 => /usr/lib/libdrm.so.2 (0x00359000)
libexpat.so.1 => /lib/libexpat.so.1 (0x003c5000)
/lib/ld-linux.so.2 (0x00465000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x003f9000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00363000)
libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0x001f5000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00432000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00b94000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00c04000)

wysota
6th April 2009, 22:02
I am using Qt 4.4.3, which does not support debug option. There is no core file generated. And yes, it built properly.

Dumping core is a feature of the operating system, not of Qt.


YEs, the look proper to me.
Well, it looks wrong to me :)


And here is ldd against libSoQt:
(...)
libqt-mt.so.3 => /usr/lib/qt-3.3/lib/libqt-mt.so.3 (0x00d14000)

This is Qt3 not Qt4. Linking both will lead to a crash because of symbol name clashes. And it wouldn't make sense to use both Qt3 and Qt4 in a single app anyway.

lni
6th April 2009, 22:05
I don't understand.

Isn't this Coin3D a Mercury software of Open Inventor? If not, how can Mercury sell Coin3D for money? Not only they charge the development license, but also the user license....

All the classes in the examples are the same as those in Open Inventor! But does Coin3D have LDM (large data model/management)?

jwieland
7th April 2009, 16:27
Well, it looks wrong to me :)

This is Qt3 not Qt4. Linking both will lead to a crash because of symbol name clashes. And it wouldn't make sense to use both Qt3 and Qt4 in a single app anyway.

This is Qt 4.4.3 with Qt3 support. It is like that by default and I don't know how to make it behave differently. Anyway, I think you are chasing a wild guess because it works perfectly fine if I don't link against libSoQt. If I do even just link against the library (did not make any reference call to that lib inside the program), it crashes!

jwieland
7th April 2009, 16:31
I don't understand.

Isn't this Coin3D a Mercury software of Open Inventor? If not, how can Mercury sell Coin3D for money? Not only they charge the development license, but also the user license....

All the classes in the examples are the same as those in Open Inventor! But does Coin3D have LDM (large data model/management)?

Thanks for your lecture! Coin3D is a third party library developed by coin3d .org. It is an open source community who develops code for non commercial purposes. Their website:

http://www.coin3d.org

talk2amulya
7th April 2009, 18:53
This is Qt 4.4.3 with Qt3 support. It is like that by default and I don't know how to make it behave differently. Anyway, I think you are chasing a wild guess because it works perfectly fine if I don't link against libSoQt. If I do even just link against the library (did not make any reference call to that lib inside the program), it crashes!
what do you mean Qt 4.4.3 with Qt 3 support? 3.3 must be a version of Qt initially installed in your system..and then u installed 4.4.3..now when u built SoQt, it got built against Qt 3..ur path variable must have path to Qt 3 instead of 4.4.3..thats why u see dependency to Qt 3 in the built library..why dont u put the path to Qt 4.4.3 in PATH instead of Qt 3..build SoQt again and link again and see the output..

wysota
7th April 2009, 22:11
This is Qt 4.4.3 with Qt3 support.
You are using Qt4 but libSoQt is linked against Qt3 and they don't go together well.


If I do even just link against the library (did not make any reference call to that lib inside the program), it crashes!

Yes, exactly. That's because symbols from Qt3 get mixed up with symbols from Qt4 and the application goes wild.

jwieland
8th April 2009, 18:12
You are using Qt4 but libSoQt is linked against Qt3 and they don't go together well.



Yes, exactly. That's because symbols from Qt3 get mixed up with symbols from Qt4 and the application goes wild.

Wysota,

I tried adding Qt4 to PATH, no avail. In a desperate move, I uninstalled Qt3 and left only Qt4 in the system, no good. Now there is one catch here, though, and that is if I want SoQt support than it comes with Qt3. I hand installed Coin and SoQt and pointed the program to link against the new SoQt lib. No good either!

Btw, I am not convinced that what you said was the cause. If the symbol is mixed up, how can it run fine without linking to SoQt?

wysota
8th April 2009, 22:20
I think you don't understand me. libSoQt is linked against Qt3 and can't work with Qt4. You can do anything you want to your computer but this won't make libSoQt work with your Qt4 based application. If you want to use Coin3D with Qt4, you need a version of its library that is linked against Qt4. If you run ldd on it, there musn't be an entry "libqt-mt.so" there. Now if you link your Qt4 application against libSoQt one of two things happens.

1. Either Qt4 from your application gets loaded before Qt3 from libSoQt gets loaded and your application find all the symbols it needs and they act as they are supposed to and the application has a good chance to work fine until you try to do something with Coin3D.

2. Or Qt3 gets loaded before Qt4. In that case The linker resolves all symbols that it needs using Qt3 library. Among those symbols there is the QApplication class. Let's consider it as the example. The linker looks at the list of symbols and says "hey, the application needs the "QApplication" symbol and the library exports it" and so it resolves the symbol using QApplication from Qt3. Then Qt4 gets loaded and the linker again tries to resolve all symbols that remain unresolved. It sees QApplication from Qt4 but it says "Oh, the application needs QApplication symbol but I already resolved it using one of the earlier libraries so I don't have to do it again". Now the problem is QApplication from Qt3 works in a completely different way than QApplication from Qt4. And that causes your application to crash because the code is corrupted.

If that's not enough to convince you, please read about dynamic linker and how it works. If you're still not convinced write to authors of libSoQt, send them the output of ldd and ask if this library works with your Qt4 based app "with Qt3 support". If that's still not enough, mail Linus Torvalds and ask him.

Or you could just trust me and find a version of Coin3D that works with Qt4.

jwieland
9th April 2009, 16:08
I think you don't understand me. libSoQt is linked against Qt3 and can't work with Qt4. You can do anything you want to your computer but this won't make libSoQt work with your Qt4 based application. If you want to use Coin3D with Qt4, you need a version of its library that is linked against Qt4. If you run ldd on it, there musn't be an entry "libqt-mt.so" there. Now if you link your Qt4 application against libSoQt one of two things happens.

Or you could just trust me and find a version of Coin3D that works with Qt4.

Hi Wysota,

Thanks very much for your clarification. I understand and trust you now. Completely! Sorry for being such a pain. One question I would like to ask if you don't mind: Is there a Coin3d and SoQt version that would work with Qt4 that you know of? Could you provide a pointer?

Again, thank you so much and sorry for all the misunderstanding.

wysota
9th April 2009, 17:31
I have no idea.

jwieland
14th April 2009, 23:17
Following Wyota's advice, I found the answer to this mystery: the libSoQt i had there was built against Qt3, not Qt4. To solve this problem, I had to uninstall Qt3, grab the source code of SoQt 1.4.1, and built it against Qt4. There was problems building it but I was able to build it anyway.

Again, credit goes to wyota. Thanks.