简体   繁体   中英

cabal build error `gcc` failed: connot find `#include`

I try to build qhull from hackage and get the error

fatal error: qhull_ra.h: No such file or directory
        2 | #include "qhull_ra.h"

`gcc' failed in phase `C Compiler'. (Exit code: 1)

The file is in the Cdir and the relevant parts of the cabal file are

  include-dirs:        ./Cdir
  C-sources:           ./Cdir/libqhull_r.c
                     , ./Cdir/geom_r.c
                     , ...

The file qhull_ra.h is not listed as C-sources, because it is a header file.

I did not write the code and are not experienced with including C code into haskell packages. The failure occurs sometimes and sometimes not, but I cannot tell when. What is wrong? I want to upload the package (authorized by the author); what do I have to change to make it compile with cabal install ?

I've noticed that cabal install is (since recently) much more strict than cabal build when looking for files. So, I believe here the problem is that your include files are not being picked up by cabal.

I think you can fix that by listing your header files in a includes: field. So at least:

   include-dirs: Cdir
   includes:     qhull_ra.h
   c-sources:    Cdir/libqhull_r.c
               , ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM