Adding new library dependencies to GHC

Alex Ford alexander.r.ford at gmail.com
Tue Nov 12 19:53:55 UTC 2013


Hi,

I've made some changes to the LLVM backend of GHC to make it use
llvm-general to output bitcode rather than pretty printing human readable
LLVM assembly. However, I've been having trouble linking the required
libraries (llvm-general and its transitive dependencies). The steps I've
taken so far are to put the required libraries in the build tree under
libraries, and added them to the packages file, to PACKAGES_STAGE0 and
PACKAGES_STAGE1 in ghc.mk, and to the build depends section in compiler/
ghc.cabal.in.

The build fails in phase 1 when trying to link utf8-string (a dependency of
llvm-general) during the build of llvm-general, with:
Loading package utf8-string-0.3.7 ... <command line>: can't load .so/.DLL
for: libHSutf8-string-0.3.7.so (libHSutf8-string-0.3.7.so: cannot open
shared object file: No such file or directory)

The problem seems to be that with pre-existing library dependencies, the
system-wide libraries at /usr/lib/ghc-7.6.3/<libname>/ are pulled in,
whereas with the new dependencies, versions within the build tree (e.g. at
libraries/utf8-string/dist-install/build/) are tried instead, despite these
new libraries being installed globally within the same parent directory and
being listed by ghc-pkg (no errors upon ghc-pkg check either).

For example, in compiler/stage1/package-data.mk,
compiler_stage1_DEP_LIB_DIRS_SEARCHPATH
specifies /usr/lib/ghc-7.6.3/bytestring-0.10.0.2, and bytestring links
successfully, but for utf8-string specifies
<ghc-base-dir>/libraries/utf8-string/dist-boot/build.

I've read through the documentation on libraries for GHC but can't figure
out how to make this work. Could anyone suggest how I could go about fixing
this?

As a slightly related question, llvm-general depends on template-haskell.
Will this cause problems when building GHC normally, since the stage 1
compiler does not support TH? If so is there any way to compile stage 2
directly using the stage 0 compiler?

Many thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20131112/ebf366d3/attachment.html>


More information about the Glasgow-haskell-users mailing list