Newbie building GHC

Sigbjorn Finne sof at galois.com
Thu Sep 26 15:22:15 EDT 2002


Oops, while trivial, I forgot to include the main.c test
wrapper:

foo$ cat main.c
#include <stdio.h>
extern int invokeCmd(char* cmd);

int main() {
  printf("%d\n", invokeCmd("uname"));
  return 0;
}


--sigbjorn

----- Original Message ----- 
From: "Sigbjorn Finne" <sof at galois.com>
To: <glasgow-haskell-bugs at haskell.org>
Cc: <seth at cql.com>; "Saswat Anand" <saswat at comp.nus.edu.sg>
Sent: Thursday, September 26, 2002 12:18
Subject: Re: Newbie building GHC


> Here's more background info:
> 
> - On a Redhat 7.2 box, install the ghc-5.04.1 RPM
> - do the following:
> 
> rh7.2$ cat M.hs
> module M where { import System; main = system "uname" >>= print }
> rh7.2$ ghc -o m M.hs
> rh7.2$ ./m
> ExitFailure 127
> 
> You can also reproduce this using just C code by compiling
> up the attached invoke.c file on a RedHat 7.3 box, and
> then linking it together with this little test stub on a RH7.2
> box:
> 
> rh7.3$ gcc --version
> 2.96
> rh7.3$ gcc -O -c invoke.c
> 
> -----------------------------------
> 
> rh7.2$ gcc --version
> 2.96
> rh7.2$ gcc -o main main.c invoke.o
> rh7.2$ ./main
> 127
> rh7.2$ 
> 
> Peering at the generated binaries and assembly output, it
> appears as if BFD (=> assembler/linker) has changed
> the code it emits to refer to strings in the read-only
> data section. 
> 
> Fascinating though that is, avoiding mixing code built on
> these two 'platforms' is probably the only valuable piece
> of info to take away from all this.
> 
> May I suggest the GHC downloads page drops the claim
> that the 5.04.1 RPMs will work under RH7.2?
> 
> --sigbjorn
> 
> ----- Original Message ----- 
> From: "Sigbjorn Finne" <sof at galois.com>
> To: "Saswat Anand" <saswat at comp.nus.edu.sg>
> Cc: <seth at cql.com>; <glasgow-haskell-bugs at haskell.org>
> Sent: Thursday, September 26, 2002 08:52
> Subject: Re: Newbie building GHC
> 
> 
> > Hi there,
> > 
> > we've been running into similar problems here on a Redhat 7.2
> > box using the ghc-5.04.1 RPM (which was built on RedHat 7.3).
> > The salient line from your strace output is the following one:
> > 
> > [pid  1514] execve("n/sh", ["/bin/sh", "-c", "gcc Adjustor.c
> > -o /tmp/ghc1513.s"...], [/* 36 vars */])
> >   = -1 ENOENT (No such file or directory)
> > 
> > execl() (called by System.system) is somehow causing execve()
> > to be invoked with a stripped off command arg.
> > 
> > The cause of this suspected outbreak of Linux versionitis is as yet
> > unknown (gcc? glibc?..), but you may want to try installing the
> > .tar.bz2 instead (which was built on a RH 7.2 box.) That worked
> > around the problem here, at least.
> > 
> > hth
> > --sigbjorn
> > 
> 
> 




More information about the Glasgow-haskell-bugs mailing list