Problems with install-includes
duncan.coutts at worc.ox.ac.uk
Wed Jan 21 21:30:06 EST 2009
On Wed, 2009-01-21 at 18:02 +0100, George Giorgidze wrote:
> In my project I am using C include/header files that are
> hierarchically nested into folders. These header files are used to
> compile the Haskell package and everything is fine with the
> compilation process.
> I want these include files also to be installed with the package. From
> the online documentation of Cabal I learned that there exists specific
> field for this purpose called install-includes. However, it does not
> work when include files are hierarchically nested into folders. Here
> is relevant part of the cabal file I am using.
> include-dirs: cbits/sundials/include
> install-includes: nvector/nvector_serial.h
> when I am issuing cabal install command I am getting the following error:
> cabal: Error: some packages failed to install:
> Hydra-0.1 failed during the final install step. The exception was:
> /home/ggg/.cabal/lib/Hydra-0.1/ghc-6.10.1/include/nvector: copyFile: does not
> exist (No such file or directory)
> It seems to me that cabal forgets to create parent directories for
> folder nested include files. For not-nested include files
> install-includes filed works fine.
> The Cabal version I am using is 184.108.40.206.
> The cabal-install version I am using is 0.6.0
> Currently, as a workaround I am using data-files field to install
> include files. However, I would like to see this issue fixed (I assume
> it is a bug).
Yes it's a bug. Thanks.
The problem is the code in Distribution/Simple/Install.hs in the
function installIncludeFiles. You'll notice that it creates the toplevel
target 'include' directory, but you'll also notice that the directory
component of each .h file is not created:
unless (null incs) $ do
createDirectoryIfMissingVerbose verbosity True incdir
sequence_ [ copyFileVerbose verbosity path (incdir </> f)
| (f,path) <- incs ]
If fixed a similar bug in the data files code recently. This code is
unfortunately not very well factored so I missed the equivalent issue in
I've pushed a patch to Cabal HEAD. Could you confirm that it works? If
so I'll push it to the 1.6.x branch which means it'll make it into the
upcoming 220.127.116.11 release.
More information about the cabal-devel