ghcjs / ghcjs-dom-hello

GHCJS DOM Hello World, an example package
MIT License
10 stars 11 forks source link

ld: symbol(s) not found for architecture x86_64 #5

Closed erikkaplun closed 8 years ago

erikkaplun commented 8 years ago

I'm running into this on OS X, having installed webkit-gtk3 using MacPorts as guided in https://github.com/leksah/leksah#building-on-os-x.

My goal is to compile the ghcjs-dom-hello project with GHC 7.10.2 (as opposed to GHCJS).

I have the binaries from gtk2hs-buildtools in my PATH, and I've confirmed that cabal install webkitgtk3 works (in a sandbox).

~/code/haskell/ghcjs-dom-hello$ sb
mtl-2.2.1: configure
mtl-2.2.1: build
text-1.2.1.3: configure
text-1.2.1.3: build
utf8-string-1.0.1.1: configure
utf8-string-1.0.1.1: build
mtl-2.2.1: copy/register
utf8-string-1.0.1.1: copy/register
text-1.2.1.3: copy/register
glib-0.13.2.1: configure
glib-0.13.2.1: build
cairo-0.13.1.0: configure
cairo-0.13.1.0: build
glib-0.13.2.1: copy/register
gio-0.13.1.0: configure
gio-0.13.1.0: build
cairo-0.13.1.0: copy/register
pango-0.13.1.0: configure
pango-0.13.1.0: build
pango-0.13.1.0: copy/register
gio-0.13.1.0: copy/register
gtk3-0.14.1: configure
gtk3-0.14.1: build
gtk3-0.14.1: copy/register
webkitgtk3-0.14.1.0: configure
webkitgtk3-0.14.1.0: build
webkitgtk3-0.14.1.0: copy/register
ghcjs-dom-0.2.3.0: configure
ghcjs-dom-0.2.3.0: build
ghcjs-dom-0.2.3.0: copy/register
ghcjs-dom-hello-2.0.0.0: configure
Configuring ghcjs-dom-hello-2.0.0.0...
ghcjs-dom-hello-2.0.0.0: build
Preprocessing executable 'ghcjs-dom-hello' for ghcjs-dom-hello-2.0.0.0...
[1 of 1] Compiling Main             ( src/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ghcjs-dom-hello/ghcjs-dom-hello-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/ghcjs-dom-hello/ghcjs-dom-hello ...
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _hs_iconv in libHSbase-4.8.1.0-GDytRqRVSUX7zckgKqJjgw.a(iconv.o)
     (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc_info, _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc1_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure )
  "_iconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.8.1.0-GDytRqRVSUX7zckgKqJjgw.a(iconv.o)
     (maybe you meant: _hs_iconv_close)
  "_iconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.8.1.0-GDytRqRVSUX7zckgKqJjgw.a(iconv.o)
     (maybe you meant: _hs_iconv_open)
  "_locale_charset", referenced from:
      _localeEncoding in libHSbase-4.8.1.0-GDytRqRVSUX7zckgKqJjgw.a(PrelIOUtils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Completed all 11 actions.

--  While building package ghcjs-dom-hello-2.0.0.0 using:
      /Users/erik/.stack/setup-exe-cache/setup-Simple-Cabal-1.22.4.0-x86_64-osx-ghc-7.10.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.4.0 build exe:ghcjs-dom-hello --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
erikkaplun commented 8 years ago

OK, it turns out there is a problem with the libiconv installed by MacPorts:

I managed to work around it by temporarily deactivating the libiconv port, but that's clearly not the best solution.

It should be possible to pass in the path to a non-MacPorts libiconv installation, I guess? Any help would be appreciated regarding how to pass that information to the linker via stack.yaml or the ghcjs-dom-hello.cabal.