Skip to content

GHCi linker should load archives

It looks like the GHCi linker doesn't look for '.a' files, only '.o's, e.g. Linker.lhs line 1107:

     mk_obj_path dir = dir </> (lib <.> "o")

There is no corresponding call to findFile with a "a" suffix.

This is annoying because it prevents you from running programs using the llvm package in GHCi. The llvm package depends on a number of .a files:

ld-options: ...
            -lLLVMCore -lLLVMAlphaInfo -lLLVMSupport -lLLVMSystem
            -L/usr/local/lib
           ...

And:

$ ls /usr/local/lib | grep LLVMCore
libLLVMCore.a

The net result is that we get this error when trying to run a program using llvm in GHCi:

$ runghc BrainF.hs 
BrainF.hs: <command line>: can't load .so/.DLL for: LLVMSystem (dlopen(libLLVMSystem.dylib, 9): image not found)

Another argument for finding some way to co-opt the system linker to do linking for us?

Trac metadata
Trac field Value
Version 6.12.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information