[Haskell-cafe] Cabal depend on local package with foreign dependencies
richard.lewis at gold.ac.uk
Tue Oct 27 15:08:26 UTC 2015
I have two libraries that I'm working on, packageA and packageB.
packageA was written some time ago and depends on a foreign C library,
libfoo, which I also wrote and which is installed in a non-standard
location. packageB depends on packageA and is new and under active
I have the following things, then:
- libfoo is installed in ~/.local/lib, with includes in ~/.local/include/foo
- packageA is in ~/src/packageA
- packageB is in ~/src/packageB
packageA has a .cabal file which includes:
build-depends: base, ...
I've created a cabal sandbox in packageA and I can successfully build
Now, packageB makes use of packageA. It has a .cabal file which looks
build-depends: base, packageA, ...
Again, I've created a cabal sandbox in packageB. In order to be able
to use packageA (which is not installed anywhere) I believe I have to
$ cabal add-source ~/src/packageA
Next, when I try and configure, it says:
cabal: At least the following dependencies are missing:
That's fine, I assume, because I can now just `cabal install
--only-dependencies` to get packageA built into packageB's
sandbox. But when I try and do this, I get:
$ cabal install --only-dependencies
Preprocessing library packageA-0.1...
In-place registering packageA-0.1...
Preprocessing executable 'testA' for packageA-0.1...
Foo.hsc:10:33: fatal error: foo/foo.h: No such file or directory
So a target of packageA which compiles fine when doing cabal build
directly from packageA now fails to compile when I attempt to build it
from packageB by installing packageB's dependencies.
I'm not sure how to proceed. It feels like maybe I have to tell
cabal--when running it from packageB--where the include files are for
packageA, because packageA needs to get compiled (which involves
linking against libfoo and using libfoo's includes). I know that
packageA *does* compile (because I've done that already), but it won't
compile inside packageB's sandbox.
More information about the Haskell-Cafe