I don't know if it's a cabal bug, but when I try to make foreign libraries, I always put them into an `executable` section and use `-no-hs-main -fPIC -shared -dynamic`: https://github.com/nh2/call-haskell-from-anything/blob/d750f9881b4023ead32172967c0b1c88f36038f8/call-haskell-from-anything.cabal#L66