Skip to content

building a profiled dynamic exe fails to find libffi_p

With GHC 8.10.7:

I'm trying to profile a big application that uses many shared libraries implemented in haskell (I can't do the usual thing and build a static exe just for profiling).

I started by building GHC and libraries with

GhcLibWays += p_dyn
GhcRTSWays += p_dyn thr_p_dyn

in build.mk.

But linking a test program fails:

$ cat T.hs

main = putStrLn "hej"

$ ./inplace/bin/ghc-stage2 -prof -dynamic --make T.hs -o main
Linking main ...
/usr/bin/ld.gold: error: cannot find -lffi_p
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)

I can manually call cc to link main replacing -lffi_p with -lffi and everything seems to work ok.

I think either we are missing a libffi_p.so or we should link libffi.so.

I've not tried if hadrian does better and provides a libffi_p.so, but I'm not sure if that would be the right solution.

Edited by adam
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information