Discussion:
Which Library Files for these unreferenced functions?
timlee126
2009-02-01 04:45:15 UTC
Permalink
Hi,
I got the following error while building my project. I was wondering
which library files I should specify to my project? I can only guess
they are from gtk. Generally how can one know which library file for a
given unreferenced function? Thanks in advance!

/home/ting/opencv/helloworld_linux/main.c||In function `main':|
/home/ting/opencv/helloworld_linux/main.c|15|warning: unused variable
`text_size'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0x7a)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0xcd)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0xe2)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0xf9)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0x102)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function
`icvOnKeyPress(_GtkWidget*, _GdkEventKey*, void*)':|
(.text+0x11d)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x189)||undefined reference to `g_timeout_add'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x1a1)||undefined reference to `gtk_main_iteration_do'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x1ec)||undefined reference to `g_source_remove'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x1f9)||undefined reference to `g_thread_self'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x216)||undefined reference to `g_get_current_time'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x228)||undefined reference to `g_time_val_add'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x22e)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x259)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x26a)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x2b7)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvWaitKey':|
(.text+0x2e4)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x614)||undefined reference to `gtk_range_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x623)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x632)||undefined reference to `gtk_range_set_value'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x689)||undefined reference to `g_thread_self'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x699)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x6b0)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x6c1)||undefined reference to `g_thread_self'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x6d5)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvSetTrackbarPos':|
(.text+0x6f0)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x7c5)||undefined reference to `gtk_range_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x7d7)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x7e6)||undefined reference to `gtk_range_set_value'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x806)||undefined reference to `gtk_object_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x815)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x855)||undefined reference to `gtk_signal_connect_full'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x85a)||undefined reference to `gtk_widget_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x86c)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x874)||undefined reference to `gtk_widget_queue_resize'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x929)||undefined reference to `g_thread_self'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x93d)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x958)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x971)||undefined reference to `g_thread_self'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x985)||undefined reference to `g_threads_got_initialized'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0x9a0)||undefined reference to `g_thread_functions_for_glib_use'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa31)||undefined reference to `gtk_hbox_new'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa3c)||undefined reference to `gtk_label_new'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa56)||undefined reference to `gtk_hscale_new_with_range'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa5e)||undefined reference to `gtk_range_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa6d)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa7d)||undefined reference to `gtk_range_set_update_policy'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa82)||undefined reference to `gtk_scale_get_type'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xa93)||undefined reference to `g_type_check_instance_cast'|
/usr/lib/libhighgui.a(window_gtk.o)||In function `cvCreateTrackbar':|
(.text+0xaa3)||undefined reference to `gtk_scale_set_digits'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 1 warnings ===|


------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com
Peter Eisenlohr
2009-02-01 11:36:06 UTC
Permalink
Post by timlee126
I got the following error while building my project. I was wondering
which library files I should specify to my project? I can only guess
they are from gtk. Generally how can one know which library file for a
given unreferenced function? Thanks in advance!
You are guessing right. There are undefined symbols both from GTK and
from GLIB (which is a separate part of GLIB/GTK).

Try 'gtk-config --libs' -- it gives you the linker flags and a list of
libraries you have to link against.

Peter

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com
Somebody
2009-02-01 18:06:23 UTC
Permalink
Thank you!

I now get a Segmentation fault problem while running the executable, after compiling with:  gcc -Wall -g `pkg-config --cflags --libs opencv` `gtk-config --cflags --libs` -o helloworld main.c.

Examination of the core file gives the information:
Can't read pathname for load map: Input/output error
Reading symbols from /usr/lib/libcxcore.so.1...done.
Loaded symbols for /usr/lib/libcxcore.so.1
Reading symbols from /usr/lib/libcv.so.1...done.
Loaded symbols for /usr/lib/libcv.so.1
Reading symbols from /usr/lib/libhighgui.so.1...done.
Loaded symbols for /usr/lib/libhighgui.so.1
Reading symbols from /usr/lib/libcvaux.so.1...done.
Loaded symbols for /usr/lib/libcvaux.so.1
Reading symbols from /usr/lib/libml.so.1...done.
Loaded symbols for /usr/lib/libml.so.1
Reading symbols from /usr/lib/libgtk-1.2.so.0...done.
Loaded symbols for /usr/lib/libgtk-1.2.so.0
Reading symbols from /usr/lib/libgdk-1.2.so.0...done.
Loaded symbols for /usr/lib/libgdk-1.2.so.0
Reading symbols from /usr/lib/libgmodule-1.2.so.0...done.
Loaded symbols for /usr/lib/libgmodule-1.2.so.0
Reading symbols from /usr/lib/libglib-1.2.so.0...done.
Loaded symbols for /usr/lib/libglib-1.2.so.0
Reading symbols from /lib/tls/i686/cmov/libdl.so.2...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libdl-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libdl.so.2
Reading symbols from /usr/lib/libXi.so.6...done.
Loaded symbols for /usr/lib/libXi.so.6
Reading symbols from /usr/lib/libXext.so.6...done.
Loaded symbols for /usr/lib/libXext.so.6
Reading symbols from /usr/lib/libX11.so.6...done.
Loaded symbols for /usr/lib/libX11.so.6
Reading symbols from /lib/tls/i686/cmov/libm.so.6...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libm-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libm.so.6
Reading symbols from /lib/tls/i686/cmov/libc.so.6...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libc-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /usr/lib/libgomp.so.1...done.
Loaded symbols for /usr/lib/libgomp.so.1
Reading symbols from /lib/tls/i686/cmov/libpthread.so.0...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libpthread-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libpthread.so.0
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /usr/lib/libgthread-2.0.so.0...done.
Loaded symbols for /usr/lib/libgthread-2.0.so.0
Reading symbols from /lib/tls/i686/cmov/librt.so.1...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/librt-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/librt.so.1
Reading symbols from /usr/lib/libgtk-x11-2.0.so.0...done.
Loaded symbols for /usr/lib/libgtk-x11-2.0.so.0
Reading symbols from /usr/lib/libgdk-x11-2.0.so.0...done.
Loaded symbols for /usr/lib/libgdk-x11-2.0.so.0
Reading symbols from /usr/lib/libatk-1.0.so.0...done.
Loaded symbols for /usr/lib/libatk-1.0.so.0
Reading symbols from /usr/lib/libpangoft2-1.0.so.0...done.
Loaded symbols for /usr/lib/libpangoft2-1.0.so.0
Reading symbols from /usr/lib/libpangocairo-1.0.so.0...done.
Loaded symbols for /usr/lib/libpangocairo-1.0.so.0
Reading symbols from /usr/lib/libgio-2.0.so.0...done.
Loaded symbols for /usr/lib/libgio-2.0.so.0
Reading symbols from /usr/lib/libcairo.so.2...done.
Loaded symbols for /usr/lib/libcairo.so.2
Reading symbols from /usr/lib/libpango-1.0.so.0...done.
Loaded symbols for /usr/lib/libpango-1.0.so.0
Reading symbols from /usr/lib/libfreetype.so.6...done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libfontconfig.so.1...done.
Loaded symbols for /usr/lib/libfontconfig.so.1
Reading symbols from /usr/lib/libgdk_pixbuf-2.0.so.0...done.
Loaded symbols for /usr/lib/libgdk_pixbuf-2.0.so.0
Reading symbols from /usr/lib/libgobject-2.0.so.0...done.
Loaded symbols for /usr/lib/libgobject-2.0.so.0
Reading symbols from /usr/lib/libgmodule-2.0.so.0...done.
Loaded symbols for /usr/lib/libgmodule-2.0.so.0
Reading symbols from /usr/lib/libglib-2.0.so.0...done.
Loaded symbols for /usr/lib/libglib-2.0.so.0
Reading symbols from /usr/local/lib/libpng12.so.0...done.
Loaded symbols for /usr/local/lib/libpng12.so.0
Reading symbols from /usr/local/lib/libjpeg.so.62...done.
Loaded symbols for /usr/local/lib/libjpeg.so.62
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /usr/lib/libtiff.so.4...done.
Loaded symbols for /usr/lib/libtiff.so.4
Reading symbols from /usr/lib/libjasper.so.1...done.
Loaded symbols for /usr/lib/libjasper.so.1
Reading symbols from /usr/lib/i686/cmov/libavformat.so.52...done.
Loaded symbols for /usr/lib/i686/cmov/libavformat.so.52
Reading symbols from /usr/lib/i686/cmov/libavcodec.so.51...done.
Loaded symbols for /usr/lib/i686/cmov/libavcodec.so.51
Reading symbols from /usr/lib/libraw1394.so.8...done.
Loaded symbols for /usr/lib/libraw1394.so.8
Reading symbols from /usr/lib/libtheora.so.0...done.
Loaded symbols for /usr/lib/libtheora.so.0
Reading symbols from /usr/lib/libvorbisenc.so.2...done.
Loaded symbols for /usr/lib/libvorbisenc.so.2
Reading symbols from /usr/lib/i686/cmov/libavutil.so.49...done.
Loaded symbols for /usr/lib/i686/cmov/libavutil.so.49
Reading symbols from /usr/lib/libvorbis.so.0...done.
Loaded symbols for /usr/lib/libvorbis.so.0
Reading symbols from /usr/lib/libogg.so.0...done.
Loaded symbols for /usr/lib/libogg.so.0
Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.8.90.so...done.
done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/libXau.so.6...done.
Loaded symbols for /usr/lib/libXau.so.6
Reading symbols from /usr/lib/libxcb-xlib.so.0...done.
Loaded symbols for /usr/lib/libxcb-xlib.so.0
Reading symbols from /usr/lib/libxcb.so.1...done.
Loaded symbols for /usr/lib/libxcb.so.1
Reading symbols from /usr/lib/libXcomposite.so.1...done.
Loaded symbols for /usr/lib/libXcomposite.so.1
Reading symbols from /usr/lib/libXdamage.so.1...done.
Loaded symbols for /usr/lib/libXdamage.so.1
Reading symbols from /usr/lib/libXfixes.so.3...done.
Loaded symbols for /usr/lib/libXfixes.so.3
Reading symbols from /usr/lib/libXrender.so.1...done.
Loaded symbols for /usr/lib/libXrender.so.1
Reading symbols from /usr/lib/libXinerama.so.1...done.
Loaded symbols for /usr/lib/libXinerama.so.1
Reading symbols from /usr/lib/libXrandr.so.2...done.
Loaded symbols for /usr/lib/libXrandr.so.2
Reading symbols from /usr/lib/libXcursor.so.1...done.
Loaded symbols for /usr/lib/libXcursor.so.1
Reading symbols from /lib/libselinux.so.1...done.
Loaded symbols for /lib/libselinux.so.1
Reading symbols from /usr/lib/libpixman-1.so.0...done.
Loaded symbols for /usr/lib/libpixman-1.so.0
Reading symbols from /usr/lib/libxcb-render-util.so.0...done.
Loaded symbols for /usr/lib/libxcb-render-util.so.0
Reading symbols from /usr/lib/libxcb-render.so.0...done.
Loaded symbols for /usr/lib/libxcb-render.so.0
Reading symbols from /usr/lib/libexpat.so.1...done.
Loaded symbols for /usr/lib/libexpat.so.1
Reading symbols from /lib/libpcre.so.3...done.
Loaded symbols for /lib/libpcre.so.3
Reading symbols from /usr/lib/libgsm.so.1...done.
Loaded symbols for /usr/lib/libgsm.so.1
Reading symbols from /usr/lib/libXdmcp.so.6...done.
Loaded symbols for /usr/lib/libXdmcp.so.6
Reading symbols from /lib/tls/i686/cmov/libnss_compat.so.2...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libnss_compat-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libnss_compat.so.2
Reading symbols from /lib/tls/i686/cmov/libnsl.so.1...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libnsl-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libnsl.so.1
Reading symbols from /lib/tls/i686/cmov/libnss_nis.so.2...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libnss_nis-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libnss_nis.so.2
Reading symbols from /lib/tls/i686/cmov/libnss_files.so.2...Reading symbols from /usr/lib/debug/lib/tls/i686/cmov/libnss_files-2.8.90.so...done.
done.
Loaded symbols for /lib/tls/i686/cmov/libnss_files.so.2
Core was generated by `./helloworld'.
Program terminated with signal 11, Segmentation fault.
[New process 9452]
#0  0xb7028485 in g_type_check_class_cast () from /usr/lib/libgobject-2.0.so.0
(gdb)

