需要sudo才能在OSx上运行ghci [英] Requiring sudo to run ghci on OSx
问题描述
当我尝试执行ghci时,发生以下错误:
GHCi,版本7.8.4:http://www.haskell.org/ghc/:?寻求帮助
加载包ghc-prim ...链接...完成。
加载包integer-gmp ...链接...完成。
正在加载软件包...<命令行>:无法加载.so / .DLL for:libiconv.dylib(dlopen(libiconv.dylib,9):image not found)
如果我使用sudo(sudo ghci)执行,它将正常运行。
我尝试使用默认安装程序进行安装,使用自制软件并使用Yann Esposito提供的脚本( http://yannesposito.com/Scratch/en/blog/Safer-Haskell-Install/ ),而不会改变这种行为。我错过了什么?
最后,我发现了答案:
问题出在我的DYLD_FALLBACK_LIBRARY_PATH上。该值已定义到我的POSTGRESQL bin文件夹的目录中。所以,我添加了dyld(man dyld)手册页指出的推荐值,重新加载了我的.bash_profile,现在我的ghci,cabal和ghc工作正常。
建议的值是:
$ HOME / lib:/ usr / local / lib:/ lib:/ usr / lib
I've installed the Haskell platform on my OSX (Yosemite).
When I try to execute the ghci, the following error occurs:
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... <command line>: can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 9): image not found)
If I execute using sudo (sudo ghci), it runs normally. The same behavior occurs with cabal.
I've tried to install using the default installer, using homebrew and using the script provided by Yann Esposito (http://yannesposito.com/Scratch/en/blog/Safer-Haskell-Install/), without changes in this behavior. Am I missing something?
Finally, I've discovered the answer:
The problem is with my DYLD_FALLBACK_LIBRARY_PATH. The value was defined to the directory of my POSTGRESQL bin folder. So, I've appended the recommended values pointed by the man page of dyld (man dyld), reloaded my .bash_profile and now my ghci, cabal and ghc are working smoothly.
The recommended value is: "$HOME/lib:/usr/local/lib:/lib:/usr/lib"
这篇关于需要sudo才能在OSx上运行ghci的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!