k0ral / imm

Execute arbitrary actions for each unread element of RSS/Atom feeds
http://hackage.haskell.org/package/imm
Creative Commons Zero v1.0 Universal
16 stars 4 forks source link

Can't build config when running `imm` from a sandbox #6

Closed curiousleo closed 8 years ago

curiousleo commented 9 years ago

Hi there, I built imm in a cabal sandbox. With the example configuration in ~/.config/imm/imm.hs, I get the following error when invoking imm -l:

$ imm -l

/home/leo/.config/imm/imm.hs:3:8:
    Could not find module ‘Imm’
    Perhaps you meant Cmm (needs flag -package ghc-7.8.4)
    Use -v to see a list of the files searched for.

I think I understand where this is coming from---the Imm module is not available to ghc because the sandbox I built it in is not in the search path. But how do I fix it? Is there some way to run imm out of a sandbox?

curiousleo commented 9 years ago

Actually, even with imm installed globally using cabal install imm, I get the same error...

k0ral commented 9 years ago

I believe you need to perform the following steps:

This procedure is not specific to imm, you can apply it to any project that uses both dyre and sandboxes. Please let me know if it doesn't fix your issue.

curiousleo commented 9 years ago

Thanks for the help! Unfortunately that only fails with a different error. The build works just fine:

$ cabal build && cabal install
... all fine ...
$ ls -lh dist/build/imm 
total 21M
-rwxr-xr-x 1 leo leo 21M May 21 21:50 imm
drwxr-xr-x 1 leo leo  26 May 21 21:50 imm-tmp

But then cabal exec fails ...

$ cabal exec dist/build/imm/imm -- -h
cabal: The program 'dist/build/imm/imm' is required but it could not be found.

... even though the program is clearly there and executable:

$ ./dist/build/imm/imm -h
... prints help ...
k0ral commented 9 years ago

My bad: you need to provide cabal exec with the full (absolute) path to the executable. Don't ask me why :) .

curiousleo commented 9 years ago

I tried that too... When I give cabal exec the executable's absolute path, it behaves as if I had just started the executable directly:

k0ral commented 9 years ago

Well I'm running out of ideas here... The error suggests that the sandbox is somehow missing the Imm module, so have a look inside the .cabal-sandbox directory and see if you can find it. I don't know how the directory is organized so I can't tell you where to look precisely, sorry. Also, just to be sure, does the same error happen when you run cabal exec imm -- -l (without the path) ?

curiousleo commented 9 years ago

Hi, cabal exec imm -- -l unfortunately gives the same "module not found" error.

I found Imm's compiled files in the .cabal-sandbox directory:

.cabal-sandbox/lib/x86_64-linux-ghc-7.8.4/imm-0.6.0.3
├── Imm
│   ├── Boot.dyn_hi
│   ├── Boot.hi
│   ├── Config.dyn_hi
│   ├── Config.hi
│   ├── Core.dyn_hi
│   ├── Core.hi
│   ├── Database.dyn_hi
│   ├── Database.hi
│   ├── Dyre.dyn_hi
│   ├── Dyre.hi
│   ├── Error.dyn_hi
│   ├── Error.hi
│   ├── Feed.dyn_hi
│   ├── Feed.hi
│   ├── HTTP.dyn_hi
│   ├── HTTP.hi
│   ├── Maildir.dyn_hi
│   ├── Maildir.hi
│   ├── Mail.dyn_hi
│   ├── Mail.hi
│   ├── OPML.dyn_hi
│   ├── OPML.hi
│   ├── Options.dyn_hi
│   ├── Options.hi
│   ├── Util.dyn_hi
│   └── Util.hi
├── Imm.dyn_hi
├── Imm.hi
├── libHSimm-0.6.0.3.a
├── libHSimm-0.6.0.3-ghc7.8.4.so
├── Paths_imm.dyn_hi
└── Paths_imm.hi

1 directory, 32 files

But I don't know enough about how cabal/ghc determine the search path to tell where things are going wrong...

k0ral commented 8 years ago

Closing this issue as it is rather old and probably not relevant anymore (imm code has changed a lot). Please reopen otherwise.