2

I have a package with bunch of *.c and *.cpp files, listed inside c-sources field of *.cabal file. I need to include it inside a project with IHaskell and some other packages. Everything works fine, and builds without a problem. stack exec ghci works fine and I can import modules and execute any code. stack ghci though throws some weird errors, like this:

In file included from <command-line>:10:0: 

/...blabla.../.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/autogen/cabal_macros.h:157:0:
     note: this is the location of the previous definition
     #define CURRENT_PACKAGE_KEY "blabla"
     ^

And stack ghci inside my package complains about symbols exported from its C code. Another weird thing is that symbols depend on the order of exposed-modules in the configuration, so the error goes away if I put my *.hs module on top of others, but if I have two *.hs files importing from the same *.c file, it won't work! stack exec jupyter -- console --kernel haskell starts, but immediately throws unknown symbol error if I try to run some code from my package, always the same though.

I have a docker image based on fpco/stack-build, which just installs jupyter and other necessary stuff. I use lts-3.0 snapshot, if it's somehow relevant.

What is going on?

swish
  • 367
  • 4
  • 18

1 Answers1

1

There have been a lot of improvements made recently to stack ghci, which is still mostly a work in progress. I'd recommend testing out stack master, and if the problem still exists opening a Github issue.

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77