[Haskell-cafe] how to set extra-lib-dirs for a dependency in a stack project?

Henning Thielemann lemming at henning-thielemann.de
Sun Jan 30 17:05:56 UTC 2022


On Sun, 30 Jan 2022, Johannes Waldmann wrote:

> is it possible to specify include-dirs and extra-lib-dirs
> for a dependency?
>
> I have
>
> * top-level project A, depends on:
> * project B, depends on:
> * C: external library (written in C)
>
> I am building A with stack. I don't want to put
> fixed locations (include/lib) for C  in  B.cabal,
> because it depends on the (top-level) build environment of A
> (e.g., my machine, or CI).
>
> Concrete example: C = kissat SAT solver, B = Haskell API for C.

Are B and C part of Stackage?

It sounds as if they are not.

If so, then why would you want to build with 'stack', at all?


> With cabal.project, I could set options for (all?) dependencies?
> https://cabal.readthedocs.io/en/3.4/cabal-project.html#foreign-function-interface-options
> Would stack use this setting (will it read that file at all)?

stack ignores cabal.project.

> Will I have to copy  all extra-deps source repo locations
> to cabal.project?

In cabal.project you can add:

package C
    extra-include-dirs: /usr/local/C/include
    extra-lib-dirs: /usr/local/C/lib


More information about the Haskell-Cafe mailing list