Ticket #187 (closed defect: fixed)

Opened 1 year ago

Last modified 6 months ago

Paths_pkgname module is hard to use in a library

Reported by: duncan Assigned to:
Priority: normal Milestone: Cabal-1.4
Component: Cabal library Version: 1.2.2.0
Severity: normal Keywords:
Cc: Difficulty: easy (<4 hours)
GHC Version: 6.8.1 Platform:

Description

Most users of the auto-generated Paths_pkgname module are programs. With GHC at least they can get away with not specifying the Paths_pkgname in the Other-Modules field. Get away with in the sense that it does not lead to linker errors because ghc --make does dependency chasing and links in all the necessary .o files.

However for a library you must specify every module in Exposed-Modules or Other-Modules or one does get linker errors when you try to use the packages. That's because the missing module's .o files will not have been included in the library .a archive. See bug #128.

So for a library one must specify Other-Modules: Paths_pkgname but then of course Cabal cannot find that module since it is not in the normal source directories but in dist/build/autogen. So people have to hack around it by adding dist/build/autogen to the Hs-Source-Dirs field. Obviously that's rather unsatisfactory.

Probably the right solution is for Cabal to automatically add that directory to the end of the source dir search path.

Change History

01/24/08 07:57:17 changed by duncan

  • platform deleted.
  • milestone set to Cabal-1.4.

04/12/08 13:53:56 changed by duncan

  • status changed from new to closed.
  • resolution set to fixed.

Close the right ticket this time...

Sat Apr 12 22:49:04 CEST 2008  Andres Loeh <mail@andres-loeh.de>
  * fix for #187 -- directory of Paths_packagename is included when looking for source files

(follow-up: ↓ 5 ) 04/14/08 13:40:05 changed by guest

There's still a problem for sdist: sdist shouldn't care about Paths_pkgname because it's installation dependent, but if you have Paths_pkgname in Other-modules sdist tries to include that module in the tarball, and so fails to create the package because it can't find the file.

two ways to solve this might be: (i) add Paths_pkgname automatically during build, install and haddock. (ii) filter Paths_pkgname out in sdist.

but maybe the cleanest solution is to have a dedicated field in the package description?

04/23/08 15:50:20 changed by duncan

  • status changed from closed to reopened.
  • resolution deleted.

(in reply to: ↑ 3 ) 06/12/08 02:47:49 changed by duncan

  • status changed from reopened to closed.
  • resolution set to fixed.

Replying to guest:

two ways to solve this might be: (i) add Paths_pkgname automatically during build, install and haddock. (ii) filter Paths_pkgname out in sdist.

Taking option (ii):

Thu Jun 12 10:18:10 BST 2008  Duncan Coutts <duncan@haskell.org>
  * Filter out the Paths_pkgname file in sdist
  Fixes ticket #187 finally (I hope).