[Haskell-cafe] Trying desperately to make a c library binding on Windows

Nicu Ionita nicu.ionita at acons.at
Thu Mar 17 21:19:29 UTC 2016

Hi all,

I am really stuck with my try to make a Haskell binding for the library 
bayesopt on Windows.
In theory it looks all simple, just put some lines in the cabal 
configuration file:

extra-lib-dirs:      /path/to/the/lib    -- contains the file libbayesopt.a
extra-libraries:    bayesopt

But whatever I tried, I can't step over the configuration phase, coz I 
get (I'm compiling with stack):

Configuring BaseOh-
setup-Simple-Cabal- Missing 
on a foreign library:
* Missing C library: /j/BO/lib/libbayesopt.a
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 I comment those lines out, then the configure phase succeeds, the 
library is compiled (i.e. my binding library), but a test executable in 
the same project does of course not compile, as symbols are missing:

In-place registering BaseOh-
Preprocessing executable 'test' for BaseOh-
[1 of 2] Compiling Optimisation.Stochastic.BayesOpt ( 
p\Optimisation\Stochastic\BayesOpt.o )
ghc.exe: unable to load package `BaseOh-'
\HSBaseOh- unknown symbol 

--  While building package BaseOh- using:

Does somebody have some idea, what is going on?

I am on Win 7, using stack (configured for lts-4.2) under MinGW.
(I'm using inline-c to make the bindings, and the same trick for include 
- include-dirs: ... - worked fine.)

Thanks, and sorry for the longer email.

More information about the Haskell-Cafe mailing list