Bug: --make non-functional on GHC compiler

Samuel A. Falvo II sam.falvo at gmail.com
Sat Mar 10 12:08:45 EST 2007


Required Information:

1.  What kind of machine are you running on, and exactly what version
of the operating system are you using? (on a Unix system, uname -a or
cat /etc/motd will show the desired information.)

$ uname -a

Linux aldeberan 2.6.16.13-3c95x #3 PREEMPT Tue May 2 23:16:59 PDT 2006
i686 unknown unknown GNU/Linux


2.  What version of GCC are you using? gcc -v will tell you.

bash-2.05b$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/specs
Configured with: ../gcc-3.3.4/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking
--with-gnu-ld --verbose --target=i486-slackware-linux
--host=i486-slackware-linux
Thread model: posix
gcc version 3.3.4

3.  Run the sequence of compiles/runs that caused the offending
behaviour, capturing all the input/output in a "script" (a UNIX
command) or in an Emacs shell window. We'd prefer to see the whole
thing.

bash-2.05b$ cat Main.hs
module CutParse(main) where

main :: IO ()
main = do putStr "Hello world!"

bash-2.05b$ ghc --make -v Main
Glasgow Haskell Compiler, Version 6.4.1, for Haskell 98, compiled by
GHC version 6.2.2
Using package config file: /usr/local/lib/ghc-6.4.1/package.conf
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: Main
Stable modules:
*** Compiling CutParse         ( Main.hs, interpreted ):
compile: input file Main.hs
*** Checking old interface for CutParse:
Compiling CutParse         ( Main.hs, Main.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 30
*** Simplify:
    Result size = 6
*** Tidy Core:
    Result size = 6
*** CorePrep:
    Result size = 8
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler
gcc -I. -c /tmp/ghc11833.s -o Main.o
*** Deleting temp files
Deleting: /tmp/ghc11833.s
Upsweep completely successful.
*** Deleting temp files
Deleting:
link(batch): upsweep (partially) failed OR
   Main.main not exported; not linking.
*** Deleting temp files
Deleting:
bash-2.05b$ ls
Main.hi  Main.hs  Main.o

NOTE: I have verified this problem exists with both the GHC 6.2.2 and
6.4.1 compilers.  I do not yet have 6.6.x due to the hours it takes to
compile on my box.

5.  What is the program behaviour that is wrong, in your opinion?

According to two sources:

* http://haskell.org/ghc/docs/6.4/html/users_guide/modes.html#make-mode
* ghc --help

I should be able to "simply" invoke the --make option to have it build
a complete program.  The program was reduced to a simple "Hello world"
program for the sake of demonstration in this bug.  However, nothing I
do convinces GHC to produce an executable, as per provided
documentation.

Folks on IRC also suggested using the --main-is= flag, as follows:

bash-2.05$ ghc --make -v --main-is=Main.main Main

however, this also produces the same result -- no executable binary.

6.  If practical, please send enough source files for us to duplicate
the problem.

See attached file.

I should point out that, in all honesty, I think this is a bug with
the documentation more than a bug with GHC itself; clearly, GHC 6.2.2
was used to *build* GHC 6.4.1, so it MUST be possible to emit
binaries.  The trick is giving it the right options to do so.  My
thinking is that the documentation is not correct in this area.

Alternatively, --make itself may be buggy, and that GHC 6.4.1 was
built without using it.

Either way, there is a fundamental disconnect between docs and reality.  :)

Thank you.

-- 
Samuel A. Falvo II
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main.hs
Type: text/x-haskell
Size: 75 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20070310/2b6f059b/Main.bin


More information about the Glasgow-haskell-bugs mailing list