Closed mouse07410 closed 5 years ago
extra-lib-dirs:
- /opt/local/lib/liconv
Is this the actual line in your config?
Yes it is - it's a directory where a copy of /usr/lib/libiconv.dylib lives. One of my attempts to get that library looked at before the linker processes /opt/local/lib/libiconv.dylib and finds that it does not contain the needed functions.
@mouse07410 i mean it looks like a typo liconv
instead of li[b]iconv
No it is correct. That's the name of the directory I created specifically for this purpose.
Does the delinking solution posted in #1005 fix this?
Unfortunately, I'm using Macports, not Brew. There is no Macports analog to "brew unlink". And forcing removal of the Macports libiconv package would break a lot of packages I use that happen to depend on the Macports-modified libiconv.
Also, I made an experiment - saved Macports libiconv in a separate place, and put a copy of /usr/lib/libiconv.dylib in its place. The HIE build still failed.
@bubba Also, please note that in my case the problem is not that libiconv.dylib
is not found - the problem is that by default stack->ghc->clang
finds the wrong (for this purpose!) /opt/local/lib/libiconv.dylib
instead of /usr/lib/libiconv.dylib
. And it so happens that /opt/local/lib/libiconv.dylib
provides different names than those in /usr/lib/libiconv.dylib
.
Removing /opt/local/lib
from the search path would break a lot of other things, so I cannot do that.
Here's my next attempt to build HIE, trying to modify settings
for the GHC-8.6.4 to always refer to the correct library first. Here's the sad (same) result (note that I was unable to get stack
to show exactly how it invoked the GCC (aka clang
compiler and linker):
. . . . .
-- While building package distributive-0.6 using:
/Users/ur20980/.ghcup/bin/ghc --make -odir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup -hidir /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/ur20980/.stack/snapshots/x86_64-osx/lts-13.12/8.6.4/pkgdb -package-db=/Users/ur20980/src/haskell-ide-engine/.stack-work/install/x86_64-osx/lts-13.12/8.6.4/pkgdb -hide-all-packages -package-id=Cabal-2.4.1.0-4t2ut7bCQNuEj8DDES6BZk -package-id=base-4.12.0.0 -package-id=cabal-doctest-1.0.6-JAfPX6tflaY9kZ4EpfkxUI -optP-include -optP/private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup/setup_macros.h /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/Setup.lhs /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup/setup -threaded
Process exited with code: ExitFailure 1
Logs have been written to: /Users/ur20980/src/haskell-ide-engine/.stack-work/logs/distributive-0.6.log
[1 of 2] Compiling Main ( /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/Setup.lhs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim ( /Users/ur20980/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup/StackSetupShim.o )
Linking /private/var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/stack53889/distributive-0.6/.stack-work/dist/x86_64-osx/Cabal-2.4.1.0/setup/setup ...
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_hs_iconv in libHSbase-4.12.0.0.a(iconv.o)
(maybe you meant: _base_GHCziIOziEncodingziIconv_iconvEncoding_closure, _base_GHCziIOziEncodingziIconv_iconvEncoding1_info , _base_GHCziIOziEncodingziIconv_iconvEncoding6_info , _hs_iconv , _base_GHCziIOziEncodingziIconv_iconvEncoding5_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding14_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding8_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding8_info , _hs_iconv_open , _hs_iconv_close , _base_GHCziIOziEncodingziIconv_iconvEncoding9_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_info , _base_GHCziIOziEncodingziIconv_iconvEncoding4_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding12_info , _base_GHCziIOziEncodingziIconv_iconvEncoding3_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding4_info , _base_GHCziIOziEncodingziIconv_iconvEncoding12_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding10_bytes , _base_GHCziIOziEncodingziIconv_iconvEncoding2_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding2_info , _base_GHCziIOziEncodingziIconv_iconvEncoding11_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding15_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding9_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding6_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding7_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding_info , _base_GHCziIOziEncodingziIconv_iconvEncoding7_info , _base_GHCziIOziEncodingziIconv_iconvEncoding15_info , _base_GHCziIOziEncodingziIconv_iconvEncoding1_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_closure , _base_GHCziIOziEncodingziIconv_iconvEncoding13_info )
"_iconv_open", referenced from:
_hs_iconv_open in libHSbase-4.12.0.0.a(iconv.o)
(maybe you meant: _hs_iconv_open)
"_iconv_close", referenced from:
_hs_iconv_close in libHSbase-4.12.0.0.a(iconv.o)
(maybe you meant: _hs_iconv_close)
"_locale_charset", referenced from:
_localeEncoding in libHSbase-4.12.0.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)
`clang' failed in phase `Linker'. (Exit code: 1)
$
Here's the $HOME/.ghcup/ghc/8.6.4/lib/ghc-8.6.4/settings
file:
[("GCC extra via C opts", " -fwrapv -fno-builtin"),
("C compiler command", "clang"),
("C compiler flags", " -fno-stack-protector"),
("C compiler link flags", " "),
("C compiler supports -no-pie", "NO"),
("Haskell CPP command","clang"),
("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs"),
("ld command", "clang /usr/lib/libiconv.dylib"),
("ld flags", " "),
("ld supports compact unwind", "YES"),
("ld supports build-id", "NO"),
("ld supports filelist", "YES"),
("ld is GNU ld", "NO"),
("ar command", "ar"),
("ar flags", "qcls"),
("ar supports at file", "NO"),
("ranlib command", "ranlib"),
("touch command", "touch"),
("dllwrap command", "/bin/false"),
("windres command", "/bin/false"),
("libtool command", "libtool"),
("perl command", "/opt/local/bin/perl"),
("cross compiling", "NO"),
("target os", "OSDarwin"),
("target arch", "ArchX86_64"),
("target word size", "8"),
("target has GNU nonexec stack", "False"),
("target has .ident directive", "True"),
("target has subsections via symbols", "True"),
("target has RTS linker", "YES"),
("Unregisterised", "NO"),
("LLVM llc command", "llc"),
("LLVM opt command", "opt"),
("LLVM clang command", "clang")
]
Since I don't know which one is active, I've made $HOME/.stack/programs/x86_64-osx/ghc-8.6.4/lib/ghc-8.6.4/settings
look exactly the same. I also copied that settings
file to all the relevant $HOME/.stack/snapshots/...
. Needless to say, it did not help. Somehow, stack
manages to ignore /usr/lib/libiconv.dylib
and gets to /opt/local/lib/libiconv.dylib
first - which breaks everything.
Here's the complete build log, in case it helps: 864.install2.txt
@mouse07410 I can see stack passing --extra-lib-dirs=/opt/local/lib/liconv
to cabal (the bad libiconv right?) in the logs. Did you try nuking ~/.stack/setup-exe-cache
and/or $HIE_SRC_DIR/.stack-work
? It might also be worth adding extra-libraries: iconv
in the .cabal file.
I also found this related SO post
I can see stack passing
--extra-lib-dirs=/opt/local/lib/liconv
to cabal (the badlibiconv
right?) in the logs
No! That's the good libiconv
, which somehow still did not get used, probably because /opt/local/lib/libiconv.dylib
got noticed and processed first (but that's my guess).
I will let you know in my next post how an experiment on another machine went (ghc-8.6.3
).
Update Installation failed, though this time it progressed quite a bit:
$ stack install.hs cabal-hie-8.6.3
# git (for submodules)
Synchronizing submodule url for 'submodules/HaRe'
Synchronizing submodule url for 'submodules/HaRe/submodules/cabal-helper'
Synchronizing submodule url for 'submodules/HaRe/submodules/ghc-mod'
Synchronizing submodule url for 'submodules/brittany'
Synchronizing submodule url for 'submodules/cabal-helper'
Synchronizing submodule url for 'submodules/floskell'
Synchronizing submodule url for 'submodules/ghc-mod'
# git (for submodules)
# stack (for cabal)
# stack (for cabal)
Downloaded nightly-2018-12-15 build plan.
cryptohash-sha256-0.11.101.0: download
Cabal-2.4.1.0: configure
base64-bytestring-1.0.0.2: download
base16-bytestring-0.1.1.6: download
Cabal-2.4.1.0: build
cryptohash-sha256-0.11.101.0: configure
cryptohash-sha256-0.11.101.0: build
base16-bytestring-0.1.1.6: configure
base16-bytestring-0.1.1.6: build
base64-bytestring-1.0.0.2: configure
base64-bytestring-1.0.0.2: build
base16-bytestring-0.1.1.6: copy/register
cryptohash-sha256-0.11.101.0: copy/register
digest-0.0.1.2: download digest-0.0.1.2: configure
. . . . .
Installing yi-rope-0.11 (lib)
Completed yi-rope-0.11 (lib)
Starting haskell-src-exts-1.21.0 (lib)
Building haskell-src-exts-1.21.0 (lib)
Haddock network-3.0.1.1 (all, legacy fallback)
Installing network-3.0.1.1 (all, legacy fallback)
Completed network-3.0.1.1 (all, legacy fallback)
Starting async-2.2.1 (lib)
Building async-2.2.1 (lib)
Haddock async-2.2.1 (lib)
Installing async-2.2.1 (lib)
. . . . .
Completed hscolour-1.24.4 (all, legacy fallback)
Haddock hspec-discover-2.7.1 (lib)
Installing hspec-discover-2.7.1 (lib)
Completed hspec-discover-2.7.1 (lib)
Haddock http-date-0.0.8 (lib)
Installing http-date-0.0.8 (lib)
Completed http-date-0.0.8 (lib)
Warning: Some package(s) failed to build. Try rerunning with -j1 if you can't
see the error.
Failed to build hslogger-1.2.12.
Build log ( /Users/uri/.cabal/logs/ghc-8.6.3/hslggr-1.2.12-420b8ae3.log ):
Configuring library for hslogger-1.2.12..
Preprocessing library for hslogger-1.2.12..
Building library for hslogger-1.2.12..
[1 of 8] Compiling System.Log ( src/System/Log.hs, dist/build/System/Log.o )
[2 of 8] Compiling System.Log.Formatter ( src/System/Log/Formatter.hs, dist/build/System/Log/Formatter.o )
[3 of 8] Compiling System.Log.Handler ( src/System/Log/Handler.hs, dist/build/System/Log/Handler.o )
[4 of 8] Compiling System.Log.Handler.Growl ( src/System/Log/Handler/Growl.hs, dist/build/System/Log/Handler/Growl.o )
src/System/Log/Handler/Growl.hs:21:1: error:
Could not find module ‘Network.BSD’
Perhaps you meant
Network.DNS (needs flag -package-key resolv-0.1.1.2)
Network.DNS (needs flag -package-key resolv-0.1.1.2)
Network.DNS (needs flag -package-key resolv-0.1.1.2)
Use -v to see a list of the files searched for.
|
21 | import Network.BSD
| ^^^^^^^^^^^^^^^^^^
cabal: Failed to build hslogger-1.2.12 (which is required by exe:hie-wrapper
from haskell-ide-engine-0.7.0.0, exe:hie from haskell-ide-engine-0.7.0.0 and
others). See the build log above for details.
Error when running Shake build system:
at src/Development/Shake/Internal/Args.hs:81:69-79:
* Depends on: cabal-hie-8.6.3
* Raised the exception:
user error (Development.Shake.command_, system command failed
Command: cabal new-install --write-ghc-environment-files=never --symlink-bindir=/Users/uri/.local/bin exe:hie --overwrite-policy=always
Exit code: 1
Stderr:
Warning: Some package(s) failed to build. Try rerunning with -j1 if you can't
see the error.
cabal: Failed to build hslogger-1.2.12 (which is required by exe:hie-wrapper
from haskell-ide-engine-0.7.0.0, exe:hie from haskell-ide-engine-0.7.0.0 and
others). See the build log above for details.
)
The problem is conflict between network-2.8.0.0
that your stuff seems to require, and network-3.0.1.1
that it somehow managed to install.
Successfully built with Stack via stack ./install.hs hie-8.6.4
, forcing resolver: lts-13.15 # GHC 8.6.4
in shake.yaml
.
@alanz could you tell me what branch of this repo I should use to build HIE from source on MacOS with GHC-8.6.5? Can I build master
branch? Do I need to re-install shake
? It is better (aka more chances to get a successful build) to build with stack
or cabal
?
@mouse07410 I'm building hie just fine from master with ./install.hs hie-8.6.5
.
MacOS Mojave 10.14.3, GHC-8.6.3 installed via
ghcup
, stack-1.9.3, cabal-2.4.1.0.My
~/.stack/config.yaml
:but apparently, the linker does not receive
/usr/lib/libiconv.dylib
(becausestack
does not pass that parameter) and fails, trying to link with anotherlibiconv.dylib
that's on the shared library search path (because this machine runs other stuff besides Haskell).Help would be appreciated. Note: packages that I create myself - with few dependencies - seem to respect this parameter and build/link fine. Some packages from Hackage/Stackage that stack downloads, for some reason do not respect this parameter - and fail to link.
Update Attempt to follow the approach in #1142 also failed with the same problem - stack fails to refer to the correct
libiconv.dylib
. Here's the complete log: hie.build.out.txtUpdate 2