Sign in Join

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

Mailing lists / fpc-pascal / 2004-01

uclibc in freepascal

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Olaf Leidinger

Hello!

Is it possible to use another libc in my pascal programs?

When using i386-linux-uclibc-ld (by editing ppas.sh) I get a linking error.

/usr/lib/fpc/1.9.2/units/linux/rtl/cprt21.o(.text+0x38): In function `_start':
: undefined reference to `__libc_start_main'

Ciao,

Olaf

Reply by email

Marco van de Voort
to Olaf Leidinger
Is it possible to use another libc in my pascal programs?

Yes, but you probably have to patch it yourself. (startup files, any anomalies)

E.g. win32 can use msvcrt with some tricks (while also mingw and cygwin are possible)

Show quoted text 6 lines
When using i386-linux-uclibc-ld (by editing ppas.sh) I get a linking error. /usr/lib/fpc/1.9.2/units/linux/rtl/cprt21.o(.text+0x38): In function `_start': : undefined reference to `__libc_start_main'

You should replace cprt21.o with modified startupcode for your libc.

However why would you want another one? Either stay clear of libc (keep it static), or use the vendor supplied one.

If you need it for certain calls only, it is probably easier to create a few syscalls then to get uclibc working.

Reply by email

Unknown author
to Marco van de Voort: As said there are two possibilities: - not use libc, and patch inet to use syscalls. -…
Marco van de Voort wrote 10 lines
> > However why would you want another one? Either stay clear of libc (keep it static), > > or use the vendor supplied one. > > My program uses a {$LINKLIB c} (or to be more precise... the inet unit), > but I want to use uclibc as the program shuld run on an linux network > router (--> www.fli4l.de ) and it uses uclibc as standart libc. As said there are two possibilities: - not use libc, and patch inet to use syscalls.

That is not possible. inet uses gethostent() etc, which is not a kernel call.

To remove the dependency on Libc, use the netdb unit. It has the same functionality as inet, but you don't depend on the C library at all: It is written in pascal.

Unless you use libc somewhere else in your code as well, this should solve your problem.

Michael.

Reply by email

Olaf Leidinger
to Marco van de Voort: Yes, but you probably have to patch it yourself. (startup files, any anomalies) E.g.…

Hello!

However why would you want another one? Either stay clear of libc (keep it static), or use the vendor supplied one.

My program uses a {$LINKLIB c} (or to be more precise... the inet unit), but I want to use uclibc as the program shuld run on an linux network router (--> www.fli4l.de ) and it uses uclibc as standart libc.

Thank's a lot,

Olaf Leidinger

Reply by email

Sebastian Günther
to Olaf Leidinger: Hello! Is it possible to use another libc in my pascal programs? When using…
Hello! Is it possible to use another libc in my pascal programs?

I'm currently working on this as well. At the moment it works with a modified compiler for me, but it should be possible to integrate this into the official compiler sources.

Show quoted text 6 lines
When using i386-linux-uclibc-ld (by editing ppas.sh) I get a linking error. /usr/lib/fpc/1.9.2/units/linux/rtl/cprt21.o(.text+0x38): In function `_start': : undefined reference to `__libc_start_main'

change all __libcXXX names to __uClibcXXX and it should link fine.

- Sebastian

Reply by email

Marco van de Voort
to Olaf Leidinger: Hello! My program uses a {$LINKLIB c} (or to be more precise... the inet unit), but I…
Show quoted text 6 lines
> However why would you want another one? Either stay clear of libc (keep it static), > or use the vendor supplied one. My program uses a {$LINKLIB c} (or to be more precise... the inet unit), but I want to use uclibc as the program shuld run on an linux network router (--> www.fli4l.de ) and it uses uclibc as standart libc.

As said there are two possibilities:

- not use libc, and patch inet to use syscalls.
- fix the startup code for uclibc. (make a diff between the glibc one and the FPC one, and try to incorporate those differences into the uclibc one)

Startup code fixing is not funny, I suggest you go with the syscall method.

Reply by email