haskell / haskell/cabal

cabal says "Missing (or bad) header file" when it's there

Open
#1,747 3 comments 0 reactions 0 assignees View on GitHub
re: error-message type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

When I do `cabal install honi` I get

```
Resolving dependencies...
Configuring honi-0.1.0.0...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: cbits/helpers.h
* Missing C library: OpenNI2
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Failed to install honi-0.1.0.0
cabal: Error: some packages failed to install:
honi-0.1.0.0 failed during the configure step. The exception was:
ExitFailure 1
```

I can successfully install it with `cabal install --extra-include-dirs=$HOME/openni/OpenNI2/Include --extra-lib-dirs=$HOME/openni/OpenNI2/Bin/x64-Release --extra-lib-dirs=$HOME/openni/OpenNI2/Bin/x64-Release/OpenNI2/Drivers honi`.

The (probable) bug is that cabal reports `* Missing (or bad) header file: cbits/helpers.h` when that header file is in fact there.

What is meant with this error? Maybe it occurs because that file `#include`s a file that is not there? In that case, shouldn't the error message reflect that? `* Missing (or bad) header file: cbits/helpers.h` is certainly misleading then.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `cabal install honi` failure and rerun configuration with `-v3`, using the reported `cbits/helpers.h` path and OpenNI2 include and library directories. Trace how Cabal checks that header and its included files. Done means the diagnostic accurately identifies the missing or invalid dependency rather than misleadingly naming `cbits/helpers.h`.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, haskell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.