Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Tuesday, September 1, 2009

Installing JHC Via Cabal on Haskell Platform

Haskell Platform may make us happier. I tried to install jhc the haskell compiler via cabal of my haskell platform.

$ cabal install jhc -v
/usr/bin/ghc --numeric-version
looking for package tool: ghc-pkg near compiler in /usr/bin
found package tool in /usr/bin/ghc-pkg
/usr/bin/ghc-pkg --version
/usr/bin/ghc --supported-languages
Reading installed packages...
/usr/bin/ghc-pkg dump --global
/usr/bin/ghc-pkg dump --user
Reading available packages...
Resolving dependencies...
selecting jhc-0.5.20081118.3 (hackage) and discarding jhc-0.5.20081118,
0.5.20081118.1 and 0.5.20081118.2
selecting base-3.0.3.1 (installed) and 4.1.0.0 (installed) and discarding
syb-0.1.0.0 and 0.1.0.1
selecting ghc-prim-0.1.0.0 (installed)
selecting integer-0.1.0.1 (installed)
selecting rts-1.0 (installed)
selecting syb-0.1.0.1 (installed)
In order, the following would be installed:
jhc-0.5.20081118.3 (new package)
jhc-0.5.20081118.3 has already been downloaded.
Extracting
/Users/ujihisa/.cabal/packages/hackage.haskell.org/jhc/0.5.20081118.3/jhc-0.5.20081118.3.tar.gz
to
/var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/jhc-0.5.20081118.342599...
Configuring jhc-0.5.20081118.3...
Dependency base -any && ==3.0.3.1: using base-3.0.3.1
Using Cabal-1.6.0.3 compiled by ghc-6.10
Using compiler: ghc-6.10.3
Using install prefix: /Users/ujihisa/.cabal
Binaries installed in: /Users/ujihisa/.cabal/bin
Libraries installed in:
/Users/ujihisa/.cabal/lib/jhc-0.5.20081118.3/ghc-6.10.3
Private binaries installed in: /Users/ujihisa/.cabal/libexec
Data files installed in: /Users/ujihisa/.cabal/share/jhc-0.5.20081118.3
Documentation installed in: /Users/ujihisa/.cabal/share/doc/jhc-0.5.20081118.3
Using alex version 2.3.1 found on system at: /opt/local/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.0.1 found on system at: /usr/bin/gcc
Using ghc version 6.10.3 found on system at: /usr/bin/ghc
Using ghc-pkg version 6.10.3 found on system at: /usr/bin/ghc-pkg
No greencard found
Using haddock version 2.4.2 found on system at: /usr/bin/haddock
Using happy version 1.18.2 found on system at: /usr/local/bin/happy
No hmake found
Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No nhc98 found
Using pkg-config version 0.23 found on system at: /opt/local/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
/usr/bin/gcc /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/42599.c -o /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/42599 -D__GLASGOW_HASKELL__=610 -I. -I/Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.3/base-4.1.0.0/include -I/Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.3/include -IPAPI_INCLUDE_DIR
cabal: Package jhc-0.5.20081118.3 can't be built on this system.
cabal: Error: some packages failed to install:
jhc-0.5.20081118.3 failed during the building phase. The exception was:
exit: ExitFailure 1

;-(

So, as blackdog suggested, I decided to build jhc by the source code.

jhc official site explains first I have to get source by darcs, but at the time I didn't have it. Let's install darcs.

$ cabal install darcs
Resolving dependencies...
[1 of 2] Compiling Distribution.ShellHarness ( /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/darcs-2.3.099527/darcs-2.3.0/Distribution/ShellHarness.hs, /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/darcs-2.3.099527/darcs-2.3.0/dist/setup/Distribution/ShellHarness.o )
[2 of 2] Compiling Main             ( /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/darcs-2.3.099527/darcs-2.3.0/Setup.lhs, /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/darcs-2.3.099527/darcs-2.3.0/dist/setup/Main.o )
Linking /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/darcs-2.3.099527/darcs-2.3.0/dist/setup/setup ...
Configuring darcs-2.3.0...
Preprocessing library darcs-2.3.0...
Preprocessing executables for darcs-2.3.0...
Building darcs-2.3.0...

src/Darcs/Commands/Optimize.lhs:26:7:
    Could not find module `Text.Regex':
      There are files missing in the `regex-compat-0.92' package,
      try running 'ghc-pkg check'.
      Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
darcs-2.3.0 failed during the building phase. The exception was:
exit: ExitFailure 1

What. OK. I have to do ghc-pkg check. I see.

$ ghc-pkg check
There are problems in package network-2.2.1.4:
  import-dirs: /Users/ujihisa/.cabal/lib/network-2.2.1.4/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/network-2.2.1.4/ghc-6.10.3 doesn't exist or isn't a directory
  include-dirs: /Users/ujihisa/.cabal/lib/network-2.2.1.4/ghc-6.10.3/include doesn't exist or isn't a directory
  file Network.hi is missing
  file Network/BSD.hi is missing
  file Network/Socket/Internal.hi is missing
  file Network/Socket.hi is missing
  file Network/URI.hi is missing
  cannot find libHSnetwork-2.2.1.4.a on library path
There are problems in package HTTP-4000.0.7:
  import-dirs: /Users/ujihisa/.cabal/lib/HTTP-4000.0.7/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/HTTP-4000.0.7/ghc-6.10.3 doesn't exist or isn't a directory
  file Network/BufferType.hi is missing
  file Network/Stream.hi is missing
  file Network/StreamDebugger.hi is missing
  file Network/StreamSocket.hi is missing
  file Network/TCP.hi is missing
  file Network/HTTP.hi is missing
  file Network/HTTP/Headers.hi is missing
  file Network/HTTP/Base.hi is missing
  file Network/HTTP/Stream.hi is missing
  file Network/HTTP/HandleStream.hi is missing
  file Network/Browser.hi is missing
  file Network/HTTP/Base64.hi is missing
  file Network/HTTP/MD5.hi is missing
  file Network/HTTP/MD5Aux.hi is missing
  file Network/HTTP/Utils.hi is missing
  cannot find libHSHTTP-4000.0.7.a on library path
There are problems in package regex-base-0.93.1:
  import-dirs: /Users/ujihisa/.cabal/lib/regex-base-0.93.1/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/regex-base-0.93.1/ghc-6.10.3 doesn't exist or isn't a directory
  file Text/Regex/Base.hi is missing
  file Text/Regex/Base/RegexLike.hi is missing
  file Text/Regex/Base/Context.hi is missing
  file Text/Regex/Base/Impl.hi is missing
  cannot find libHSregex-base-0.93.1.a on library path
There are problems in package regex-posix-0.94.1:
  import-dirs: /Users/ujihisa/.cabal/lib/regex-posix-0.94.1/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/regex-posix-0.94.1/ghc-6.10.3 doesn't exist or isn't a directory
  file Text/Regex/Posix.hi is missing
  file Text/Regex/Posix/Wrap.hi is missing
  file Text/Regex/Posix/String.hi is missing
  file Text/Regex/Posix/Sequence.hi is missing
  file Text/Regex/Posix/ByteString.hi is missing
  file Text/Regex/Posix/ByteString/Lazy.hi is missing
  cannot find libHSregex-posix-0.94.1.a on library path
There are problems in package regex-compat-0.92:
  import-dirs: /Users/ujihisa/.cabal/lib/regex-compat-0.92/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/regex-compat-0.92/ghc-6.10.3 doesn't exist or isn't a directory
  file Text/Regex.hi is missing
  cannot find libHSregex-compat-0.92.a on library path
There are problems in package time-1.1.4:
  import-dirs: /Users/ujihisa/.cabal/lib/time-1.1.4/ghc-6.10.3 doesn't exist or isn't a directory
  library-dirs: /Users/ujihisa/.cabal/lib/time-1.1.4/ghc-6.10.3 doesn't exist or isn't a directory
  include-dirs: /Users/ujihisa/.cabal/lib/time-1.1.4/ghc-6.10.3/include doesn't exist or isn't a directory
  file Data/Time/Calendar.hi is missing
  file Data/Time/Calendar/MonthDay.hi is missing
  file Data/Time/Calendar/OrdinalDate.hi is missing
  file Data/Time/Calendar/WeekDate.hi is missing
  file Data/Time/Calendar/Julian.hi is missing
  file Data/Time/Calendar/Easter.hi is missing
  file Data/Time/Clock.hi is missing
  file Data/Time/Clock/POSIX.hi is missing
  file Data/Time/Clock/TAI.hi is missing
  file Data/Time/LocalTime.hi is missing
  file Data/Time/Format.hi is missing
  file Data/Time.hi is missing
  file Data/Time/Calendar/Private.hi is missing
  file Data/Time/Calendar/Days.hi is missing
  file Data/Time/Calendar/Gregorian.hi is missing
  file Data/Time/Calendar/JulianYearDay.hi is missing
  file Data/Time/Clock/Scale.hi is missing
  file Data/Time/Clock/UTC.hi is missing
  file Data/Time/Clock/CTimeval.hi is missing
  file Data/Time/Clock/UTCDiff.hi is missing
  file Data/Time/LocalTime/TimeZone.hi is missing
  file Data/Time/LocalTime/TimeOfDay.hi is missing
  file Data/Time/LocalTime/LocalTime.hi is missing
  file Data/Time/Format/Parse.hi is missing
  cannot find libHStime-1.1.4.a on library path
There are problems in package rts-1.0:
  include-dirs: PAPI_INCLUDE_DIR doesn't exist or isn't a directory

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
network-2.2.1.4
HTTP-4000.0.7
regex-base-0.93.1
regex-posix-0.94.1
regex-compat-0.92
time-1.1.4
rts-1.0
binary-0.5.0.1
digest-0.0.0.6
utf8-string-0.3.5
zip-archive-0.1.1.3
Diff-0.1.2
QuickCheck-2.1.0.1
binary-0.5
derive-0.1.4
dlist-0.5
fingertree-0.0.1.0
ghc-paths-0.1.0.5
pureMD5-1.0.0.0
rosezipper-0.1
split-0.1.1
terminfo-0.3.0.2
transformers-0.1.4.0
data-accessor-0.2.0.2
monads-fd-0.0.0.1
data-accessor-monads-fd-0.2
pointedlist-0.3.5
uniplate-1.2.0.3
unix-compat-0.1.2.1
utility-ht-0.0.5.1
data-accessor-template-0.2.1.1
vty-3.1.8.4
language-c-0.3.1.1
haskeline-0.6.1.6
mmap-0.4.1
zlib-0.5.2.0
hashed-storage-0.3.7
haddock-2.4.2
ghc-6.10.3
ghc-prim-0.1.0.0
integer-0.1.0.1
base-4.1.0.0
syb-0.1.0.1
base-3.0.3.1
array-0.2.0.0
packedstring-0.1.0.1
containers-0.2.0.1
bytestring-0.9.1.4
old-locale-1.0.0.1
old-time-1.0.0.2
filepath-1.1.0.2
unix-2.3.2.0
directory-1.0.0.3
process-1.0.1.1
pretty-1.0.1.0
hpc-0.5.0.3
template-haskell-2.3.0.1
Cabal-1.6.0.3
random-1.0.0.1
haskell98-1.0.1.0
extensible-exceptions-0.1.1.0
network-2.2.1
time-1.1.3
dph-base-0.3
dph-prim-interface-0.3
dph-prim-seq-0.3
dph-prim-par-0.3
dph-seq-0.3
dph-par-0.3
OpenGL-2.2.1.1
network-2.2.1.1
haskell-src-1.0.1.3
GLUT-2.1.1.2
regex-base-0.72.0.2
QuickCheck-1.2.0.0
mtl-1.1.0.2
HUnit-1.2.0.3
cgi-3001.1.7.1
html-1.0.1.2
editline-0.2.1.0
stm-2.1.1.2
regex-posix-0.72.0.3
regex-compat-0.71.0.1
parsec-2.1.0.1
parallel-1.1.0.1
HTTP-4000.0.6
fgl-5.4.2.2
zlib-0.5.0.0
xhtml-3000.2.0.1
time-1.1.2.4

?

$ cabal reinstall regex-compat
unrecognised command: reinstall (try --help)
$ cabal install regex-compat --reinstall
Resolving dependencies...
Downloading regex-compat-0.92...
Configuring regex-compat-0.92...
Preprocessing library regex-compat-0.92...
Building regex-compat-0.92...

Text/Regex.hs:35:7:
    Could not find module `Text.Regex.Posix':
      There are files missing in the `regex-posix-0.94.1' package,
      try running 'ghc-pkg check'.
      Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
regex-compat-0.92 failed during the building phase. The exception was:
exit: ExitFailure 1

???

OK. I forget them. Let's install by stable tar ball. http://repetae.net/dist/jhc-0.7.2.tar.gz this one.

$ cd src
$ wget http://repetae.net/dist/jhc-0.7.2.tar.gz                                                          [20:35:46]
$ cd jhc-0.7.2
$ ./configure --prefix=`pwd`/jhc
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ac-macros/install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i386-apple-darwin9.8.0
checking host system type... i386-apple-darwin9.8.0
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking for ghc... /usr/bin/ghc
checking for DrIFT... no
DrIFT not found: using preprocessed files
checking for module Data.Generics.Instances... in package syb
checking for hsc2hs... /usr/bin/hsc2hs
configure: creating ./config.status
config.status: creating Makefile
config.status: creating jhc.spec
config.status: creating src/Version/Config.hs
config.status: creating docs/building.mkd
config.status: creating src/cbits/config.h
$ make && make install
make  all-am
/usr/bin/ghc  -fbang-patterns -O -hide-all-packages -package base -package syb  -W -fno-warn-unused-matches  -fwarn-type-defaults -i -i./drift_processed -i./src  -i./src -odir ./src -hidir ./src -package fgl -package regex-compat -package random -package array -package readline -package directory -package bytestring -package binary -package pretty -package mtl -package containers -package unix  -package haskell98 -package utf8-string  -package zlib -fallow-undecidable-instances  -fglasgow-exts -fallow-overlapping-instances --make src/Main.hs src/StringTable/StringTable_cbits.o  src/cbits/md5sum.o -o jhc

on the commandline:
    Warning: -fbang-patterns is deprecated: use -XBangPatterns or pragma {-# LANGUAGE BangPatterns#-} instead

on the commandline:
    Warning: -fallow-undecidable-instances is deprecated: use -XUndecidableInstances or pragma {-# LANGUAGE UndecidableInstances#-} instead

on the commandline:
    Warning: -fallow-overlapping-instances is deprecated: use -XOverlappingInstances or pragma {-# LANGUAGE OverlappingInstances#-} instead
<command line>: unknown package: readline
make[1]: *** [jhc] Error 1
make: *** [all] Error 2

I gave up.

10 comments:

  1. John hasn't packaged JHC for cabal, you have to install it manually. If there's a version in Cabal, it's very old... go to http://repetae.net/computer/jhc/building.shtml, tell me if there are problems, and submit a doco patch for Hubris :)

    ReplyDelete
  2. Thanks. I tried, but I failed ;(
    I updated this blog post now.

    ReplyDelete
  3. Hi! The last error is just saying you need to install readline.

    $ cabal install readline

    ReplyDelete
  4. Can you tell us what your system is? You should fix ghc-pkg. I also encourage you to post to the jhc list, they are very friendly.

    ReplyDelete
  5. Thanks paulo,

    My system is OS X Leopard and Haskell Platform.

    $ ghc-pkg --version
    GHC package manager version 6.10.3

    I think I must have made some mistakes. For example, my Mac has both ports ghc and Haskell platform's. I'll try more, however I failed, Ill post jhc list.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. You can cabal install ajhc.
    And perhaps jhc will merge my patch.

    http://www.haskell.org/pipermail/jhc/2013-April/001047.html

    ReplyDelete

Followers