0
當我在我的計算機上編譯工作的Haskell代碼時,它拋出了體系結構x86_64的這個錯誤。我的朋友的計算機工作正常,它的架構相同。體系結構x86_64運行Haskell代碼時,Haskell OSX iconv
$ ghc --make BoardMain.hs
Linking BoardMain ...
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_hs_iconv in libHSbase-4.9.1.0.a(iconv.o)
(maybe you meant: _hs_iconv, _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc_info , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _hs_iconv_open , _base_GHCziIOziEncodingziIconv_iconvEncoding10_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc_closure , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding10_info , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncodingzuloc1_closure)
"_iconv_close", referenced from:
_hs_iconv_close in libHSbase-4.9.1.0.a(iconv.o)
(maybe you meant: _hs_iconv_close)
"_iconv_open", referenced from:
_hs_iconv_open in libHSbase-4.9.1.0.a(iconv.o)
(maybe you meant: _hs_iconv_open)
"_locale_charset", referenced from:
_localeEncoding in libHSbase-4.9.1.0.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)
`gcc' failed in phase `Linker'. (Exit code: 1)
這個問題根本與x86_64沒有關係,而是(C)庫版本控制問題。如果你是Google的「Haskell OSX iconv」,你會得到一些有趣的點擊。也許從這個搜索中嘗試一些事情;希望他們中的一個能夠工作。 (如果是這樣的話,你應該在這裏寫一個答案,告訴你哪種方法適用於你!) –
編譯時,如果我只是將「-L/usr/lib」附加到ghc中,它就是在沒有這些iconv錯誤的情況下編譯的。即$ ghc -L/usr/lib --make file.hs @DanielWagner – Aerron