Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Bad Interface File

Tags:

haskell

I am trying to take my Haskell project and split it apart into a library and a set of executables that depend on the library. When I try to compile now I get the following error:

src/Main.hs:23:0:
    Bad interface file: /Users/<MyHomeDir>/.cabal/lib/Core-0.0.1/ghc-6.12.1/<MyModule>.hi
        mismatched interface file ways (wanted "", got "p")

I believe that the p might be the p flag related to packages for ghc. Is this correct? Do I need to add more configuration options somewhere to my cabal file to support this?

like image 831
Steve Severance Avatar asked Jul 23 '10 15:07

Steve Severance


2 Answers

I encountered a similar problem when compiling executables with dynamic linking.

I compiled a library and executable by invoking cabal install --ghc-option=-dynamic pkg.

The executable was built with dynamic linking but the library part was unusable.

I assume that using the --ghc-option=-dynamic option caused the static version of the library was built with dynamic linking also.

Since Cabal-1.14 I can use the --enable-executable-dynamic option which works correctly.

like image 174
Lemming Avatar answered Oct 26 '22 00:10

Lemming


That's saying it found a profiling build, but you're building Main.hs without profiling enabled. Quick fixes:

  • enable profiling in the build for Main.hs
  • build and install <MyModule> with profiling enabled

Either way, that will begin with a command that resembles

$ runghc Setup.hs configure --enable-library-profiling
like image 2
Greg Bacon Avatar answered Oct 26 '22 01:10

Greg Bacon