#3333: GHCi doesn't load weak symbols
---------------------------+------------------------------------------------
  Reporter:  heatsink      |          Owner:                       
      Type:  bug           |         Status:  new                  
  Priority:  normal        |      Milestone:  6.14.1               
 Component:  GHCi          |        Version:  6.10.4               
Resolution:                |       Keywords:  weak, dynamic loading
Difficulty:  Unknown       |             Os:  Linux                
  Testcase:                |   Architecture:  x86                  
   Failure:  None/Unknown  |  
---------------------------+------------------------------------------------
Changes (by guest):

 * cc: [email protected] (added)
  * failure:  => None/Unknown
  * version:  6.10.3 => 6.10.4

Comment:

 I encountered the same problem with LLVM recently. LLVM is also a C++
 library with C interface. I did the following hack, without knowing what
 I'm really doing. I needed to build shared object files of the LLVM
 libraries anyway, in order to use them in GHCi. Then I built a big .so
 file containing all libraries (.a) and object files (.o) of LLVM. There
 the symbols seems to have been resolved.

 {{{
 # get many small object (.o) files out of the libraries (.a)
 for src in /usr/lib/llvm/*.a; do ar -x $src ; done
 # assemble those object files and the other ones of LLVM project to a big
 shared object file (.so)
 gcc -shared -Wl,-soname,libLLVM.so.2.5 -o libLLVM.so.2.5
 /usr/lib/llvm/LLVM*.o *.o
 # provide the file with default name
 ln -s libLLVM.so.2.5 libLLVM.so
 # remove interim object files
 rm *.o
 }}}

 I also had to replace the linker options -lLLVMSupport -lLLVMCore and so
 on by -lLLVM (the monolithic so-file) in the fields extraLibraries and
 ldOptions ~/.ghc/i386-linux-6.10.4/package.conf for the Haskell package
 'llvm'.

 I have no idea whether this hack would work for other libraries.


 Btw. If you want to use LLVM in GHCi you may also have to respect the
 linker script problem described in #2615 and remove the pthread dependency
 in package.conf, too.
 With all those steps I could use LLVM in GHCi, but after a :reload,
 running an LLVM function causes GHCi to quit with:
 {{{
 ghci: JITEmitter.cpp:110: <unnamed>::JITResolver::JITResolver(llvm::JIT&):
 Assertion `TheJITResolver == 0 && "Multiple JIT resolvers?"' failed.
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3333#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to