haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

cabal should fail if compilation depends on a file not existing in the cabal file #939

Closed bos closed 9 years ago

bos commented 12 years ago

(Imported from Trac #949, reported by LeventErkok on 2012-05-11)

Cabal doesn't complain if the build depends on a Haskell module that exists in the filesystem properly, but is not mentioned in the cabal file itself as part of "exposed-modules" or "other-modules". The build succeeds because ghc can find the relevant file just fine.

I've got bitten by this several times, especially after pushing a package to hackage, only to get it fail to build on the server because I've failed to put the name of a file in the appropriate section of the cabal file, thus it didn't make it to the .tar.gz bundle that got uploaded to the server.

I realize this might be hard to ensure, as it would require a deeper look into the dependencies between modules, but I trust the GHC API should have all the information necessary for cabal to complain appropriately.

thielema commented 12 years ago

On my 64bit machine I got the following strange linker error when I forgot to register a module in the Cabal file:

/usr/bin/ld: dist/build/.../Module.dyn_o: relocation R_X86_64_PC32 against undefined symbol `..._xyz1_closure' can not be used when making a shared object; recompile with -fPIC

timthelion commented 12 years ago

I second this as a bug! We ran into this https://github.com/colah/ImplicitCAD/issues/61 it is quite a nasty little bugger when all you get is a link error with no info. If this can't be fixed in cabal, perhaps GHC could at least give us a hint as to the source of the link error?

timthelion commented 12 years ago

See issue: https://github.com/haskell/cabal/issues/22

dagit commented 11 years ago

I just helped someone in #haskell with this problem. For them it was appearing because their test-suite section depended on a package that forgot to mention some modules in the other-modules list.

I found the solution by search my irc logs for the last time I helped someone with this. What I'm trying to say is, this is a pretty common problem. Is there any way to increase the priority of this bug? Perhaps adding it to the next milestone.

Thanks!

23Skidoo commented 11 years ago

This requires either parsing the output of ghc -M or a GHC option to blacklist all modules not included in exposed-modules and other-modules.

MedeaMelana commented 10 years ago

Hi, I just ran into this problem again. I thought I'd bump this issue because it hasn't received any attention in a while and I believe it's important enough to fix. Also I believe this should be labeled as bug rather than enhancement because cabal doesn't produce a valid library if someone forgets to mention a module in their cabal file.

schell commented 9 years ago

I just ran into this myself with https://github.com/schell/steeloverseer/issues/6. It looks like I deleted the "other-modules" line of my cabal file at some point trying to clean it up. /facepalm

ttuegel commented 9 years ago

Duplicate of #1746.