免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: drunkedcat
打印 上一主题 下一主题

ghc 安装(已解决 见 22 楼) [复制链接]

论坛徽章:
0
14 [报告]
发表于 2008-09-09 16:39 |只看该作者
我的安装信息
fuqiang@fuqiang-laptop:~$ ghc --help
Usage:

    ghc-6.8.2 [command-line-options-and-input-files]

To compile and link a complete Haskell program, run the compiler like
so:

    ghc-6.8.2 --make Main

where the module Main is in a file named Main.hs (or Main.lhs) in the
current directory.  The other modules in the program will be located
and compiled automatically, and the linked program will be placed in
the file `a.out' (or `Main.exe' on Windows).

Alternatively, ghc-6.8.2 can be used to compile files individually.  Each
input file is guided through (some of the) possible phases of a
compilation:

    - unlit:        extract code from a "literate program"
    - hscpp:        run code through the C pre-processor (if -cpp flag given)
    - hsc:        run the Haskell compiler proper
    - gcc:        run the C compiler (if compiling via C)
    - as:        run the assembler
    - ld:        run the linker

For each input file, the phase to START with is determined by the
file's suffix:

    - .lhs        literate Haskell                 unlit
    - .hs        plain Haskell                         ghc
    - .hc        C from the Haskell compiler         gcc
    - .c        C not from the Haskell compiler  gcc
    - .s        assembly language                 as
    - other        passed directly to the linker         ld

The phase at which to STOP processing is determined by a command-line
option:

    -E                stop after generating preprocessed, de-litted Haskell
                     (used in conjunction with -cpp)
    -C                stop after generating C (.hc output)
    -S                stop after generating assembler (.s output)
    -c                stop after generating object files (.o output)

Other commonly-used options are:

    -v[n]            Control verbosity (n is 0--5, normal verbosity level is 1,
                      -v alone is equivalent to -v3)

    -fglasgow-exts  Allow Glasgow extensions (unboxed types, etc.)

    -O                    An `optimising' package of compiler flags, for faster code

    -prof            Compile for cost-centre profiling
                     (add -auto-all for automagic cost-centres on all
                      top-level functions)

    -H14m            Increase compiler's heap size (might make compilation
                    faster, especially on large source files).

    -M              Output Makefile rules recording the
                    dependencies of a list of Haskell files.

Given the above, here are some TYPICAL invocations of ghc-6.8.2:

    # compile a Haskell module to a .o file, optimising:
    % ghc-6.8.2 -c -O Foo.hs
    # link three .o files into an executable called "test":
    % ghc-6.8.2 -o test Foo.o Bar.o Baz.o
    # compile a Haskell module to C (a .hc file), using a bigger heap:
    % ghc-6.8.2 -C -H16m Foo.hs
    # compile Haskell-produced C (.hc) to assembly language:
    % ghc-6.8.2 -S Foo.hc

The User's Guide has more information about GHC's *many* options.  An
online copy can be found here:

   http://www.haskell.org/ghc/documentation.html


[ 本帖最后由 fuqiang_huang 于 2008-9-9 16:48 编辑 ]

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
13 [报告]
发表于 2008-09-09 16:28 |只看该作者
原帖由 drunkedcat 于 2008-9-9 16:16 发表
安 LFS 时,是安了 ncurses 的,
我的 /usr/lib 里有个 libncurses.so
可是我
ln -s libncurses.so libncurses.so.5 之后,就说 file too short 了。

ncurses 的版本对么?ghci 需要的是第 5 版的。

论坛徽章:
0
12 [报告]
发表于 2008-09-09 16:16 |只看该作者
安 LFS 时,是安了 ncurses 的,
我的 /usr/lib 里有个 libncurses.so
可是我
ln -s libncurses.so libncurses.so.5 之后,就说 file too short 了。
奇怪
先忍两天,现在用着 hugs,这个东西倒是安装起来很方便。

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
11 [报告]
发表于 2008-09-09 14:38 |只看该作者
原帖由 drunkedcat 于 2008-9-9 13:40 发表
多谢楼上各位。用 6.8.2 的 bin 版,安装成功
可是运行 ghc 或 ghci 都提示
/usr/lib/ghc-6.8.2/ghc-6.8.2: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

这说明你应该安装 ncurses 的运行时库。


这几天正在看 yaht, 看完了写个心得,感谢一下论坛。

期待你的心得。

论坛徽章:
0
10 [报告]
发表于 2008-09-09 13:40 |只看该作者
多谢楼上各位。用 6.8.2 的 bin 版,安装成功
可是运行 ghc 或 ghci 都提示
/usr/lib/ghc-6.8.2/ghc-6.8.2: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

我作了一个 libncurses.so 的链接之后,提示

file too short
安装了一个 hugs ,倒是可以用。

看来先用 hugs 学习了。
等有了什么新的办法再来想怎么样安 ghc.毕竟 hugs 只能解释不能编译。

这几天正在看 yaht, 看完了写个心得,感谢一下论坛。

期待更好的解决方案。

[ 本帖最后由 drunkedcat 于 2008-9-9 13:58 编辑 ]

论坛徽章:
0
9 [报告]
发表于 2008-09-09 10:29 |只看该作者
我用ubuntu 8.04源中的<正常>
其它安装出现问题多数是库比较老的缘故&设定问题。

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
8 [报告]
发表于 2008-09-09 10:08 |只看该作者
原帖由 drunkedcat 于 2008-9-9 08:23 发表
但是我执行 ./configure --prefix=/usr 或者 ./configure 都说
$./configure --prefix=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Which we'll further canonicalise into: i386-unknown-linux
checking for path to top of build tree... configure: error: cannot determine current directory

会是什么原因呢?

这个是由于你系统所用的 glibc 库比较老的缘故。试下 6.8.2,这个应该没问题。如果你实在想用 6.8.3,可以用 6.8.2 从源码编译。

论坛徽章:
0
7 [报告]
发表于 2008-09-09 08:23 |只看该作者

http://haskell.org/ghc/download_ghc_683.html#x86linux
这个官方网址下载的
ghc-6.8.3-i386-unknown-linux.tar.bz2。

其中的 INSTALL 中说

This distribution can be installed in a location of your choosing.

To set the ball rolling, run the configure script (as usual, run the
script with --help to see what options it supports).  eg. to set up
the package for installing in directory <my-dir>, use

        ./configure --prefix=<my-dir>

The default installation directory is /usr/local.

The configure script will figure out what platform you're running on,
and a couple of other interesting pieces of trivia, which it will then
fill in the Makefile.in template to give you a real Makefile.  If
you're of a paranoid persuasion, you might want to take a look at this
Makefile to see if the information is correct.

Now run:

        make install

(`make show-install-setup' prints the details of where the different
pieces of the bundle are heading when -- possibly helpful).

但是我执行 ./configure --prefix=/usr 或者 ./configure 都说
$./configure --prefix=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
Which we'll further canonicalise into: i386-unknown-linux
checking for path to top of build tree... configure: error: cannot determine current directory

会是什么原因呢?

论坛徽章:
95
程序设计版块每日发帖之星
日期:2015-09-05 06:20:00程序设计版块每日发帖之星
日期:2015-09-17 06:20:00程序设计版块每日发帖之星
日期:2015-09-18 06:20:002015亚冠之阿尔艾因
日期:2015-09-18 10:35:08月度论坛发贴之星
日期:2015-09-30 22:25:002015亚冠之阿尔沙巴布
日期:2015-10-03 08:57:39程序设计版块每日发帖之星
日期:2015-10-05 06:20:00每日论坛发贴之星
日期:2015-10-05 06:20:002015年亚冠纪念徽章
日期:2015-10-06 10:06:482015亚冠之塔什干棉农
日期:2015-10-19 19:43:35程序设计版块每日发帖之星
日期:2015-10-21 06:20:00每日论坛发贴之星
日期:2015-09-14 06:20:00
6 [报告]
发表于 2008-09-08 23:41 |只看该作者
原帖由 drunkedcat 于 2008-9-8 21:02 发表
谢谢楼上各位.
我安 bin 版时,提示说"不能认识当前路径",....
安 bin 版有什么要注意的吗?

多给点详细信息吧,例如你从什么地方得到的哪个二进制包?安装时的具体错误信息等等。

论坛徽章:
0
5 [报告]
发表于 2008-09-08 21:02 |只看该作者
谢谢楼上各位.
我安 bin 版时,提示说"不能认识当前路径",....
安 bin 版有什么要注意的吗?
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP