Skip to content

<command line>: can't load .so/.DLL for: libGui.dylib (dlopen(libGui.dylib, 5): image not found) #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yousukeitoh opened this issue Dec 17, 2015 · 6 comments

Comments

@yousukeitoh
Copy link

I am using stack on mac os x 10.11.2 (El Capitan) and installing a haskell library called haskall.
stack solver, stack build, stack install seemed to work fine.

nozomi:HasKAL yousuke$ stack solver
Asking cabal to calculate a build plan, please wait
This command is not guaranteed to give you a perfect build plan
No needed changes found
(snip)
nozomi:HasKAL yousuke$ stack build
(snip)
HasKAL-Minimal-0.1.0.0: build
Preprocessing library HasKAL-Minimal-0.1.0.0...
ld: warning: directory not found for option '-L/opt/local/lib/'
In-place registering HasKAL-Minimal-0.1.0.0...
HasKAL-Minimal-0.1.0.0: copy/register
Installing library in
/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/install/x86_64-osx/ghc-7.10.3/7.10.3/lib/x86_64-osx-ghc-7.10.3/HasKAL-Minimal-0.1.0.0-BRnXtsqXls7JbVsSjcDGHQ
Registering HasKAL-Minimal-0.1.0.0...
Completed all 82 actions.
nozomi:HasKAL yousuke$ stack install
nozomi:HasKAL yousuke$ stack --version
Version 0.1.10.1 x86_64

