Having difficulty with GHC 6.2 -main-is flag on Windows
Graham Klyne
gk at ninebynine.org
Tue Jan 6 17:03:53 EST 2004
Hi, I'm trying to use the new GHC -main-is flag to compile programs from
files with module names other than Main, but it doesn't seem to be working.
I've tried this under Windows 2000 and Windows XP.
Here's my test program:
[[
-- HelloWorld.hs
-- module HelloWorld where
module Main where
main :: IO ()
main = putStrLn "Hello, World"
]]
I switch the commented module line as needed below.
Sample output in what follows has been cut-and-pasted from a console
command window into this email message.
-----
Compiling the above without a -main-is flag:
[[
D:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
-iC:\Dev\Haskell\Lib\HUnit;C:\De
v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Lib\Dfa -o
HelloWorl
d.exe HelloWorld
Chasing modules from: HelloWorld
Compiling Main ( HelloWorld.hs, HelloWorld.o )
Linking ...
D:\Cvs\DEV\HaskellRDF>HelloWorld
Hello, World
]]
-----
Compiling the above with -main-is Main.main:
[[
DD:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
-iC:\Dev\Haskell\Lib\HUnit;C:\De
v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Lib\Dfa -o
HelloWorl
d.exe -main-is Main.main HelloWorld
Chasing modules from: HelloWorld
Compiling Main ( HelloWorld.hs, HelloWorld.o )
Linking ...
D:\Cvs\DEV\HaskellRDF>HelloWorld
Hello, World
]]
-----
Compiling the above with -main-is HelloWorld.main
[[
D:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
-iC:\Dev\Haskell\Lib\HUnit;C:\De
v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Lib\Dfa -o
HelloWorl
d.exe -main-is HelloWorld.main HelloWorld
Chasing modules from: HelloWorld
Compiling Main ( HelloWorld.hs, HelloWorld.o )
Linking ...
C:/DEV/ghc/ghc-6.2/libHSrts.a(Main.o)(.text+0x87):Main.c: undefined
reference to
`__stginit_ZCMain'
C:/DEV/ghc/ghc-6.2/libHSrts.a(Main.o)(.text+0xa1):Main.c: undefined
reference to
`ZCMain_main_closure'
]]
-----
Finally, changing the source code module name to HelloWorld:
[[
D:\Cvs\DEV\HaskellRDF>ghc --make -fglasgow-exts
-iC:\Dev\Haskell\Lib\HUnit;C:\De
v\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Lib\Dfa -o
HelloWorl
d.exe -main-is HelloWorld.main HelloWorld
Chasing modules from: HelloWorld
Compiling HelloWorld ( HelloWorld.hs, HelloWorld.o )
Warning: output was redirected with -o, but no output will be generated
because there is no Main module.
]]
-----
Repeating the last case with a compiler -v option
[[
D:\Cvs\DEV\HaskellRDF>ghc -v --make -fglasgow-exts
-iC:\Dev\Haskell\Lib\HUnit;C:
\Dev\Haskell\Lib\Parsec;C:\Dev\Haskell\Lib\Sort;C:\Dev\Haskell\Lib\Dfa -o
HelloW
orld.exe -main-is HelloWorld.main HelloWorld 1>a.tmp
Glasgow Haskell Compiler, Version 6.2, for Haskell 98, compiled by GHC
version 6
.0.1
Using package config file: C:\DEV\ghc\ghc-6.2\package.conf
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: HelloWorld
Stable modules:
*** Compiling HelloWorld:
compile: input file HelloWorld.hs
*** Checking old interface for HelloWorld:
Compiling HelloWorld ( HelloWorld.hs, HelloWorld.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 10
*** Simplify:
Result size = 10
Result size = 8
Result size = 8
*** Tidy Core:
Result size = 8
*** CorePrep:
Result size = 10
*** Stg2Stg:
*** CodeGen:
*** CodeOutput:
*** Assembler
C:\DEV\ghc\ghc-6.2\gcc -B"C:\DEV\ghc\ghc-6.2\gcc-lib/" -I. -c
C:\DOCUME~1\Graham
\LOCALS~1\Temp\ghc3332.s -o HelloWorld.o
*** Deleting temp files
Deleting: C:/DOCUME~1/Graham/LOCALS~1/Temp/ghc3332.s
Upsweep completely successful.
*** Deleting temp files
Deleting:
Warning: output was redirected with -o, but no output will be generated
because there is no Main module.
link(batch): upsweep (partially) failed OR
Main.main not exported; not linking.
*** Deleting temp files
Deleting:
]]
And the standard output (captured to a.tmp):
[[
==================== Packages ====================
Package
{name = "data",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/data"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSdata"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["haskell98", "lang", "util"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "rts",
auto = False,
import_dirs = [],
source_dirs = [],
library_dirs =
["C:/DEV/ghc/ghc-6.2", "C:/DEV/ghc/ghc-6.2/gcc-lib"],
hs_libraries = ["HSrts"],
extra_libraries = ["m", "gmp", "wsock32"],
include_dirs =
["C:/DEV/ghc/ghc-6.2/include", "C:/DEV/ghc/ghc-6.2/include/mingw"],
c_includes = ["Stg.h"],
package_deps = [],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts =
["-u",
"_GHCziBase_Izh_static_info",
"-u",
"_GHCziBase_Czh_static_info",
"-u",
"_GHCziFloat_Fzh_static_info",
"-u",
"_GHCziFloat_Dzh_static_info",
"-u",
"_GHCziPtr_Ptr_static_info",
"-u",
"_GHCziWord_Wzh_static_info",
"-u",
"_GHCziInt_I8zh_static_info",
"-u",
"_GHCziInt_I16zh_static_info",
"-u",
"_GHCziInt_I32zh_static_info",
"-u",
"_GHCziInt_I64zh_static_info",
"-u",
"_GHCziWord_W8zh_static_info",
"-u",
"_GHCziWord_W16zh_static_info",
"-u",
"_GHCziWord_W32zh_static_info",
"-u",
"_GHCziWord_W64zh_static_info",
"-u",
"_GHCziStable_StablePtr_static_info",
"-u",
"_GHCziBase_Izh_con_info",
"-u",
"_GHCziBase_Czh_con_info",
"-u",
"_GHCziFloat_Fzh_con_info",
"-u",
"_GHCziFloat_Dzh_con_info",
"-u",
"_GHCziPtr_Ptr_con_info",
"-u",
"_GHCziPtr_FunPtr_con_info",
"-u",
"_GHCziStable_StablePtr_con_info",
"-u",
"_GHCziBase_False_closure",
"-u",
"_GHCziBase_True_closure",
"-u",
"_GHCziPack_unpackCString_closure",
"-u",
"_GHCziIOBase_stackOverflow_closure",
"-u",
"_GHCziIOBase_heapOverflow_closure",
"-u",
"_GHCziIOBase_NonTermination_closure",
"-u",
"_GHCziIOBase_BlockedOnDeadMVar_closure",
"-u",
"_GHCziIOBase_Deadlock_closure",
"-u",
"_GHCziWeak_runFinalizzerBatch_closure",
"-u",
"___stginit_Prelude"],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "base",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSbase1", "HSbase2", "HSbase3"],
extra_libraries =
["HSbase_cbits", "wsock32", "msvcrt", "kernel32", "user32"],
include_dirs = [],
c_includes = ["HsBase.h"],
package_deps = ["rts"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "haskell98",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HShaskell98"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "haskell-src",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HShaskell-src"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["base", "haskell98"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "network",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSnetwork"],
extra_libraries = [],
include_dirs = [],
c_includes = ["HsNet.h"],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "parsec",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSparsec"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "QuickCheck",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSQuickCheck"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "OpenGL",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSOpenGL"],
extra_libraries = ["HSOpenGL_cbits"],
include_dirs = [],
c_includes = ["HsOpenGL.h"],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = ["-lglu32", "-lopengl32"],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "GLUT",
auto = True,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSGLUT"],
extra_libraries = ["HSGLUT_cbits"],
include_dirs = [],
c_includes = ["HsGLUT.h"],
package_deps = ["base", "OpenGL"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "objectio",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/imports"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries =
["HSobjectio1", "HSobjectio2", "HSobjectio3", "HSobjectio4"],
extra_libraries =
["user32",
"gdi32",
"kernel32",
"comctl32",
"comdlg32",
"shell32",
"winmm",
"winspool",
"ole32"],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "lang",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/lang"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSlang"],
extra_libraries = ["HSlang_cbits"],
include_dirs = [],
c_includes = ["HsLang.h"],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "concurrent",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/concurrent"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSconcurrent"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["base"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "text",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/text"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HStext"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["lang", "parsec"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "net",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/net"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSnet"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["network"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "hssource",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/hssource"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HShssource"],
extra_libraries = [],
include_dirs = [],
c_includes = [],
package_deps = ["haskell-src"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "win32",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/win32"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSwin321", "HSwin322"],
extra_libraries =
["user32", "gdi32", "winmm", "kernel32", "advapi32"],
include_dirs = [],
c_includes = [],
package_deps = ["haskell98", "lang"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
Package
{name = "util",
auto = False,
import_dirs = ["C:/DEV/ghc/ghc-6.2/hslibs-imports/util"],
source_dirs = [],
library_dirs = ["C:/DEV/ghc/ghc-6.2"],
hs_libraries = ["HSutil"],
extra_libraries = [],
include_dirs = [],
c_includes = ["HsUtil.h"],
package_deps = ["lang", "concurrent", "QuickCheck"],
extra_ghc_opts = [],
extra_cc_opts = [],
extra_ld_opts = [],
framework_dirs = [],
extra_frameworks = []}
]]
#g
--
------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
More information about the Haskell
mailing list