Kapil
Kapil

Reputation: 423

Compiling haskell source as dynamic library

I'm trying to compile a Haskell source package as a dynamic library to be used with OCaml code. I tried using the --enable-shared option with cabal install on the .cabal file of the source, I got a Perhaps you haven't installed the "dyn" libraries for package 'zeromq4-haskell-0.6.5' error. After a little googling, I realised that the dependencies must also be compiled as dynamic libraries. I downloaded the source package for zeromq and tried installing the zeromq package with the --enable-shared option. This time I got a similar error with one of zeromq's dependencies. I tried doing this 4-5 times and get an error with a different dependency at each level.

Am I making a mistake here? How can I get all of the dependencies to install as dynamic libraries?

Thanks!

Upvotes: 0

Views: 265

Answers (1)

sapanoia
sapanoia

Reputation: 789

If you generally want to have shared libraries, you can permanently enable it in your .cabal/config:

shared: True

However, it will only affect libraries installed after that, so you may want to purge all libraries and start over again.

If this is just a one-shot, you may create a cabal sandbox just for that purpose:

cd yourlib
cabal sandbox init
cabal install --enable-shared

The result will be in the directory .cabal-sandbox.

Upvotes: 1

Related Questions