[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-0.1.0.0...
setup-Simple-Cabal-1.22.5.0-x86_64-windows-ghc-7.10.3.exe: Missing 
dependency
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-0.1.0.0...
Preprocessing executable 'test' for BaseOh-0.1.0.0...
[1 of 2] Compiling Optimisation.Stochastic.BayesOpt ( 
src\Optimisation\Stochasti
c\BayesOpt.hs, 
.stack-work\dist\x86_64-windows\Cabal-1.22.5.0\build\test\test-tm
p\Optimisation\Stochastic\BayesOpt.o )
ghc.exe: unable to load package `BaseOh-0.1.0.0'
ghc.exe: 
J:\Projects\BaseOh\.stack-work\dist\x86_64-windows\Cabal-1.22.5.0\build
\HSBaseOh-0.1.0.0-GdNObdePATgDIW1I2OVwEc.o: unknown symbol 
`initialize_parameter
s_to_default'

--  While building package BaseOh-0.1.0.0 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.
Nicu


More information about the Haskell-Cafe mailing list