Problem with linker on Windows 2000
Martin Fowler
fowler@acm.org
Sat, 19 Jan 2002 13:37:55 -0500
I seem to having a problem in the link phase using ghc 5.02.2
It seems to occur with any program, this one is:
module Hello() where
main =3D putStr "Hello World\n"
The error message is
f:/apps/ghc/libHSstd.a(PrelMain__1.o)(.text+0x16):ghc1780.hc: undefined=
reference to `__stginit_Main'
f:/apps/ghc/libHSstd.a(PrelMain__2.o)(.text+0x4):ghc1780.hc: undefined=
reference to `Main_main_closure'
f:/apps/ghc/libHSstd.a(PrelMain__2.o)(.text+0x2f):ghc1780.hc: undefined=
reference to `Main_main_closure'
I'm running on Windows 2000 not using cygwin and did the default install.
I've added the full trace from the -v option below
Martin
------------------------------------------------------
Glasgow Haskell Compiler, Version 5.02.2, for Haskell 98, compiled by GHC=
version 5.02.2
Using package config file: f:\apps\ghc\package.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Packages=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Package
{name =3D "gmp",
import_dirs =3D [],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D [],
extra_libraries =3D ["gmp"],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D [],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "rts",
import_dirs =3D [],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc", "f:/apps/ghc/gcc-lib"],
hs_libraries =3D ["HSrts"],
extra_libraries =3D ["m", "winmm", "wsock32"],
include_dirs =3D
["f:/apps/ghc/include", "f:/apps/ghc/include/mingw"],
c_includes =3D ["Stg.h"],
package_deps =3D ["gmp"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D
["-u",
"_PrelBase_Izh_static_info",
"-u",
"_PrelBase_Czh_static_info",
"-u",
"_PrelFloat_Fzh_static_info",
"-u",
"_PrelFloat_Dzh_static_info",
"-u",
"_PrelPtr_Ptr_static_info",
"-u",
"_PrelWord_Wzh_static_info",
"-u",
"_PrelInt_I8zh_static_info",
"-u",
"_PrelInt_I16zh_static_info",
"-u",
"_PrelInt_I32zh_static_info",
"-u",
"_PrelInt_I64zh_static_info",
"-u",
"_PrelWord_W8zh_static_info",
"-u",
"_PrelWord_W16zh_static_info",
"-u",
"_PrelWord_W32zh_static_info",
"-u",
"_PrelWord_W64zh_static_info",
"-u",
"_PrelStable_StablePtr_static_info",
"-u",
"_PrelBase_Izh_con_info",
"-u",
"_PrelBase_Czh_con_info",
"-u",
"_PrelFloat_Fzh_con_info",
"-u",
"_PrelFloat_Dzh_con_info",
"-u",
"_PrelPtr_Ptr_con_info",
"-u",
"_PrelStable_StablePtr_con_info",
"-u",
"_PrelBase_False_closure",
"-u",
"_PrelBase_True_closure",
"-u",
"_PrelPack_unpackCString_closure",
"-u",
"_PrelIOBase_stackOverflow_closure",
"-u",
"_PrelIOBase_heapOverflow_closure",
"-u",
"_PrelIOBase_NonTermination_closure",
"-u",
"_PrelIOBase_BlockedOnDeadMVar_closure",
"-u",
"_PrelWeak_runFinalizzerBatch_closure",
"-u",
"___stginit_Prelude"]}
Package
{name =3D "std",
import_dirs =3D ["f:/apps/ghc/imports/std"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSstd1", "HSstd2"],
extra_libraries =3D
["HSstd_cbits", "wsock32", "msvcrt", "kernel32", "user32"],
include_dirs =3D [],
c_includes =3D ["HsStd.h"],
package_deps =3D ["rts"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "lang",
import_dirs =3D ["f:/apps/ghc/imports/lang"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSlang"],
extra_libraries =3D ["HSlang_cbits"],
include_dirs =3D [],
c_includes =3D ["HsLang.h"],
package_deps =3D [],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D ["-u", "_Addr_Azh_static_info"]}
Package
{name =3D "concurrent",
import_dirs =3D ["f:/apps/ghc/imports/concurrent"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSconcurrent"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "data",
import_dirs =3D ["f:/apps/ghc/imports/data"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSdata"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["lang", "util"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "net",
import_dirs =3D ["f:/apps/ghc/imports/net"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSnet"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D ["HsNet.h"],
package_deps =3D ["lang", "text", "concurrent"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "posix",
import_dirs =3D ["f:/apps/ghc/imports/posix"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSposix"],
extra_libraries =3D ["HSposix_cbits"],
include_dirs =3D [],
c_includes =3D ["HsPosix.h"],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "text",
import_dirs =3D ["f:/apps/ghc/imports/text"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HStext"],
extra_libraries =3D ["HStext_cbits"],
include_dirs =3D [],
c_includes =3D ["HsText.h"],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "util",
import_dirs =3D ["f:/apps/ghc/imports/util"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSutil"],
extra_libraries =3D ["HSutil_cbits"],
include_dirs =3D [],
c_includes =3D ["HsUtil.h"],
package_deps =3D ["lang", "concurrent"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "hssource",
import_dirs =3D ["f:/apps/ghc/imports/hssource"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HShssource"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["text"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "greencard",
import_dirs =3D ["f:/apps/ghc/imports/greencard"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSgreencard"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "win32",
import_dirs =3D ["f:/apps/ghc/imports/win32"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSwin321", "HSwin322"],
extra_libraries =3D
["user32", "gdi32", "winmm", "kernel32", "advapi32"],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "com",
import_dirs =3D ["f:/apps/ghc/imports/com"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HScom"],
extra_libraries =3D ["user32", "ole32", "oleaut32", "advapi32"],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["lang"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
Package
{name =3D "xlib",
import_dirs =3D ["f:/apps/ghc/imports/xlib"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSxlib"],
extra_libraries =3D ["HSxlib_cbits", "X11"],
include_dirs =3D [],
c_includes =3D ["HsXlib.h"],
package_deps =3D ["greencard"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [""],
extra_ld_opts =3D Hsc static flags: -static -fignore-interface-pragmas=
-fomit-interface-pragmas -fdo-lambda-eta-expansion -flet-no-escape
*** Checking old interface for hs =3D Just "hello.hs", hspp =3D Just=
"hello.hs":
compilation IS NOT required
*** Touching object file
f:\apps\ghc\touchy.exe "hello.o"
*** Linker
f:\apps\ghc\gcc -B"f:\apps\ghc\gcc-lib/" "-v" "-o" "a.out"=
"-DDONT_WANT_WIN32_DLL_SUPPORT" "-mno-cygwin" "hello.o" "-Lf:/apps/ghc"=
"-Lf:/apps/ghc/gcc-lib" "-lHSstd" "-lHSstd_cbits" "-lwsock32" "-lmsvcrt"=
"-lkernel32" "-luser32" "-lHSrts" "-lm" "-lwinmm" "-lwsock32" "-lgmp" "-u"=
"_PrelBase_Izh_static_info" "-u" "_PrelBase_Czh_static_info" "-u"=
"_PrelFloat_Fzh_static_info" "-u" "_PrelFloat_Dzh_static_info" "-u"=
"_PrelPtr_Ptr_static_info" "-u" "_PrelWord_Wzh_static_info" "-u"=
"_PrelInt_I8zh_static_info" "-u" "_PrelInt_I16zh_static_info" "-u"=
"_PrelInt_I32zh_static_info" "-u" "_PrelInt_I64zh_static_info" "-u"=
"_PrelWord_W8zh_static_info" "-u" "_PrelWord_W16zh_static_info" "-u"=
"_PrelWord_W32zh_static_info" "-u" "_PrelWord_W64zh_static_info" "-u"=
"_PrelStable_StablePtr_static_info" "-u" "_PrelBase_Izh_con_info" "-u"=
"_PrelBase_Czh_con_info" "-u" "_PrelFloat_Fzh_con_info" "-u"=
"_PrelFloat_Dzh_con_info" "-u" "_PrelPtr_Ptr_con_info" "-u"=
"_PrelStable_StablePtr_con_info" "-u" "_PrelBase_False_closure" "-u"=
"_PrelBase_True_closure" "-u" "_PrelPack_unpackCString_closure" "-u"=
"_PrelIOBase_stackOverflow_closure" "-u"=
"_PrelIOBase_heapOverflow_closure" "-u"=
"_PrelIOBase_NonTermination_closure" "-u"=
"_PrelIOBase_BlockedOnDeadMVar_closure" "-u"=
"_PrelWeak_runFinalizzerBatch_closure" "-u" "___stginit_Prelude" "-u"=
"_PrelMain_mainIO_closure" "-u" "___stginit_PrelMain"
Reading specs from f:/apps/ghc/gcc-lib/specs
gcc version 2.95.3-5 (mingw special)
f:\apps\ghc\gcc-lib\ld.exe -Bdynamic -o a.out -u _PrelBase_Izh_static_info=
-u _PrelBase_Czh_static_info -u _PrelFloat_Fzh_static_info -u=
_PrelFloat_Dzh_static_info -u _PrelPtr_Ptr_static_info -u=
_PrelWord_Wzh_static_info -u _PrelInt_I8zh_static_info -u=
_PrelInt_I16zh_static_info -u _PrelInt_I32zh_static_info -u=
_PrelInt_I64zh_static_info -u _PrelWord_W8zh_static_info -u=
_PrelWord_W16zh_static_info -u _PrelWord_W32zh_static_info -u=
_PrelWord_W64zh_static_info -u _PrelStable_StablePtr_static_info -u=
_PrelBase_Izh_con_info -u _PrelBase_Czh_con_info -u=
_PrelFloat_Fzh_con_info -u _PrelFloat_Dzh_con_info -u=
_PrelPtr_Ptr_con_info -u _PrelStable_StablePtr_con_info -u=
_PrelBase_False_closure -u _PrelBase_True_closure -u=
_PrelPack_unpackCString_closure -u _PrelIOBase_stackOverflow_closure -u=
_PrelIOBase_heapOverflow_closure -u _PrelIOBase_NonTermination_closure -u=
_PrelIOBase_BlockedOnDeadMVar_closure -u=
_PrelWeak_runFinalizzerBatch_closure -u ___stginit_Prelude -u=
_PrelMain_mainIO_closure -u ___stginit_PrelMain f:/apps/ghc/gcc-lib/crt2.o=
-Lf:/apps/ghc -Lf:/apps/ghc/gcc-lib -Lf:/apps/ghc/gcc-lib hello.o -lHSstd=
-lHSstd_cbits -lwsock32 -lmsvcrt -lkernel32 -luser32 -lHSrts -lm -lwinmm=
-lwsock32 -lgmp -lmingw32 -lgcc -lmoldname -lmsvcrt -luser32 -lkernel32=
-ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmsvcrt
f:/apps/ghc/libHSstd.a(PrelMain__1.o)(.text+0x16):ghc1780.hc: undefined=
reference to `__stginit_Main'
f:/apps/ghc/libHSstd.a(PrelMain__2.o)(.text+0x4):ghc1780.hc: undefined=
reference to `Main_main_closure'
f:/apps/ghc/libHSstd.a(PrelMain__2.o)(.text+0x2f):ghc1780.hc: undefined=
reference to `Main_main_closure'
Failed: f:\apps\ghc\gcc -B"f:\apps\ghc\gcc-lib/" "-v" "-o" "a.out"=
"-DDONT_WANT_WIN32_DLL_SUPPORT" "-mno-cygwin" "hello.o" "-Lf:/apps/ghc"=
"-Lf:/apps/ghc/gcc-lib" "-lHSstd" "-lHSstd_cbits" "-lwsock32" "-lmsvcrt"=
"-lkernel32" "-luser32" "-lHSrts" "-lm" "-lwinmm" "-lwsock32" "-lgmp" "-u"=
"_PrelBase_Izh_static_info" "-u" "_PrelBase_Czh_static_info" "-u"=
"_PrelFloat_Fzh_static_info" "-u" "_PrelFloat_Dzh_static_info" "-u"=
"_PrelPtr_Ptr_static_info" "-u" "_PrelWord_Wzh_static_info" "-u"=
"_PrelInt_I8zh_static_info" "-u" "_PrelInt_I16zh_static_info" "-u"=
"_PrelInt_I32zh_static_info" "-u" "_PrelInt_I64zh_static_info" "-u"=
"_PrelWord_W8zh_static_info" "-u" "_PrelWord_W16zh_static_info" "-u"=
"_PrelWord_W32zh_static_info" "-u" "_PrelWord_W64zh_static_info" "-u"=
"_PrelStable_StablePtr_static_info" "-u" "_PrelBase_Izh_con_info" "-u"=
"_PrelBase_Czh_con_info" "-u" "_PrelFloat_Fzh_con_info" "-u"=
"_PrelFloat_Dzh_con_info" "-u" "_PrelPtr_Ptr_con_info" "-u"=
"_PrelStable_StablePtr_con_info" "-u" "_PrelBase_False_closure" "-u"=
"_PrelBase_True_closure" "-u" "_PrelPack_unpackCString_closure" "-u"=
"_PrelIOBase_stackOverflow_closure" "-u"=
"_PrelIOBase_heapOverflow_closure" "-u"=
"_PrelIOBase_NonTermination_closure" "-u"=
"_PrelIOBase_BlockedOnDeadMVar_closure" "-u"=
"_PrelWeak_runFinalizzerBatch_closure" "-u" "___stginit_Prelude" "-u"=
"_PrelMain_mainIO_closure" "-u" "___stginit_PrelMain"
*** Deleting temp files
Deleting: E:\DOCUME~1\mfowler\LOCALS~1\Temp/ghc1620.s=
E:\DOCUME~1\mfowler\LOCALS~1\Temp/ghc1620.hspp
Warning: deleting non-existent E:\DOCUME~1\mfowler\LOCALS~1\Temp/ghc1620.s
Warning: deleting non-existent=
E:\DOCUME~1\mfowler\LOCALS~1\Temp/ghc1620.hspp
[""]}
Package
{name =3D "HGL",
import_dirs =3D ["f:/apps/ghc/imports/HGL"],
source_dirs =3D [],
library_dirs =3D ["f:/apps/ghc"],
hs_libraries =3D ["HSHGL"],
extra_libraries =3D [],
include_dirs =3D [],
c_includes =3D [],
package_deps =3D ["xlib", "concurrent"],
extra_ghc_opts =3D [],
extra_cc_opts =3D [],
extra_ld_opts =3D []}
http://www.martinfowler.com