Making GHCi object files on MacOS

Section 4.10.3 of the GHC manual tells me to use ld -r --whole-archive to convert a .a file into a .o file suitable for GHCi. However these options only work for GNU ld, which doesn't seem to be available on MacOS (uname -srv gives me "Darwin 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC"). Specifically, I tried compiling the GNU binutils but got a message from its ./configure telling me that this wouldn't work for the ld directory. I presume there must be some way of producing GHCi object files on MacOS, but how is it done? Thanks

On 10/12/2003, at 2:23 AM, George Russell wrote:
Section 4.10.3 of the GHC manual tells me to use ld -r --whole-archive to convert a .a file into a .o file suitable for GHCi. However these options only work for GNU ld, which doesn't seem to be available on MacOS
The equivalent to GNU ld's --whole-archive option on Mac OS X is -all_load. -- % Andre Pang : trust.in.love.to.save

ozone@algorithm.com.au wrote:
On 10/12/2003, at 2:23 AM, George Russell wrote:
Section 4.10.3 of the GHC manual tells me to use ld -r --whole-archive to convert a .a file into a .o file suitable for GHCi. However these options only work for GNU ld, which doesn't seem to be available on MacOS
The equivalent to GNU ld's --whole-archive option on Mac OS X is -all_load.
Thank you, that seems to work. Now what should I do to prevent the GHCi linker complaining about duplicate definitions for "__module_registered" (which seems to be defined in some way in each object file)?

On 10/12/2003, at 3:35 AM, George Russell wrote:
The equivalent to GNU ld's --whole-archive option on Mac OS X is -all_load.
Thank you, that seems to work. Now what should I do to prevent the GHCi linker complaining about duplicate definitions for "__module_registered" (which seems to be defined in some way in each object file)?
I don't have such duplicate definitions in my files ... producing a package with "ghc-pkg -a" works OK for me with Wolfgang Thaller's GHC 6.0.1 build. Is that how you're doing it, or are you trying to produce the GHCi object file manually? -- % Andre Pang : trust.in.love.to.save

ozone@algorithm.com.au wrote (snipped):
I don't have such duplicate definitions in my files ... producing a package with "ghc-pkg -a" works OK for me with Wolfgang Thaller's GHC 6.0.1 build. Is that how you're doing it, or are you trying to produce the GHCi object file manually?
I was producing it by invoking "ld" directly, since I wrote the Makefile before the --auto-ghci-lib was introduced. However now I use --auto-ghci-lib and it seems to work, thanks.

George Russell wrote:
I was producing it by invoking "ld" directly, since I wrote the Makefile before the --auto-ghci-lib was introduced. However now I use --auto-ghci-lib and it seems to work, thanks.
Thank you, that seems to work. Now what should I do to prevent the GHCi linker complaining about duplicate definitions for "__module_registered" (which seems to be defined in some way in each object file)?
In case anybody doesn't want to use ghc-pkg: You also need to pass the '-x' option to ld. Grüße, Wolfgang
participants (3)
-
George Russell
-
ozone@algorithm.com.au
-
Wolfgang Thaller