Sign in Join

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

Mailing lists / fpc-devel / 2011-10

[iconv][glibc] function "iconvctl" not found.

12 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

4iter

Hi!

In new GLIBC exists internal implementation "libiconv" (see http://www.gnu.org/s/hello/manual/libc/glibc-iconv-Implementation.html) Implemented functions:

    iconv_t iconv_open (__const char *__tocode, __const char *__fromcode);
    size_t iconv (iconv_t __cd, char **__restrict __inbuf,
                     size_t *__restrict __inbytesleft,
                     char **__restrict __outbuf,
                     size_t *__restrict __outbytesleft);
    int iconv_close (iconv_t __cd);

In the file fpc/rtl/unix/cwstrings.pp using function "iconvctl" non existings in glibc !
Original libiconv not installed!
Svn-version Lazarus show build error:
.....................
Compiling svn2revisioninc.pas
Linking ./svn2revisioninc
/home/guest/root/lib/fpc/2.7.1/units/i386-linux/rtl/cwstring.o: In function `CWSTRING_$$_INITTHREAD':
cwstring.pp:(.text+0xf4): undefined reference to `iconvctl' /home/guest/root/lib/fpc/2.7.1/units/i386-linux/rtl/cwstring.o: In function `CWSTRING_$$_WIDE2ANSIMOVE$PWIDECHAR$RAWBYTESTRING$WORD$LONGINT': cwstring.pp:(.text+0x3e5): undefined reference to `iconvctl' svn2revisioninc.pas(600,1) Error: Error while linking svn2revisioninc.pas(600,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
..............................................
Maybe fixit it with #ifdef ?

I apologize, for incorrect English

Reply by email

Paul Ishenin
to 4iter

23.10.11 19:49, 4iter пишет:

Hi! Fatal: Compilation aborted .............................................. Maybe fixit it with #ifdef ?

How to define this ifdef?

Maybe it could be fixed either by dynamic loading or weakexternal directive?

Best regards,
Paul Ishenin.

Reply by email

Jonas Maebe
to Paul Ishenin
Paul Ishenin wrote 9 lines
23.10.11 19:49, 4iter пишет: > Hi! > Fatal: Compilation aborted > .............................................. > Maybe fixit it with #ifdef ? How to define this ifdef? Maybe it could be fixed either by dynamic loading or weakexternal directive?

Or we require libiconv also under Linux (and link against it; currently we only link against libc under Linux and use its -apparently limited- iconv functionality).

Jonas

Reply by email

Marco van de Voort
to Jonas Maebe

In our previous episode, Jonas Maebe said:

Show quoted text 7 lines
> How to define this ifdef? > > Maybe it could be fixed either by dynamic loading or weakexternal directive? Or we require libiconv also under Linux (and link against it; currently we only link against libc under Linux and use its -apparently limited- iconv functionality).

Seems that that function is not in the open group's specification of iconv, it is a GNU extension.

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/iconv.h.html

Reply by email

Paul Ishenin
to Jonas Maebe

23.10.11 20:56, Jonas Maebe пишет:

Show quoted text 10 lines
On 23 Oct 2011, at 14:25, Marco van de Voort wrote: > Seems that that function is not in the open group's specification of iconv, > it is a GNU extension. > > http://pubs.opengroup.org/onlinepubs/009695399/basedefs/iconv.h.html > Ah, yes. Even Mac OS X apparently uses GNU libiconv. So a weak symbol is probably the best solution.

Does weaksymbol works on all platforms where cwstrings is used (I know that it is not implemented on windows at least but there we don't need cwstrings too)?

Best regards,
Paul Ishenin

Reply by email

Marco van de Voort
to Jonas Maebe

In our previous episode, Jonas Maebe said:

Show quoted text 8 lines
> Does weaksymbol works on all platforms where cwstrings is used (I know > that it is not implemented on windows at least but there we don't need > cwstrings too)? Good question, and I'm afraid the answer is "no"... At least http://wiki.freepascal.org/FPC_HowToDo#Weak_linking doesn't list *BSD, and I believe it also hasn't been implemented yet in the internal assembler as that page indicates.

FreeBSD supports #pragma weak, it is even used in the startup code.

Reply by email

Jonas Maebe
to Marco van de Voort
Marco van de Voort wrote 11 lines
In our previous episode, Jonas Maebe said: >> Does weaksymbol works on all platforms where cwstrings is used (I know >> that it is not implemented on windows at least but there we don't need >> cwstrings too)? > > Good question, and I'm afraid the answer is "no"... At least > http://wiki.freepascal.org/FPC_HowToDo#Weak_linking doesn't list *BSD, and > I believe it also hasn't been implemented yet in the internal assembler as > that page indicates. FreeBSD supports #pragma weak, it is even used in the startup code.

It's about the FPC support for weakexternal on the various platforms.

Jonas

Reply by email

Paul Ishenin
to Paul Ishenin: 23.10.11 19:49, 4iter пишет: How to define this ifdef? Maybe it could be fixed…

23.10.2011 20:01, Paul Ishenin пишет:

Show quoted text 10 lines
23.10.11 19:49, 4iter пишет: > Hi! > Fatal: Compilation aborted > .............................................. > Maybe fixit it with #ifdef ? How to define this ifdef? Maybe it could be fixed either by dynamic loading or weakexternal directive?

I tried to handle the situation by using LoadLibrary, GetProcAddress and also failed on osx.

The next line tries to load "iconv.dylib" while on osx the library name is "/usr/lib/libiconv.dylib":

iconvlib:=LoadLibrary(libiconvname+'.'+SharedSuffix);

Now I don't understand how it works with the static linking if "libiconvname" variable is "iconv"?

Best regards,
Paul Ishenin.

Reply by email

zeljko
to Paul Ishenin
Paul Ishenin wrote 22 lines
23.10.2011 20:01, Paul Ishenin пишет: > 23.10.11 19:49, 4iter пишет: >> Hi! >> Fatal: Compilation aborted >> .............................................. >> Maybe fixit it with #ifdef ? > > How to define this ifdef? > > Maybe it could be fixed either by dynamic loading or weakexternal > directive? I tried to handle the situation by using LoadLibrary, GetProcAddress and also failed on osx. The next line tries to load "iconv.dylib" while on osx the library name is "/usr/lib/libiconv.dylib": iconvlib:=LoadLibrary(libiconvname+'.'+SharedSuffix); Now I don't understand how it works with the static linking if "libiconvname" variable is "iconv"?

Because ld knows about "real" libiconv ?

zeljko

Reply by email

Jonas Maebe
to Paul Ishenin: 23.10.2011 20:01, Paul Ishenin пишет: I tried to handle the situation by using…
Paul Ishenin wrote 10 lines
I tried to handle the situation by using LoadLibrary, GetProcAddress and also failed on osx. The next line tries to load "iconv.dylib" while on osx the library name is "/usr/lib/libiconv.dylib": iconvlib:=LoadLibrary(libiconvname+'.'+SharedSuffix); Now I don't understand how it works with the static linking if "libiconvname" variable is "iconv"?

The compiler automatically adds the "lib" prefix and the sharedsuffix in case of external declarations (and additionally, on Mac OS X the library name in external declarations is not even used, only the {$libklib xxx} directive matters -- but there the compiler performs the same transformations of the library name).

Jonas

Reply by email