Re: linking ghc object files with mingw-g++
| I'm trying to link ghc object files with mingw's | g++/ld... We have used the g++-2 compiler that you can get with Cygwin and it seems to work fine. (mingw-g++ and the normal g++ did not work for us.) Another hint: maybe you should give -lstdc++ as a flag to the final linking fase. A final hint: I have heard rumours of people changing the linker that GHC uses to be g++'s linker, maybe that helps in your case. Apparently, some C++ code requires special treatment at linking time, something that normal ld does not do. /Koen ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: linking ghc object files with mingw-g++
I have never tried to link C++ with GHC stuff; I know that it has caused people difficulties in the past. If someone who has got it working cares to write up some notes on what to do, I'll gladly incorporate them in the GHC users guide. From what Koen says, maybe it's possible! Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] | On Behalf Of Koen Claessen | Sent: 28 May 2003 07:17 | To: [EMAIL PROTECTED] | Cc: [EMAIL PROTECTED] | Subject: Re: linking ghc object files with mingw-g++ | | | | I'm trying to link ghc object files with mingw's | | g++/ld... | | We have used the g++-2 compiler that you can get with Cygwin | and it seems to work fine. (mingw-g++ and the normal g++ did | not work for us.) | | Another hint: maybe you should give -lstdc++ as a flag to | the final linking fase. | | A final hint: I have heard rumours of people changing the | linker that GHC uses to be g++'s linker, maybe that helps in | your case. Apparently, some C++ code requires special | treatment at linking time, something that normal ld does not | do. | | /Koen | | ___ | Glasgow-haskell-users mailing list | [EMAIL PROTECTED] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: linking ghc object files with mingw-g++
Good morning! Thanks very much for your help... Compiling everything with cygwin c++-2 / gcc-2 works fine for me. | I'm trying to link ghc object files with mingw's | g++/ld... We have used the g++-2 compiler that you can get with Cygwin and it seems to work fine. (mingw-g++ and the normal g++ did not work for us.) Another hint: maybe you should give -lstdc++ as a flag to the final linking fase. A final hint: I have heard rumours of people changing the linker that GHC uses to be g++'s linker, maybe that helps in your case. Apparently, some C++ code requires special treatment at linking time, something that normal ld does not do. Johannes [EMAIL PROTECTED] ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: linking ghc object files with mingw-g++
Hello again! This is gvc -v output: Hsc static flags: -static -fignore-interface-pragmas -fomit-interface-pragmas -f do-lambda-eta-expansion -flet-no-escape *** Linker c:\ghc\ghc-5.04.3\gcc -Bc:\ghc\ghc-5.04.3\gcc-lib/ -v -o a.out -DDONT_W ANT_WIN32_DLL_SUPPORT main.o Test.o Test_stub.o -Lc:/ghc/ghc-5.04.3 -L c:/ghc/ghc-5.04.3/gcc-lib -lHShaskell98 -lHSbase -lHSbase_cbits -lwsock3 2 -lmsvcrt -lkernel32 -luser32 -lHSrts -lm -lgmp -lwinmm -lwsock 32 -u _GHCziBase_Izh_static_info -u _GHCziBase_Czh_static_info -u _G HCziFloat_Fzh_static_info -u _GHCziFloat_Dzh_static_info -u _GHCziPtr_Pt r_static_info -u _GHCziWord_Wzh_static_info -u _GHCziInt_I8zh_static_inf o -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_st atic_info -u _GHCziStable_StablePtr_static_info -u _GHCziBase_Izh_con_in fo -u _GHCziBase_Czh_con_info -u _GHCziFloat_Fzh_con_info -u _GHCziF loat_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 _GHCziIOBa se_stackOverflow_closure -u _GHCziIOBase_heapOverflow_closure -u _GHCziI OBase_NonTermination_closure -u _GHCziIOBase_BlockedOnDeadMVar_closure -u _GHCziIOBase_Deadlock_closure -u _GHCziWeak_runFinalizzerBatch_closure - u ___stginit_Prelude Reading specs from c:/ghc/ghc-5.04.3/gcc-lib/specs gcc version 2.95.3-6 (mingw special) $ c:/ghc/ghc-5.04.3/gcc-lib/ld.exe -Bdynamic -o a.out -u _GHCziBase_Izh_static_ info -u _GHCziBase_Czh_static_info -u _GHCziFloat_Fzh_static_info -u _GHCziFloa t_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_s tatic_info -u _GHCziInt_I64zh_static_info -u _GHCziWord_W8zh_static_info -u _GH CziWord_W16zh_static_info -u _GHCziWord_W32zh_static_info -u _GHCziWord_W64zh_s tatic_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_StableP tr_con_info -u _GHCziBase_False_closure -u _GHCziBase_True_closure -u _GHCziPac k_unpackCString_closure -u _GHCziIOBase_stackOverflow_closure -u _GHCziIOBase_h eapOverflow_closure -u _GHCziIOBase_NonTermination_closure -u _GHCziIOBase_Bloc kedOnDeadMVar_closure -u _GHCziIOBase_Deadlock_closure -u _GHCziWeak_runFinaliz zerBatch_closure -u ___stginit_Prelude c:/ghc/ghc-5.04.3/gcc-lib/crt2.o -Lc:/gh c/ghc-5.04.3 -Lc:/ghc/ghc-5.04.3/gcc-lib -Lc:/ghc/ghc-5.04.3/gcc-lib -L/ming w/l ib/gcc-lib/mingw32/2.95.3-6/../../../../mingw32/lib -L/mingw/lib/gcc-lib/min gw3 2/2.95.3-6/../../.. main.o Test.o Test_stub.o -lHShaskell98 -lHSbase -lHSbase_c bits -lwsock32 -lmsvcrt -lkernel32 -luser32 -lHSrts -lm -lgmp -lwinmm -lwsoc k32 -lmingw32 -lgcc -lmoldname -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell3 2 - lmingw32 -lgcc -lmoldname -lmsvcrt main.o(.eh_frame+0x11):main.cpp: undefined reference to `__gxx_personality_v0' Any hint what this __gxx_personality_v0 means? Johannes [EMAIL PROTECTED] ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Linking with object files
On Wednesday 08 January 2003 5:00 pm, Simon Marlow wrote: What command line are you using? Here's what I did: ~/scratch cat foo.c ~/scratch gcc -c foo.c ~/scratch ghc --make hello.hs foo.o ghc-5.04.2: chasing modules from: hello.hs Skipping Main ( hello.hs, ./hello.o ) ghc: linking ... ~/scratch The exact command line I'm using is.. ghc --make -fglasgow-exts -Wall -o Main.exe Main.hs Fill.o Render.o which gives.. ghc-5.04.2: chasing modules from: Main.hs,Fill.o,Render.o ghc-5.04.2: can't find module `Fill.o' (while processing Fill.o) But playing about a bit, I found the solution. It doesn't like upper case object file names. Not sure if that's by design or an oversight. I've changed them to lower case and it works fine now. Eek! That's a bug, thanks! Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Linking with object files
I seem to be having some trouble doing this and have a couple of questions.. The first question is how do you use --make option when doing this? Section 4.5 of the users guide seems to contradictory to me. It states.. The command line must contain one source file or module name This is wrong (or at least, out of date). I'll fix it. You can now specify any number of source files, module names, linkable objects and libraries on the command line in --make mode or GHCi. and later.. If the program needs to be linked with additional objects (say, some auxilliary C code), these can be specified on the command line as usual. ghc Main.hs foo.o is OK, but whenever I try this... ghc --make Main.hs foo.o I get the error.. can't find module 'foo.o' while processing foo.o I think you must be using a version of GHC prior to 5.04.2. This functionality was fixed in 5.04.2. The second question is what object formats does ghc understand and is the object file suffix significant? If I try elf format, this is accepted without complaint but I get a broken executable (though this could well be because my assembler has generated a broken elf file). Using coff format seems OK. The files have a .o suffix in both cases. FWIW, I'm using ghc 5.04.2 on Win32 with the nasm assembler. I'm not sure about this one - any Windows experts out there like to comment? My guess is that GHCi should load COFF objects only, but other kinds of objects might work when using the system linker (i.e. in batch mode). Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Linking with object files
On Wednesday 08 January 2003 10:04 am, Simon Marlow wrote: I get the error.. can't find module 'foo.o' while processing foo.o I think you must be using a version of GHC prior to 5.04.2. This functionality was fixed in 5.04.2. I just checked, it really is (or claims to be:-) version 5.04.2. I get the same error using 5.04.2 under Linux too. What command line are you using? Here's what I did: ~/scratch cat foo.c ~/scratch gcc -c foo.c ~/scratch ghc --make hello.hs foo.o ghc-5.04.2: chasing modules from: hello.hs Skipping Main ( hello.hs, ./hello.o ) ghc: linking ... ~/scratch Actually I was incorrect before: this has worked fine in 5.04, 5.04.1 and 5.04.2. The fix made in 5.04.2 was to pass files without a recognised extension through to the linker, to match the behaviour without --make. Cheers, Simon ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Linking with object files
On Wednesday 08 January 2003 5:00 pm, Simon Marlow wrote: What command line are you using? Here's what I did: ~/scratch cat foo.c ~/scratch gcc -c foo.c ~/scratch ghc --make hello.hs foo.o ghc-5.04.2: chasing modules from: hello.hs Skipping Main ( hello.hs, ./hello.o ) ghc: linking ... ~/scratch The exact command line I'm using is.. ghc --make -fglasgow-exts -Wall -o Main.exe Main.hs Fill.o Render.o which gives.. ghc-5.04.2: chasing modules from: Main.hs,Fill.o,Render.o ghc-5.04.2: can't find module `Fill.o' (while processing Fill.o) But playing about a bit, I found the solution. It doesn't like upper case object file names. Not sure if that's by design or an oversight. I've changed them to lower case and it works fine now. Regards -- Adrian Hey ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users