Lift instance cause GHC build error: unknown symbol with CFFI

Minh Le minhxecole at gmail.com
Thu Dec 19 05:11:20 UTC 2024


Hi everyone,
I’m building a floating-point library for Clash that uses FloPoCo. The
library integrates with the MPFR library via the hmpfr Haskell
bindings to perform accurate software simulations of floating-point
operations.
I’ve encountered build errors related to linking the MPFR library:
Windows:
unknown symbol 'mpfr_add' in Arithmetic.o.
Linux:
symbol lookup error: undefined symbol 'mpfr_custom_get_size_wrap'.
Interestingly, cabal repl works as expected, but cabal build fails.
This suggests a linking issue specific to the build process.
Steps to Reproduce
Clone the repository: https://github.com/yourcomrade/FloPoCoFloat.
Install MPFR:
Windows: pacman -S mingw-w64-clang-x86_64-mpfr
Linux: sudo apt install libmpfr6 libmpfr-dev
Check out the Error_branch.
Build the project using cabal build.
Expected Behavior
The project should compile without errors. Notably, if cabal build
fails, I would expect cabal repl to fail too, but that’s not the case.
Additional Info
OS: Windows 11, Ubuntu WSL 5.15
Tools: GHC 9.8.2, Cabal 3.10.3, GCC 11.4
Relevant discussion: Cabal issue: https://github.com/haskell/cabal/issues/10651
I have a discussion with Cabal maintainer and he suspects that is GHC
linking issue.
Does anyone have insights into resolving this issue? Any help would be
appreciated.
Kind regards,
Minh


More information about the ghc-devs mailing list