Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-08

missing functions in libc

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

Hi,

I'm trying to compile LPTK 0.9.0 on FreeBSD 4 using a working fpc 2.0.4. I use this compiler for a long time now and never had the symptoms as following:

At first the compiler does not find librt and libdl. I know these exist only on Linux and don't know, why they are tried to be pulled in.

When I delete the -ldl an -lrt from the link.res and start ppas.sh, the compiler struggles on finding unit libc.

If I add an extra -Fu... to the path where it is found, some functions are missing. Some of those are 64bit file system functions like stat64, so I assumed they where newer and tried the libc.pp from fpc 2.0.2, but the same thing happens (see below). Using "man" there where no such functions found, although the man pages on freebsd are generally very good and complete.

This never happened to me, I have written some programs using plain gtk1 or functions from foreign libraries (including libc IIRC), but I never had any problem. So I'm stuck.

What going on here? How can I repair it?

TIA,
Marc

$ out/ppas.sh
Linking out/app_vfd
/usr/lib/libc.so: WARNING! setkey(3) not present in the system! /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! /usr/lib/libc.so: WARNING! encrypt(3) not present in the system! /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended. /usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! /usr/lib/libc.so: warning: tempnam() possibly used $ out/ppas.sh
Linking out/app_vfd
/usr/lib/libc.so: WARNING! setkey(3) not present in the system! /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! /usr/lib/libc.so: WARNING! encrypt(3) not present in the system! /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so: warning: this program uses f_prealloc(), which is not recommended.
/usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! /usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp()
out/libc.o: In function `ERRNO':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/cerrno.inc:9: undefined reference to `__errno_location'
out/libc.o: In function `SETERRNO':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/cerrno.inc:15: undefined reference to `__errno_location'
out/libc.o: In function `CLK_TCK':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/time.inc:4: undefined reference to `__sysconf'
out/libc.o: In function `FSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:50: undefined reference to `__fxstat'
out/libc.o: In function `LSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:56: undefined reference to `__lxstat'
out/libc.o: In function `STAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:62: undefined reference to `__xstat'
out/libc.o: In function `FSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:68: undefined reference to `__fxstat64'
out/libc.o: In function `LSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:74: undefined reference to `__lxstat64'
out/libc.o: In function `STAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:80: undefined reference to `__xstat64'
out/libc.o: In function `STAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:86: undefined reference to `__xstat'
out/libc.o: In function `FSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:92: undefined reference to `__fxstat'
out/libc.o: In function `STAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:98: undefined reference to `__xstat64'
out/libc.o: In function `FSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:104: undefined reference to `__fxstat64'
out/libc.o: In function `LSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:110: undefined reference to `__lxstat'
out/libc.o: In function `LSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:116: undefined reference to `__lxstat64'
out/libc.o: In function `_IO_GETC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:11: undefined reference to `__uflow'
out/libc.o: In function `_IO_PEEKC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:20: undefined reference to `__underflow'
out/libc.o: In function `_IO_PUTC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:32: undefined reference to `__overflow'
out/libc.o: In function `_IO_GETWC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:46: undefined reference to `__wuflow'
out/libc.o: In function `SA_LEN':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/bsocket.inc:6: undefined reference to `__libc_sa_len'
out/libc.o: In function `CMSG_NXTHDR':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/bsocket.inc:20: undefined reference to `__cmsg_nxthdr'
An error occurred while linking out/app_vfd unsafely; consider using mkstemp()
out/libc.o: In function `ERRNO':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/cerrno.inc:9: undefined reference to `__errno_location' out/libc.o: In function `SETERRNO':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/cerrno.inc:15: undefined reference to `__errno_location' out/libc.o: In function `CLK_TCK':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/time.inc:4: undefined reference to `__sysconf' out/libc.o: In function `FSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:50: undefined reference to `__fxstat' out/libc.o: In function `LSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:56: undefined reference to `__lxstat' out/libc.o: In function `STAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:62: undefined reference to `__xstat' out/libc.o: In function `FSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:68: undefined reference to `__fxstat64' out/libc.o: In function `LSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:74: undefined reference to `__lxstat64' out/libc.o: In function `STAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:80: undefined reference to `__xstat64' out/libc.o: In function `STAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:86: undefined reference to `__xstat' out/libc.o: In function `FSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:92: undefined reference to `__fxstat' out/libc.o: In function `STAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:98: undefined reference to `__xstat64' out/libc.o: In function `FSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:104: undefined reference to `__fxstat64' out/libc.o: In function `LSTAT':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:110: undefined reference to `__lxstat' out/libc.o: In function `LSTAT64':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/sstat.inc:116: undefined reference to `__lxstat64' out/libc.o: In function `_IO_GETC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:11: undefined reference to `__uflow' out/libc.o: In function `_IO_PEEKC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:20: undefined reference to `__underflow' out/libc.o: In function `_IO_PUTC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:32: undefined reference to `__overflow' out/libc.o: In function `_IO_GETWC_UNLOCKED':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/libio.inc:46: undefined reference to `__wuflow' out/libc.o: In function `SA_LEN':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/bsocket.inc:6: undefined reference to `__libc_sa_len' out/libc.o: In function `CMSG_NXTHDR':
/usr/home/marc/program/fpc-svn/fpc/packages/base/libc/bsocket.inc:20: undefined reference to `__cmsg_nxthdr' An error occurred while linking out/app_vfd

Reply by email

Michael Van Canneyt
to Marc Santhoff
Marc Santhoff wrote 11 lines
Hi, I'm trying to compile LPTK 0.9.0 on FreeBSD 4 using a working fpc 2.0.4. I use this compiler for a long time now and never had the symptoms as following: At first the compiler does not find librt and libdl. I know these exist only on Linux and don't know, why they are tried to be pulled in. When I delete the -ldl an -lrt from the link.res and start ppas.sh, the compiler struggles on finding unit libc.

the libc is only for gnu libc, so the errors are normal. You should try to find out why unit libc is used.

Michael.

Reply by email

Marco van de Voort
to Marc Santhoff: I'm trying to compile LPTK 0.9.0 on FreeBSD 4 using a working fpc 2.0.4. I use this…

In our previous episode, Marc Santhoff said:

At first the compiler does not find librt and libdl. I know these exist only on Linux and don't know, why they are tried to be pulled in.

libdl is mostly uses for dynamically loading dynamic libraries. Probably that packages declares its own loadlibrary (dlload) equivalents somewhere.

When I delete the -ldl an -lrt from the link.res and start ppas.sh, the compiler struggles on finding unit libc.

That's a Kylix legacy unit. It means that this package was never fully converted to FPC. It only exists for linux/x86 with a glibc.

See here : http://wiki.freepascal.org/libc_unit

Show quoted text 6 lines
If I add an extra -Fu... to the path where it is found, some functions are missing. Some of those are 64bit file system functions like stat64, so I assumed they where newer and tried the libc.pp from fpc 2.0.2, but the same thing happens (see below). Using "man" there where no such functions found, although the man pages on freebsd are generally very good and complete.

That's because they are temporary workarounds for the older linux architectures when they made a 32-bit -> 64-bit off_t transition. They are not even universal on Linux iirc.

Show quoted text 5 lines
This never happened to me, I have written some programs using plain gtk1 or functions from foreign libraries (including libc IIRC), but I never had any problem. So I'm stuck. What going on here? How can I repair it?

Eliminate use of the libc unit, using mostly baseunix, dynlibs and the like (the above url has a longer list). Replace -64 functions by their plain equivalents. (FreeBSD 4+ already has 64-bit off_t)

And hope that they didn't use too exotic functions from unit libc. If so, report here. In 2.2.2 some routines to access users/passwords were added, maybe you can take the sources from there (packages/users), and try to get it running under 2.0.4

Reply by email

Marc Santhoff
to Marco van de Voort
Marco van de Voort wrote
In our previous episode, Marc Santhoff said:

[...]

Show quoted text 10 lines
> What going on here? How can I repair it? Eliminate use of the libc unit, using mostly baseunix, dynlibs and the like (the above url has a longer list). Replace -64 functions by their plain equivalents. (FreeBSD 4+ already has 64-bit off_t) And hope that they didn't use too exotic functions from unit libc. If so, report here. In 2.2.2 some routines to access users/passwords were added, maybe you can take the sources from there (packages/users), and try to get it running under 2.0.4

Thanks, that made it clear and I found there is only one unit using libc.

The other question is if I want to put a lot of time into that one, I only wanted to see if it works - according to the source it must have been working with fpc once.

I'll see if the author is still working on this or the successor of it and decide after that.

Thanks again,
Marc

For anyone interested:

http://lptk.sourceforge.net/index.php
http://pasgf.sourceforge.net/index.php

Reply by email