But stack ghci fails.
nozomi:HasKAL yousuke$ stack -v ghci
Version 0.1.10.1 x86_64
2015-12-17 22:43:41.256419: [debug] Checking for project config at: /Users/yousuke/gitwork/detector-characterization/HasKAL/stack.yaml @(stack_EFathv4K9c09zUHx1EoU9t:Stack.Config src/Stack/Config.hs:576:9)
2015-12-17 22:43:41.257429: [debug] Loading project config file stack.yaml @(stack_EFathv4K9c09zUHx1EoU9t:Stack.Config src/Stack/Config.hs:599:13)
2015-12-17 22:43:41.259299: [debug] Trying to decode /Users/yousuke/.stack/indices/Hackage/00-index.cache @(stack_EFathv4K9c09zUHx1EoU9t:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-12-17 22:43:41.492899: [debug] Success decoding /Users/yousuke/.stack/indices/Hackage/00-index.cache @(stack_EFathv4K9c09zUHx1EoU9t:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-12-17 22:43:41.504303: [debug] Run process: ghc --info @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:41.581860: [debug] Run process: ghc --numeric-version @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:41.648053: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal version @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:41.710710: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.026360: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.114273: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/yousuke/.stack/snapshots/x86_64-osx/ghc-7.10.3/7.10.3/pkgdb dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.185269: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/install/x86_64-osx/ghc-7.10.3/7.10.3/pkgdb dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.544645: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.623277: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/yousuke/.stack/snapshots/x86_64-osx/ghc-7.10.3/7.10.3/pkgdb dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.700326: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/install/x86_64-osx/ghc-7.10.3/7.10.3/pkgdb dump --expand-pkgroot @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:42.824596: [debug] Trying to decode /Users/yousuke/.stack/indices/Hackage/00-index.cache @(stack_EFathv4K9c09zUHx1EoU9t:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-12-17 22:43:43.034621: [debug] Success decoding /Users/yousuke/.stack/indices/Hackage/00-index.cache @(stack_EFathv4K9c09zUHx1EoU9t:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-12-17 22:43:43.297825: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_EFathv4K9c09zUHx1EoU9t:System.Process.Read src/System/Process/Read.hs:273:3)
2015-12-17 22:43:43.601598: [info] Configuring GHCi with the following packages: HasKAL-Minimal @(stack_EFathv4K9c09zUHx1EoU9t:Stack.Ghci src/Stack/Ghci.hs:118:5)
2015-12-17 22:43:43.603494: [debug] Run process: ghc --interactive -i -odir=/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/odir -hidir=/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/odir -hide-all-packages -XDoAndIfThenElse -XForeignFunctionInterface -XCPP -i/Users/yousuke/gitwork/detector-characterization/HasKAL/src -i/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen -i/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -stubdir=/Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -package-id=array-0.5.1.0-960bf9ae8875cc30355e086f8853a049 -package-id=base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5 -package-id=bindings-gsl-0.2.1-67b5fc19e6dc2ac9fd40fe0aa1721d8c -package-id=carray-0.1.6.1-0275f5ffd77d64889191add130743c0f -package-id=cgi-3001.2.2.2-11ddbc8ebfcad1295bdf72be021cc71c -package-id=Chart-1.5.4-9ecc9c7f43814680ce2a1974f56bc5f8 -package-id=Chart-gtk-1.5.1-5bb1a192eba24241f089175ae4235d8f -package-id=Chart-cairo-1.5.4-a62c8c3e69911c0e55d7f13ab062d921 -package-id=colour-2.3.3-0c4e3735159b357562a94a22fd309019 -package-id=containers-0.5.6.2-1281f6ac62b47acf472f6cdcec6a4f4b -package-id=data-default-class-0.0.1-fcbab95490d730dd2489b628499587cd -package-id=deepseq-1.4.1.1-8eec8f9bea2efc2500f63544ec6ca569 -package-id=directory-1.2.2.0-56e99b9bcdb60d39c93700648f906374 -package-id=fficxx-runtime-0.2.1-4b7fa817d365b4a8be3f79483461e114 -package-id=fft-0.1.8.2-99759105027d6b22a8908e6b95dc19e1 -package-id=filepath-1.4.0.0-f97d1e4aebfd7a03be6980454fe31d6e -package-id=fsnotify-0.2.1-37fd24ac2eaf41523ad2f2b4ff660e1e -package-id=hmatrix-0.16.1.5-8afa340cf6d872e16fe15e8884f32103 -package-id=hmatrix-gsl-0.16.0.3-36aac350192d287db6df1a8a93189bc4 -package-id=hmatrix-special-0.3.0.1-9ea44878390f56390778c05fc676495c -package-id=HROOT-0.8-9dd2410a4384851edebc6b657bfa9021 -package-id=lens-4.13-b8beba62b884ae174123ef70bbdc1cd2 -package-id=matrices-0.4.3-05a6ead7e50db124ea1c1635e54932f5 -package-id=monad-par-0.3.4.7-6b70f2f8af552e43b14edb97f39a263e -package-id=monad-par-extras-0.3.3-a8a1709f02b9c582c10ab43a8d739343 -package-id=old-locale-1.0.0.7-0db938eb141b01f4936a21aef6b843bf -package-id=old-time-1.1.0.3-de6e6dba6ed592f0f556baa215d4aea5 -package-id=process-1.2.3.0-43f46fea20622dde8c5d485d65e4e315 -package-id=split-0.2.2-10f39ee49f650eefddf38af51b65d10a -package-id=system-fileio-0.3.16.3-8e25cfe2f4e893b5a78e964bd998cfdf -package-id=system-filepath-0.4.13.4-2f85070f730fe7fcb34d234f2df11cc4 -package-id=text-1.2.1.3-af4efec8ee6e081b079a34e976839d62 -package-id=time-1.5.0.1-9d583724234c876226763fdd0cb776fc -package-id=transformers-0.4.2.0-81450cd8f86b36eaa8fa0cbaf6efc3a3 -package-id=unix-compat-0.4.1.4-4dccf276c16fae173fbeaa213af7fd4e -package-id=vector-0.11.0.0-324da2b07f25721d305480db94a9f1d6 -package-id=vector-algorithms-0.7.0.1-8b7798edeb4342cbf42e1b669fcebf07 -lFrame -lgsl -lgslcblas /Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/src/HasKAL/PlotUtils/HROOT/AppendFunction.o /Users/yousuke/gitwork/detector-characterization/HasKAL/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/src/HasKAL/SignalProcessingUtils/filterFunctions.o -optP-include -optP/private/var/folders/62/k95vj_hx0_vf7spc345tdfth0000gp/T/ghci25458/cabal_macros.h -ghci-script=/private/var/folders/62/k95vj_hx0_vf7spc345tdfth0000gp/T/ghci25458/ghci-script @(stack_EFathv4K9c09zUHx1EoU9t:Stack.Exec src/Stack/Exec.hs:51:5)
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
: can't load .so/.DLL for: libGui.dylib (dlopen(libGui.dylib, 5): image not found)

Incidentally, ghci works just fine.
nozomi:HasKAL yousuke$ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude>

It seems it cannot find libGui.dylib provided by cern root software (installed by homebrew).
nozomi:HasKAL yousuke$ echo $DYLD_LIBRARY_PATH
/usr/local/Cellar/root/5.34.34/lib/root:/usr/local/lib/root
nozomi:HasKAL yousuke$ locate libGui.so
/usr/local/Cellar/root/5.34.34/lib/root/libGui.so
nozomi:HasKAL yousuke$ locate libGui.dylib

I am a new user of stack (and cabal) and what I found as a solution
was setting $DYLD_LIBRARY_PATH which did not work.
Could you help? Thanks!

@mgsloan
Copy link
Contributor

mgsloan commented Dec 18, 2015

I don't know much about OS X, but el capitan seems to have made this stuff trickier. @borsboom @chrisdone Anything come to mind on this?

@borsboom
Copy link
Contributor

El Capitan does not, by default, pass DYLD_LIBRARY_PATH to subprocesses (see #1161). The workaround is to disable System Integrity Protection.

@yousukeitoh
Copy link
Author

Thanks a lot, mgsloan and borsboom!
But I still find the same error...

nozomi:HasKAL yousuke$ csrutil status
System Integrity Protection status: disabled.

nozomi:HasKAL yousuke$ stack clean
nozomi:HasKAL yousuke$ stack solver
(snip)
nozomi:HasKAL yousuke$ stack build
(snip)
nozomi:HasKAL yousuke$ stack install

nozomi:HasKAL yousuke$ stack ghci
Configuring GHCi with the following packages: HasKAL-Minimal
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
: can't load .so/.DLL for: libGui.dylib (dlopen(libGui.dylib, 5): image not found)

nozomi:HasKAL yousuke$ echo $DYLD_LIBRARY_PATH
/usr/local/Cellar/root/5.34.34/lib/root:/usr/local/lib/root
nozomi:HasKAL yousuke$ locate libGui.dylib
nozomi:HasKAL yousuke$ locate libGui.so
/usr/local/Cellar/root/5.34.34/lib/root/libGui.so

Incidentally, I found that I can compile a following script using the HasKAL package.
import HasKAL.Constant.MKSA
main = do
print "hello world"
print hasKAL_const_mksa_speed_of_light

nozomi:HasKAL yousuke$ stack ghc test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
ld: warning: directory not found for option '-L/opt/local/lib/'
nozomi:HasKAL yousuke$ ./test
"hello world"
2.99792458e8
nozomi:HasKAL yousuke$ stack ghci --no-load
Configuring GHCi with the following packages: HasKAL-Minimal
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
: can't load .so/.DLL for: libGui.dylib (dlopen(libGui.dylib, 5): image not found)

So my question is, why ghci refuse to work??

I also have tested the same thing on Cent OS 6.7 on virtual box on my mac
and found no such error as above.
(I found another problem there, but it may be a different story...)

@mgsloan mgsloan modified the milestones: P2: Should, Support Dec 21, 2015
@mgsloan mgsloan reopened this Dec 21, 2015
@mgsloan
Copy link
Contributor

mgsloan commented Dec 21, 2015

Where is this HasKAL repo located?

Unfortunately, I don't have a Mac, so I can't try this out.

@yousukeitoh
Copy link
Author

Thanks for the response, mgsloan!
The HasKAL package is at https://github.com/gw-analysis/detector-characterization.
But installation of this software requires having a lot of another software installed,
which may complicate the problem. Since libGui.so comes from the CERN ROOT
software (https://root.cern.ch), I will try to make a minimal example that causes this error
using CERNROOT/HROOT pair (https://hackage.haskell.org/package/HROOT).

@yousukeitoh
Copy link
Author

Hi,

While I did not known yet how to reproduce this problem with a smaller code, I find how to
fix it (hopefully). I just created soft-links to the .so files with the extensions .dylib.

#!/bin/bash
sofiles="/usr/local/Cellar/root/5.34.34/lib/root/lib*.so"

for filepath in ${sofiles}
do
filehead=${filepath%.so}
ln -s ${filepath} ${filehead}.dylib
done

I do not know if this is a correct way, but the ghci now seems to work (and I got different
an error, but it is a different topic). Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants