/lib/libm.so.5.0.5: undefined reference to_(re)

Tue, 29 Oct 1996 21:50:57 +0100


At 08:04 AM 10/29/96 -0800, you wrote:
>hi,
>
>i download this file gpc-1.1p2-linuxelf.tar.gz from some ftp site, and
>i'm confused. The below executable is in this file, but there is no
>source.

Sources, info etc.: follow the pointers at the homepage:
http://agnes.dida.physik.uni-essen.de/~gnu-pascal/

>
>-rwxr-xr-x root/root     48100 Dec 20 09:53 1995 usr/bin/gpc
>
>
>i get the following error on a simple pascal program. i don't know pascal
>so i'm assuming it right
>
>/lib/libm.so.5.0.5: undefined reference to `__errno_location'
>
>program Mytestfile (input, output);
>procedure HI;
>  begin
>    {GotoXY(1, 23);}
>    {WRITE("Hi");}
>  end;
> 
>BEGIN { main program }
> 
>     HI;
> 
>END.
>

I would not expect to much output from this program ;-)

>next, i then downlaod the latest and i'm still getting the same error :<.
>
>-rwxr-xr-x   1 root     root        50348 Aug 28 14:15 /usr/bin/gpc*
>
>rf600:~$ gpc -v 
>Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2/specs
>gpc version 1.2(2.7.2)
>rf600:~$ gpc tst.pas
> /lib/libm.so.5.0.5: undefined reference to `__errno_location'
>

Are you sure you get an error when _compiling_ your test program, not when
_running_ it ???? The GPC compiler itself does not use libm.so in any way,
so this error message doesn't make any sense. But programs compiled with GPC
always use libm.so

>
>
>any and all help will be greatly appreciated
>

As far as I can see, (1) you don't have a GPC problem, but your
version of libm and libc don't match or (2) you have a very old/new libc
version which has an errno definition incompatible with the one used by the
GPC precompiled binary. The 2.6.3 based GPC binary is linked against
libc.so.5.0.9 (the one from Slackware 3.0) while the 2.7.2 based GPC
binaries are linked against libc.so.5.2.18. I believe libm is version 5.0.5
in both cases. You can check your installed libc version:

ZOO-station:~$ ldd /usr/bin/gpc
        libc.so.5 => /lib/libc.so.5.2.18

The dynamic loader is complaining because it cannot resolve a symbol,
"__errno_location" which is indeed undefined in libm.so:

ZOO-station:~$ nm /lib/libm.so.5 | grep __errno_location

	         U __errno_location

("U" means undefined). But this symbol is defined in  and should be
present in libc.so:

ZOO-station:~$ nm /lib/libc.so.5 | grep __errno_location

	0000fe4c W __errno_location

To make sure it's not GPC who's causing trouble, try compiling a small piece
of C which uses libm.so, i.e.:

	int main(void)
	{
	        printf("sine of 0 = %f\n", sin(0));
	}

If it's the problem described by (1) then this should produce the same sort
of errors.

Usually, a libc.so is backwards compatible, but if you have a libc.so < 5.0.9
it may be time to upgrade. If will not use experimental libc versions (5.3.x,
5.4.x) to produce the precompiled GPC binaries, because I don't want to
force people to upgrade to these versions. If you use an experimental
libc.so version, see if the errno definition in  has changed since
5.2.18 (I cannot verify this -- I don't have it). If so, you may have to
rebuild libgpc.a because it uses the errno definition.

In the 5.2.18  it's defined like this:

#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_REENTRANT)
extern int*     __errno_location  __P((void));
#define errno   (*__errno_location ())
#else
extern int errno;
#endif

Hope this helps, otherwise it might be useful to see your results for the
tests described above.

JanJaap
--
     The latest & greates in software, hardware and manswear
                       -- Bono Vox (U2)


JanJaap van der Heijden (J.J.vanderHeijden@driene.student.utwente.nl)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es