natty unstable (11.04) compiling error /lib/libglib-2.0.so.0: could not read symbols: Invalid operation

Asked by pippo1985 on 2011-03-18

On compilation i have this error on ubuntu natty

pippo@pippo-acer:~/Scrivania/Collegamento a ardrone/SDK16/Examples/Linux/Navigation/Build$ make
-- Building Ardrone Navigation --
Checking required Ubuntu packages ...
ok.
Building ARDroneTool/Lib
Linking navigation
ld common/mobile_main
/usr/bin/ld: ../../Soft/Build/targets_versions/ardrone_navigation_PROD_MODE_ffmpeg_Intel_Linux_2.6.38-7-generic_GNU_Linux_gcc_4.5.2/ihm/ihm.o: undefined reference to symbol 'g_direct_hash'
/usr/bin/ld: note: 'g_direct_hash' is defined in DSO /lib/libglib-2.0.so.0 so try adding it to the linker command line
/lib/libglib-2.0.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [/home/pippo/ardrone/SDK16/Examples/Linux/Navigation/Build/../../Build/Release/common/mobile_main] Errore 1
make[2]: *** [all] Errore 2
make[1]: *** [build_app] Errore 2
make: *** [ardrone_navigation] Errore 2

can anyone help me?

sorry for my bad english...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
pippo1985
Solved:
2011-03-18
Last query:
2011-03-18
Last reply:
2011-03-18
mycae (mycae) said : #1

you will need to modify the Makefile to add -lglib to your linker arguments (i.e. the gcc call that makes either the lib or the executable file).

pippo1985 (lepitrust) said : #2

i try to add -lglib to Makefile but...

pippo@pippo-acer:~/Scrivania/Collegamento a ardrone/SDK16/Examples/Linux/Navigation/Build$ make
-- Building Ardrone Navigation --
Checking required Ubuntu packages ...
ok.
Building ARDroneTool/Lib
Linking navigation
ld common/mobile_main
/usr/bin/ld: cannot find -lglib
collect2: ld returned 1 exit status
make[3]: *** [/home/pippo/ardrone/SDK16/Examples/Linux/Navigation/Build/../../Build/Release/common/mobile_main] Errore 1
make[2]: *** [all] Errore 2
make[1]: *** [build_app] Errore 2
make: *** [ardrone_navigation] Errore 2

mycae (mycae) said : #3

Ah, sorry, I forgot that the bit before the .so is not a version number per se, but is part of the library name.

So try this:

-lglib-2.0

pippo1985 (lepitrust) said : #4

uff, now is

ld common/mobile_main
/usr/bin/ld: ../../Soft/Build/targets_versions/ardrone_navigation_PROD_MODE_ffmpeg_Intel_Linux_2.6.38-7-generic_GNU_Linux_gcc_4.5.2/ihm/ihm.o: undefined reference to symbol 'gdk_event_get'
/usr/bin/ld: note: 'gdk_event_get' is defined in DSO /usr/lib/libgdk-x11-2.0.so.0 so try adding it to the linker command line
/usr/lib/libgdk-x11-2.0.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [/home/pippo/ardrone/SDK16/Examples/Linux/Navigation/Build/../../Build/Release/common/mobile_main] Errore 1
make[2]: *** [all] Errore 2
make[1]: *** [build_app] Errore 2
make: *** [ardrone_navigation] Errore 2

mycae (mycae) said : #5

So, your original problem is solved. You need to do the same thing

Note the hint is to drop the "lib" from the beginning of the DSO name (in this case libgdk-x11-2.0.so.0), and the .so.x bit at the end.

So, in this case
-lgdk-x11-2.0

There is a pattern here!

pippo1985 (lepitrust) said : #6

so, i add -lglib-2.0, -lgdk-x11-2.0, -lgdk_pixbuf-2.0, -lpango-1.0 and -lgobject-2.0

and finally works!

thanks