Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

iconv linker errors on OSX #744

Open
AesaKamar opened this issue Aug 7, 2018 · 7 comments
Open

iconv linker errors on OSX #744

AesaKamar opened this issue Aug 7, 2018 · 7 comments
Milestone

Comments

@AesaKamar
Copy link

In particular, I'm running from the Atom IDE engine.

The Atom integration invokes this command:

/Users/aesa/Code/Nix/haskell-ide-engine/.stack-work/install/x86_64-osx-nix/lts-11.17/8.2.2/libexec/x86_64-osx-ghc-8.2.2/cabal-helper-0.8.0.4/cabal-helper-wrapper \
"--with-ghc=/nix/store/akpfx4dwldj6s6rvnamnc24lkaxgrhl2-ghc-8.2.2/bin/ghc" \
"--with-ghc-pkg=/nix/store/akpfx4dwldj6s6rvnamnc24lkaxgrhl2-ghc-8.2.2/bin/ghc-pkg" \
"--with-cabal=cabal" \
"/Users/aesa/Code/Katas/Day19" \
"/Users/aesa/Code/Katas/Day19/.stack-work/dist/x86_64-osx-nix/Cabal-2.0.1.0" \
"package-db-stack" \
"flags" \
"compiler-version" \
"ghc-merged-pkg-options" \
"config-flags" \
"non-default-config-flags" \
"ghc-src-options" \
"ghc-pkg-options" \
"ghc-lang-options" \
"ghc-options" \
"source-dirs" \
"entrypoints" \
"needs-build-output"

The corresponding output from that operation is:

Linking /Users/aesa/.cache/cabal-helper/cabal-helper0.8.0.4-Cabal2.0.1.0 ...
clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
clang-5.0: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
  "_iconv", referenced from:
      _hs_iconv in libHSbase-4.10.1.0.a(iconv.o)
     (maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding_closure, _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding13_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure )
  "_iconv_open", referenced from:
      _hs_iconv_open in libHSbase-4.10.1.0.a(iconv.o)
     (maybe you meant: _hs_iconv_open)
  "_iconv_close", referenced from:
      _hs_iconv_close in libHSbase-4.10.1.0.a(iconv.o)
     (maybe you meant: _hs_iconv_close)
  "_locale_charset", referenced from:
      _localeEncoding in libHSbase-4.10.1.0.a(PrelIOUtils.o)
ld: symbol(s) not found for architecture x86_64
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)

Worth Noting:
iconv --version

iconv (GNU libiconv 1.11)
Copyright (C) 2000-2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Bruno Haible.

And iconv is installed under /usr/bin/iconv
I guess it came with the system?

@AesaKamar
Copy link
Author

AesaKamar commented Aug 7, 2018

I've also come across this stack overflow thread.

https://stackoverflow.com/questions/43359289/architecture-x86-64-while-running-haskell-code-haskell-osx-iconv

However, I don't know how to determine where the other libiconv dependencies might be, other than the binary.

Thanks in advance

@AesaKamar
Copy link
Author

I've also followed along with the suggestions put forth in this issue thread
commercialhaskell/stack#825

But to no avail. /:

@PaulAtFormation
Copy link

👍

Having exactly the same issue with Nix 2.1, from which I've installed stack and cabal-install, and used them to build haskell-ide-engine from source, on macOS 10.13.6.

@AesaKamar
Copy link
Author

AesaKamar commented Sep 9, 2018

I've also come across this (all the way back from 2011)
http://blog.omega-prime.co.uk/2011/01/28/solving-ghc-iconv-problems-on-os-x-10-6/

But I didn't have success in fixing the iconv linker error.

@lukel97
Copy link
Collaborator

lukel97 commented Sep 9, 2018

@AesaKamar Can you check that /usr/lib/libiconv.dylib exists? And if it does that nm /usr/lib/libiconv.dylib | grep _locale_charset returns some address?

@AesaKamar
Copy link
Author

AesaKamar commented Sep 10, 2018

  • /usr/lib/libiconv.dylib does exist
  • nm /usr/lib/libiconv.dylib | grep _locale_charset returns 0000000000014ac7 T _locale_charset

And which iconv yields /usr/bin/iconv

@lrworth
Copy link

lrworth commented Sep 17, 2018

FWIW, not directly related to haskell-ide-engine, but I've been having trouble building anything with cabal after installing it with Nix, and just got it working by introducing a -liconv to the build command. Adding this to my cabal file worked:

extra-libraries: iconv

@alanz alanz added this to the 2019-01 milestone Dec 24, 2018
@alanz alanz modified the milestones: 2019-01, 2019-02 Feb 2, 2019
@alanz alanz modified the milestones: 2019-02, 2019-03 Mar 2, 2019
@alanz alanz modified the milestones: 2019-03, 2019-04 Apr 6, 2019
@alanz alanz modified the milestones: 2019-04, 2019-05 May 4, 2019
@alanz alanz modified the milestones: 2019-05, 2019-06 Jun 1, 2019
@alanz alanz modified the milestones: 2019-06, Some time Jul 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants