7

I've got two packages that I'm developing, A and B. Package B depends on A.

A was developed in it's own sandbox, and a similar story goes for B:

A> cabal sandbox init
A> cabal install --enable-shared

B> cabal sandbox init
B> cabal sandbox add-source ../A/
B> cabal install

also note that shared: True is in my ~/.cabal/config.

Everything looks good here, they both install just fine. However, while working on B, if I issue cabal repl, cabal-install tells me that it can't load the libAsomething.so/.dll file. What went wrong here?

Here is the exact error:

...
Loading package mtl-0.0.1 ... linking ... done.
Loading package A-0.0.0 ... <command line>: can't load .so/.DLL for: /home/athan/dev/A/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.3/A-0.0.0/libHSA-0.0.0-ghc7.8.3.so (/home/athan/dev/foo/B/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.3/A-0.0.0/libHSA-0.0.0-ghc7.8.3.so: undefined symbol: AsomethingCrazyInAmodule_closure)

Edit:

I'm using GHC 7.8.3 and cabal-install 1.20.0.3.

Athan Clark
  • 3,886
  • 2
  • 21
  • 39
  • what is 'share: True' supposed to do ? – mb14 Dec 11 '14 at 22:11
  • @mb14 http://stackoverflow.com/questions/13188387/what-does-shared-mean-in-cabal-config – Athan Clark Dec 12 '14 at 02:38
  • 1
    Are you that `--enable-shared` will set `shared`. It might be the case but the link you refer doesn't say anything about `shared` in `~/.cabal/config`. Anyway this `--enable-share` doesn't share library between cabal sandbox but uses shared library vs static one, which is totally different. – mb14 Dec 12 '14 at 17:06
  • You don't need to create a sandbox for A to be able to add it into a sandbox for B. – tibbe Dec 13 '14 at 16:36

1 Answers1

2

Does using just one sandbox work for you?

(unpack A into src/A)
(unpack B into src/B)
cd src/B
cabal sandbox init
cabal add-source ../src/A
cabal install                -- builds both A and B

Now there is only one sandbox (located in src/B).

ErikR
  • 51,541
  • 9
  • 73
  • 124
  • 1
    `add-source` doesn't share the sandbox. `cabal sandbox init --sandbox ../src/A` does. – mb14 Dec 11 '14 at 22:29