How can I solve it?

--- On Sun, 2/1/09, Peter Eisenlohr <***@netcologne.de> wrote:
From: Peter Eisenlohr <***@netcologne.de>
Subject: Re: [OpenCV] Which Library Files for these unreferenced functions?
To: ***@yahoogroups.com
Date: Sunday, February 1, 2009, 6:36 AM
Post by timlee126
I got the following error while building my project. I was wondering
which library files I should specify to my project? I can only guess
they are from gtk. Generally how can one know which library file for a
given unreferenced function? Thanks in advance!
You are guessing right. There are undefined symbols both from GTK and

from GLIB (which is a separate part of GLIB/GTK).



Try 'gtk-config --libs' -- it gives you the linker flags and a list of

libraries you have to link against.



Peter



























[Non-text portions of this message have been removed]


------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com
Peter Eisenlohr
2009-02-02 08:36:54 UTC
Permalink
Post by Somebody
I now get a Segmentation fault problem while running the executable,
after compiling with: gcc -Wall -g `pkg-config --cflags --libs opencv`
`gtk-config --cflags --libs` -o helloworld main.c.
Sorry, never seen that one (am actually developing on Windows, but used
GLIB/GTK on other projects before.

Maybe you could post your code, and test if the segfault also occurs
with a minimal test program (load/display an image).

Peter

------------------------------------

Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-***@yahoogroups.com
Loading...