Re: [gtk-list] Undefined Symbol when compiling glib



> I've encountered a problem compiling glib 1.2.6 under 
[...]
> gcc -g -O2 -Wall -o .libs/testglib testglib.o .libs/libglib.so
> -L/usr/local/lib
> Undefined                       first referenced
>  symbol                             in file
> .L_E1366                            .libs/libglib.so
> .L_E1367                            .libs/libglib.so
> .L_E1368                            .libs/libglib.so
> ld: .libs/testglib: fatal error: Symbol referencing errors. No output
> written to .libs/testglib

I have, in the past, had similar problems trying to compile code on older
versions of Solaris. I eventually tracked it down to one of the arguments
to ld ....

	ld [other args] -z text [other args]

The Solaris man page for ld says:

     -z text     In dynamic mode only, force a fatal error if any
		 relocations  against  non-writable,  allocatable
		 sections remain.

I don't know what "non-writeable, allocatable sections" are, but I
definately believe the bit about the fatal error :-)

I worked around it by hacking libtool (after running ./configure) and
removing -z text from the appropriate variable.

The above undefined symbols are, if memory serves me correctly, of the
form used by the compiler as internal labels, either for local variables
or for the destinations of short branches (i.e. a few instructions long).
I suspect that the compiler is creating these symbols during an early pass,
the optimiser is removing small sections of code, or unused variables, but
the symbol is still in the symbol table. Sound reasonable? (Oh **** just
try it and see if it works :-)

Allan



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