Sign in Join

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

Mailing lists / fpc-devel / 2008-03

Linux ELF linking problem

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Unknown author

Linux i386 system, fpc from svn rev 10506.

Simple program for retrive system charset:

program b;
uses
  Libc;
begin
   writeln(nl_langinfo(CODESET));
end.

Prints: ANSI_X3.4-1968

I think, libc is not inicialized.

ltrace ./b:
nl_langinfo(14, ....

None of __libc_start_main( -R b
None jump slot __libc_start_main

It looks like some ELF linking problem.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Linux i386 system, fpc from svn rev 10506.

Did this work before? If so, between which and which revision did it stop working?

Show quoted text 10 lines
Simple program for retrive system charset: program b; uses Libc; begin writeln(nl_langinfo(CODESET)); end. Prints: ANSI_X3.4-1968

You are normally required to initialise the locale yourself before calling nl_langinfo(CODESET), by calling setlocal(LC_ALL,'') (at least on non-Linux this is always needed).

Jonas

Reply by email

Unknown author
to Jonas Maebe
Jonas Maebe wrote 7 lines
On 19 Mar 2008, at 11:20, wrote: >Linux i386 system, fpc from svn rev 10506. Did this work before? If so, between which and which revision did it stop working?

No, it was first experiment.

Show quoted text 14 lines
>Simple program for retrive system charset: > >program b; >uses > Libc; >begin > writeln(nl_langinfo(CODESET)); >end. > >Prints: ANSI_X3.4-1968 You are normally required to initialise the locale yourself before calling nl_langinfo(CODESET), by calling setlocal(LC_ALL,'') (at least on non-Linux this is always needed).

I'am very sorry, I do not know about initializing (setlocale(LC_ALL,'')). With this it works ok.

Thanks.

With kylix compiler it works without initializing, now I found why. In sysutils initialization they call setlocale. It confused me.

But missing __libc_start_main do not mind? I think that it initializes malloc and threads.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Jonas Maebe
to Unknown author
Show quoted text 15 lines
On Wed, Mar 19, 2008 at 11:50:29AM +0100, Jonas Maebe wrote: > > You are normally required to initialise the locale yourself before > calling nl_langinfo(CODESET), by calling setlocal(LC_ALL,'') (at > least > on non-Linux this is always needed). I'am very sorry, I do not know about initializing (setlocale(LC_ALL,'')). With this it works ok. Thanks. With kylix compiler it works without initializing, now I found why. In sysutils initialization they call setlocale. It confused me.

In FPC, this is done in the cwstring unit (which installs the widestring manager under unix/Linux, without that unit locale-based routines for ansistrings and widestrings and conversion from one into the other will not work there). The reason for requiring this extra unit is that the default RTL does not depend on libc on Linux.

But missing __libc_start_main do not mind? I think that it initializes malloc and threads.

I don't know. At least I've never heard about such problems.

Jonas

Reply by email