[fpc-pascal] missing functions in libc

Marco van de Voort marcov at stack.nl
Fri Aug 22 08:56:08 CEST 2008

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

> 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.
> 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

More information about the fpc-pascal mailing list