Failed link to mixed-language shared object.

Hi all, Does this trigger recollection in anyone: dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make ghc -dynamic -o ami_test -L. -lami ami_test.o ./libami.so: undefined reference to `__stginit_haskell98_MarshalArray_' ./libami.so: undefined reference to `__stginit_haskell98_MarshalError_' collect2: ld returned 1 exit status make: *** [ami_test] Error 1 dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ ? Know what I need to do? Thanks, -db

On Thu, Aug 18, 2011 at 23:32, David Banas
Does this trigger recollection in anyone:
dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make ghc -dynamic -o ami_test -L. -lami ami_test.o ./libami.so: undefined reference to `__stginit_haskell98_MarshalArray_' ./libami.so: undefined reference to `__stginit_haskell98_MarshalError_'
First thing to try is always --make; GHC's default behavior is, shall we say, not optimal otherwise. (I consider it highly broken; somewhere in there the default is *supposedly* going to change to --make, I believe.) If you want to try to make it work the ugly old way, the symbol names suggest to me that "-package haskell98" would help. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

On Thu, 2011-08-18 at 20:32 -0700, David Banas wrote:
Hi all,
Does this trigger recollection in anyone:
dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make ghc -dynamic -o ami_test -L. -lami ami_test.o ./libami.so: undefined reference to `__stginit_haskell98_MarshalArray_' ./libami.so: undefined reference to `__stginit_haskell98_MarshalError_' collect2: ld returned 1 exit status make: *** [ami_test] Error 1 dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$
? Know what I need to do?
Thanks, -db
So, I was able to make my link errors go away, by adding `-shared' to my
command line:
dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ make
ghc -no-hs-main -shared -dynamic -o ami_test -L. -lami ami_test.o
However, when I try to execute the resultant program, I get a
segmentation fault:
dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ ./ami_test test.ami
Segmentation fault
Tracing this shows that the `main' pointer of the program appears to be
NULL:
dbanas@dbanas-eeepc:~/prj/haskell/AMIParse/trunk$ gdb --args ./ami_test
test.ami
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols
from /home/dbanas/prj/haskell/AMIParse/trunk/ami_test...done.
(gdb) l
2 #include
participants (2)
-
Brandon Allbery
-
David Banas