I have a C library "myboo" which has Makefile. I want to make a wrapper of this library. I don't want to install it into /usr/local since "myboo" is not a major module. Additionally it is recommended that I build "myboo" not as a dynamic library but as a static library.
I make custom Setup.py to build "myboo";
main :: IO ()
main = defaultMainWithHooks simpleUserHooks {
preBuild = \a b -> makeLib a b >> preBuild simpleUserHooks a b
}
makeLib :: Args -> BuildFlags -> IO ()
makeLib _ flags = do
let verbosity = fromFlag $ buildVerbosity flags
cflags <- lookupEnv "CFLAGS" >>= return . maybe "" id
setEnv "CFLAGS" $ "-fPIC" ++ (' ' : cflags)
rawSystemExit verbosity "env" ["make", "--directory=myboo", "libmyboo.a"]
And I arrange myboo.cabal to link my haskell codes to C library;
library
exposed-modules: MyBoo
build-depends: base >=4.7 && <4.8
hs-source-dirs: src
default-language: Haskell2010
include-dirs: myboo
extra-libraries: myboo
extra-lib-dirs: myboo
When I run "cabal build", I got following messages.
myboo-0.1.0.0: library-dirs: myboo is a relative path which makes no sense (as
there is nothing for it to be relative to). You can make paths relative to the
package database itself by using ${pkgroot}. (use --force to override)
If I write "extra-lib-dirs: /absolute/path/to/working/dir/myboo", it seems that it works well. But it's not good way because /absolute/... is just a working directory.
How should I fix above error messages? My environment is here;
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.2
% cabal --version
cabal-install version 1.20.0.2
using version 1.20.0.0 of the Cabal library
% cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With