linking problems after switching from GHC5 to GHC6
Hello I can't link with a library any longer, after switching from ghc5 to ghc6.2. I've recompiled the library with the new compiler version, so that's not the problem. With GHC5: everything is fine: ~/src/hsunix $ ghc --version The Glorious Glasgow Haskell Compilation System, version 5.04.2 ~/src/hsunix $ make clean ... ~/src/hsunix $ make build/test0 ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -c -o build/HsUnixArgs.o src/lib/HsUnixArgs.hs ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -c -o build/HsUnixShell.o src/lib/HsUnixShell.hs ... ar cqs build/libhsunix.a build/HsUnixArgs.o build/HsUnix.o build/HsUnixMisc.o build/HsUnixPaths.o build/HsUnixShell.o build/HsUnixCommands.o build/HsUnixProcErr.o build/hsunix.o ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -ohi build/test0.hi -c -o build/test0.o src/test/test0.hs ghc -o build/test0 build/test0.o -odir build `src/lib/hsunix-config --local --libs` ~/src/hsunix $ src/lib/hsunix-config --local --libs build/libhsunix.a -syslib lang -syslib posix -syslib text -syslib util With GHC6, I get errors about undefined symbols. It are symbols which are defined in the library (libhsunix.a): ~/src/hsunix $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.2 ~/src/hsunix $ make clean ... ~/src/hsunix $ make build/test0 ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -c -o build/HsUnixArgs.o src/lib/HsUnixArgs.hs ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -c -o build/HsUnixShell.o src/lib/HsUnixShell.hs ... ar cqs build/libhsunix.a build/HsUnixArgs.o build/HsUnix.o build/HsUnixMisc.o build/HsUnixPaths.o build/HsUnixShell.o build/HsUnixCommands.o build/HsUnixProcErr.o build/hsunix.o ghc `src/lib/hsunix-config --local --cflags` -hidir build -odir build -ibuild -ohi build/test0.hi -c -o build/test0.o src/test/test0.hs ghc -o build/test0 build/test0.o -odir build `src/lib/hsunix-config --local --libs` build/test0.o(.text+0x25): In function `__stginit_Main_': : undefined reference to `__stginit_HsUnix_' build/test0.o(.text+0xec): In function `Main_main_srt': : undefined reference to `HsUnix_mainwrapper_closure' build/test0.o(.text+0x151): In function `Main_main_entry': : undefined reference to `HsUnix_mainwrapper_closure' collect2: ld returned 1 exit status make: *** [build/test0] Error 1 rm build/test0.o Oddly, the problem does not occur when I directly pass the haskell source file to the compiler instead of the object file which is created from it: ~/src/hsunix $ ghc -o build/test0 src/test/test0.hs -odir build `src/lib/hsunix-config --local --libs` `src/lib/hsunix-config --local --cflags` ^^^^^^^^^^^^^^^^^ instead of build/test0.o which is created from it (succeeds) Does anyone have any idea of what's wrong? I find this especially strange, because it works with GHC5. Bye, V.W. -- Volker Wysk <post@volker-wysk.de> http://www.volker-wysk.de
Hi I've put together a minimal program which reproduces the problem. Save the three attachments in a new directroy and type "make". I'ts just as described earlier. The trivial program compiles with GHC5, but not GHC6. It's all on a Linux-Debian box. bye, V.W. -- Volker Wysk <post@volker-wysk.de> http://www.volker-wysk.de
Volker Wysk wrote:
I've put together a minimal program which reproduces the problem. Save the three attachments in a new directroy and type "make". I'ts just as described earlier. The trivial program compiles with GHC5, but not GHC6. [...]
Hmmm, it looks like GHC is reversing the order of files in the linking step. Mentioning liba.a *before* Main.o in the linking step is a workaround... Cheers, S.
This is a 6.x bug; I fixed it in HEAD a while back, http://haskell.org/pipermail/cvs-ghc/2003-October/018991.html but the change wasn't merged for some reason. --sigbjorn ----- Original Message ----- From: "Sven Panne" <Sven.Panne@aedion.de> To: "Volker Wysk" <post@volker-wysk.de> Cc: <glasgow-haskell-users@haskell.org> Sent: Friday, January 30, 2004 08:28 Subject: Re: linking problems after switching from GHC5 to GHC6
Volker Wysk wrote:
I've put together a minimal program which reproduces the problem. Save the three attachments in a new directroy and type "make". I'ts just as described earlier. The trivial program compiles with GHC5, but not GHC6. [...]
Hmmm, it looks like GHC is reversing the order of files in the linking step. Mentioning liba.a *before* Main.o in the linking step is a workaround...
Cheers, S.
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (3)
-
Sigbjorn Finne -
Sven Panne -
Volker Wysk