做GHC编译的二进制文件需要GHC或者是他们自包含的? [英] Do ghc-compiled binaries require GHC or are they self-contained?

查看:125
本文介绍了做GHC编译的二进制文件需要GHC或者是他们自包含的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果一个朋友要我跑Haskell的二进制文件,他是否需要先安装Haskell中,或可他立即通过自身运行的二进制?

If a friend wants to run my Haskell binaries, does he have to first install Haskell, or can he immediately run the binary by itself?

是答案在Mac,Windows和Linux?

Is the answer the same on Mac, Windows, and Linux?

推荐答案

GHC并产生独立的二进制文件,不需要进行安装GHC本身,但是他们做的链接对一些动态库,最主要的是 libgmp 。其余的库通常发现,在大多数Linux系统的方块。我相信这种情况是在Windows上相似。

GHC does produce stand-alone binaries that do not require GHC itself to be installed, however they do link against some dynamic libraries, most notably libgmp. The remaining libraries are commonly found out of the box on most Linux systems. I believe the situation is similar on Windows.

您可以检查您取决于使用 LDD Linux上的哪些动态库。下面是我得到在Ubuntu纳蒂一个简单的Hello World程序:

You can check which dynamic libraries you depend on using ldd on Linux. Here's what I get on Ubuntu Natty for a simple Hello World program:

$ echo 'main = putStrLn "Hello World"' > Hello.hs                                                   
$ ghc --make Hello.hs                                                                     
[1 of 1] Compiling Main             ( Hello.hs, Hello.o )
Linking Hello ...
$ ldd Hello                                                                                
    linux-vdso.so.1 =>  (0x00007fffe45ff000)
    libgmp.so.3 => /usr/lib/libgmp.so.3 (0x00007f8874cf9000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8874a74000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f887486b000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8874667000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f88742d3000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f88740b4000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8874f7a000)

这篇关于做GHC编译的二进制文件需要GHC或者是他们自包含的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