Sign in Join

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

Mailing lists / fpc-pascal / 2011-01

Undefined symbols on mac

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Darius Blaszyk

Compiling my project results in a linker error on Mac. I couldn't find anything on google so perhaps someone can help me here.

I have pasted the error messages below. I'm using : Lazarus 0.9.31 r29068M FPC 2.4.2 i386-darwin-carbon

Regards, Darius

Undefined symbols:
"_iconv_open", referenced from:
_CWSTRING_INITTHREAD in cwstring.o
_CWSTRING_INITTHREAD in cwstring.o
_ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o "_iconv_open", referenced from: _CWSTRING_INITTHREAD in cwstring.o _CWSTRING_INITTHREAD in cwstring.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o "_iconv", referenced from: _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_WIDE2ANSIMOVE$PWIDECHAR$ANSISTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _CWSTRING_ANSI2WIDEMOVE$PCHAR$WIDESTRING$LONGINT in cwstring.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o _CWSTRING_FINITHREAD in cwstring.o
_CWSTRING_FINITHREAD in cwstring.o
_ICONVENC_ICONVERT$ANSISTRING$ANSISTRING$ANSISTRING$ANSISTRING$$LONGINT in iconvenc.o ld: symbol(s) not found
An error occurred while linking
Error: Error while linking

Jonas Maebe
to Darius Blaszyk
Darius Blaszyk wrote 6 lines
Compiling my project results in a linker error on Mac. I couldn't find anything on google so perhaps someone can help me here. I have pasted the error messages below. I'm using : Lazarus 0.9.31 r29068M FPC 2.4.2 i386-darwin-carbon Undefined symbols: "_iconv_open", referenced from:

My guess is that you are not linking against the system version of libiconv, but against a version of that library compiled by a third party (fink, macports, ...). That is not supported by the cwstring unit (and it's a good thing that gives an error at link time, since the program would otherwise fail to start on machines that do not have that custom version of libiconv installed).

I think you should be able to force the linker to pick the system version by passing -k/usr/lib/libiconv.dylib on the command line. Alternatively, remove the fink/macports/... directory from your linker search path (in case you don't use any of its libraries).

Jonas

Darius Blaszyk
to Jonas Maebe

Hi Jonas,

You're right, I added the correct library and now it works! Thanks for that.

Regards, Darius

Jonas Maebe wrote 18 lines
On 22 Jan 2011, at 11:06, Darius Blaszyk wrote: > Compiling my project results in a linker error on Mac. I couldn't find anything on google so perhaps someone can help me here. > > I have pasted the error messages below. I'm using : Lazarus 0.9.31 r29068M FPC 2.4.2 i386-darwin-carbon > > Undefined symbols: > "_iconv_open", referenced from: My guess is that you are not linking against the system version of libiconv, but against a version of that library compiled by a third party (fink, macports, ...). That is not supported by the cwstring unit (and it's a good thing that gives an error at link time, since the program would otherwise fail to start on machines that do not have that custom version of libiconv installed). I think you should be able to force the linker to pick the system version by passing -k/usr/lib/libiconv.dylib on the command line. Alternatively, remove the fink/macports/... directory from your linker search path (in case you don't use any of its libraries). Jonas_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal