15 Oct 2012 15:25
GHC compiling shared library linking problem
Richard Zetterberg <richard.zetterberg <at> googlemail.com>
2012-10-15 13:25:20 GMT
2012-10-15 13:25:20 GMT
Hello
This is the first time I'm mailing to this list, so I hope I have come
to the right place.
The problem I have is that I get a linker error when compiling a
shared library with GHC. This problem occurred after I updated GHC
from 7.0.3 to 7.4.1. Here is the error itself:
/usr/bin/ld: ../src/Shared.so relocation R_X86_64_32S against
`ghczmprim_GHCziTypes_ZC_con_info` can not be used when making a
shared object; recompile with -fPIC
../src/Shared.so: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
Here is the ghc command:
ghc -O2 --make -no-hs-main -optl '-shared' -optc '-DMODULE=Shared'
-o ../bin/pet_assembler_core.so Shared ../src/shared/module_init.c
-i../src/;
Shared.hs is the file where I specify the interface for the library,
it only has one function:
1 {-# LANGUAGE ForeignFunctionInterface #-}
2
3 module Shared where
4
5 import qualified Data.ByteString as BS
(Continue reading)
RSS Feed