GHC 6.12.2 on Mac OS X from GHC-6.12.2-i386.pkg fails with "Undefined symbols: "_iconv_close", referenced from: _hs_iconv_close in libHSbase-4.2.0.1.a(iconv.o) ..."
With
$ uname -a
Darwin thorkil-naurs-intel-mac-mini.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.2
$
installed from http://haskell.org/ghc/dist/6.12.2/GHC-6.12.2-i386.pkg:
$ cat t1.hs
import System.IO
main
= putStrLn "Hello GHC-6.12.2 2010-May-13 13.30"
$ ghc --make t1.hs
[1 of 1] Compiling Main ( t1.hs, t1.o )
Linking t1 ...
Undefined symbols:
"_iconv_close", referenced from:
_hs_iconv_close in libHSbase-4.2.0.1.a(iconv.o)
"_iconv", referenced from:
_hs_iconv in libHSbase-4.2.0.1.a(iconv.o)
"_iconv_open", referenced from:
_hs_iconv_open in libHSbase-4.2.0.1.a(iconv.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
$
Looking at the installed libiconv:
$ nm /opt/local/lib/libiconv.a | grep iconv
/opt/local/lib/libiconv.a(iconv.o):
00018c60 D __libiconv_version
00018920 T _iconv_canonicalize
00015f20 T _libiconv
00015f80 T _libiconv_close
00017930 T _libiconv_open
00018150 T _libiconv_open_into
00015fa0 T _libiconvctl
000161e0 T _libiconvlist
/opt/local/lib/libiconv.a(localcharset.o):
/opt/local/lib/libiconv.a(relocatable.o):
000000f0 T _libiconv_relocate
00000000 T _libiconv_set_relocation_prefix
$
Further, in /opt/local/include/iconv.h:
#ifndef LIBICONV_PLUG
#define iconv_open libiconv_open
#endif
extern iconv_t iconv_open (const char* tocode, const char* fromcode);
So there is some trickery going on with respect to the names of functions from libiconv, but it is not clear to me how to resolve this.
Best regards Thorkil
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.12.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |