Hi Johannes,

 > ghc-7.0 is working but when I use it to compile 7.4,
 > it breaks with some linker error (relocation R_X86_64_PC32 ...)
 > it also suggests "recompile with -fPIC" but I don't see how.

I seem to remember that this is a problem with the old version of
GCC that's used to build the compiler. It can we avoided, though, by
disabling optimizations.

Try adding the following lines to a file called "mk/build.mk" before
running the build:

GhcLibWays = v
SRC_HC_OPTS        = -H64m -O0 -fasm    # -O -H64m
GhcStage1HcOpts    = -O -fasm
GhcStage2HcOpts    = -O0 -fasm          # -O2 -fasm
GhcLibHcOpts       = -O -fasm           # -O2 -XGenerics
GhcHcOpts          = -Rghc-timing
# GhcLibWays      += p
# GhcLibWays      += dyn
NoFibWays          =
STRIP_CMD          = :

I attached the RPM spec file that I used to build GHC 7.0.4 on
CentOS. It's quite likely that you can use it to automate the 7.4.x
build after editing some version numbers and file paths in it.

Good luck! :-)

Peter


Name:           ghc
Version:        7.0.4
Release:        1

Summary:        Glorious Haskell Compiler
License:        BSD
Group:          Compiler
URL:            http://haskell.org/ghc

Prefix:         /opt/ghc/7.0.4
BuildArch:      x86_64
ExclusiveArch:  x86_64
ExclusiveOS:    Linux

Source:         %{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  ghc == 6.12.3
BuildRequires:  make
BuildRequires:  perl
BuildRequires:  python
BuildRequires:  gmp-devel
BuildRequires:  ncurses-devel
BuildRequires:  zlib-devel
BuildRequires:  gcc
Requires:       gmp-devel
Requires:       ncurses-devel
Requires:       zlib-devel
Requires:       gcc

%description
Glorious Haskell Compiler

%clean
%{__rm} -rf %{buildroot}

%prep
%setup

%build
cat >mk/build.mk <<EOF
GhcLibWays = v
SRC_HC_OPTS        = -H64m -O0 -fasm    # -O -H64m
GhcStage1HcOpts    = -O -fasm
GhcStage2HcOpts    = -O0 -fasm          # -O2 -fasm
GhcLibHcOpts       = -O -fasm           # -O2 -XGenerics
GhcHcOpts          = -Rghc-timing
# GhcLibWays      += p
# GhcLibWays      += dyn
NoFibWays          =
STRIP_CMD          = :
EOF
./configure --prefix=%{prefix} --with-ghc=/opt/ghc/6.12.3/bin/ghc
make

%install
%{__rm} -rf %{buildroot}
make DESTDIR=%{buildroot} install

%files
%defattr(644,root,root,755)
%dir %{prefix}
%attr(755,root,root) %{prefix}/bin/ghc
%attr(755,root,root) %{prefix}/bin/ghc-%{version}
%attr(755,root,root) %{prefix}/bin/ghc-pkg
%attr(755,root,root) %{prefix}/bin/ghc-pkg-%{version}
%attr(755,root,root) %{prefix}/bin/ghci
%attr(755,root,root) %{prefix}/bin/ghci-%{version}
%attr(755,root,root) %{prefix}/bin/haddock
%attr(755,root,root) %{prefix}/bin/haddock-ghc-%{version}
%attr(755,root,root) %{prefix}/bin/hp2ps
%attr(755,root,root) %{prefix}/bin/hpc
%attr(755,root,root) %{prefix}/bin/hsc2hs
%attr(755,root,root) %{prefix}/bin/runghc
%attr(755,root,root) %{prefix}/bin/runhaskell
%{prefix}/lib
%{prefix}/share
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/ghc
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/ghc-pkg
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/haddock
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/hsc2hs
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/runghc
%attr(755,root,root) %{prefix}/lib/ghc-%{version}/unlit

%changelog
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to