Skip to content

Bad Interaction between TemplateHaskell and FFI for cabal build #3761

Open
@ecaustin

Description

@ecaustin

Here's an adaptation of Don Stewart's compiled constants example to demonstrate the issue:
cabal-example.

When the project is loaded into ghci via cabal repl everything works fine.
However, when compiled via cabal build the following error is produced:

Building constants-0.1...
Preprocessing library constants-0.1...
[1 of 2] Compiling Constants        ( Constants.hs, dist/build/Constants.o )
[2 of 2] Compiling Constants2       ( Constants2.hs, dist/build/Constants2.o )
dyld: lazy symbol binding failed: Symbol not found: _constant_cstring
  Referenced from: /var/folders/dv/5spsnmzd7r51hbp2q4lkjb6m0000gn/T/ghc78711_0/libghc_6.dylib
  Expected in: flat namespace

dyld: Symbol not found: _constant_cstring
  Referenced from: /var/folders/dv/5spsnmzd7r51hbp2q4lkjb6m0000gn/T/ghc78711_0/libghc_6.dylib
  Expected in: flat namespace

Trace/BPT trap: 5

Given that the code loads fine in GHCi, is there a flag, custom Setup.hs, or other workaround to get compilation to succeed?

As a note, this may or may not be related to an older cabal issue: #1738.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions