Re: [gtk-list] posible error in glib.h ?



On Fri, 8 Oct 1999, Simon Gornall wrote:

> I have to compile a Linux GTK-based program on Solaris 2.6
> and since I don't want to install gtk/glib on every sun box
> here, I wanted to link statically to GTK/Glib.
> 
> I made glib and gtk and moved *so* from the /opt/gtk/lib
> directory into /opt/gtk/lib/shared/ so that the program 
> would link statically unless I specified the shared dir.
> 
> When it links, I get the following errors:
> 
> g++ -o uid-vidc main.o timecode.o FrameBuffer.o Fetcher.o Imager.o Config.o
> jpegsrc.o skin.o -L/usr/X11R6/lib  -L/opt/gtk/lib -lgtk -lgdk -lgmodule -lglib
> -ldl -lXext -lX11 -lsocket -lnsl -lm -lpthread -L/opt/uid/jpeg/lib -ljpeg
> -lsocket -lnsl  -lXext -lX11 -lm 
> ld: fatal: symbol `g_bit_storage' is multiply defined:
> 	(file main.o and file /opt/gtk/lib/libglib.a(gutils.o));
> ld: fatal: symbol `g_bit_nth_msf' is multiply defined:
> 	(file main.o and file /opt/gtk/lib/libglib.a(gutils.o));
> ld: fatal: symbol `g_bit_nth_lsf' is multiply defined:
> 	(file main.o and file /opt/gtk/lib/libglib.a(gutils.o));
> ld: fatal: File processing errors. No output written to uid-vidc
> 
> Having looked in gutils.o, it seems that 'g_bit_storage' is
> defined to be an inline function in glib.h as follows:
> 
> G_INLINE_FUNC guint	g_bit_storage (guint number);
> #ifdef G_CAN_INLINE
> G_INLINE_FUNC guint
> g_bit_storage (guint number)
> {
>   register guint n_bits = 0;
>   
>   do
>     {
>       n_bits++;
>       number >>= 1;
>     }
>   while (number);
>   return n_bits;
> }
> #endif	/* G_CAN_INLINE */
> 
> so should I try turning off G_CAN_INLINE when compiling glib ? 
> 
> I'm running with:
> 
> > uname -a
> SunOS sam 5.6 Generic_105181-09 sun4m sparc SUNW,SPARCstation-10
> > gcc -v
> Reading specs from /opt/GCC281/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1/specs
> gcc version 2.8.1

hm, are you sure you reconfigured glib with rm config.cache and completely
recompiled it after you got gcc 2.8.1 installed?
with gcc, inline functions should actually be declared "extern inline" and
thus not create extern references in main.c (given that optimization is enabled
though, so be sure to compile your program with -O2).

> 
> Any help gratefully received
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]