#5428: Creating executable in OS X Lion
-------------------------------+--------------------------------------------
Reporter: sweirich | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.3 | Keywords: linking main executable
Testcase: | Blockedby:
Os: MacOS X | Blocking:
Architecture: x86_64 (amd64) | Failure: GHC rejects valid program
-------------------------------+--------------------------------------------
Can't seem to create an executable when the module is not named "Main"
For example:
sweirich$ ghc --make lec1.lhs -o hello -main-is Lec1
Linking hello ...
ld: warning: could not create compact unwind for _ffi_call_unix64: does
not use RBP or RSP based frame
Undefined symbols for architecture x86_64:
"_ZCMain_main_closure", referenced from:
_main in libHSrtsmain.a(Main.o)
"___stginit_ZCMain", referenced from:
_main in libHSrtsmain.a(Main.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
sweirich$
on the other hand, if I rename the file 'Main.lhs' and edit the
module name to 'Main' then everything works correctly.
sweirich$ ghc --make Main.lhs
[1 of 1] Compiling Main ( Main.lhs, Main.o )
Linking Main ...
ld: warning: could not create compact unwind for _ffi_call_unix64: does
not use RBP or RSP based frame
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic)
not allowed in code signed PIE, but used in ___gmpn_modexact_1c_odd from
/Library/Frameworks/GHC.framework/Versions/7.0.3-x86_64/usr/lib/ghc-7.0.3
/integer-gmp-0.2.0.3/libHSinteger-gmp-0.2.0.3.a(mode1o.o). To fix this
warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
sweirich$ ./Main
Hello World!
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5428>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs