Hi everyone,

I'm hitting a number of roadblocks while trying to embed a ".a" file (and its headers) in Haskell code.

The setup is the following: I have a bindings library that handles all of the cAPI FFI declarations, and a consumer that does not directly depend on the underlying C library.

As such, I use a combination of extra-bundled-libraries, include-dirs and install-includes stanzas in my cabal file:

  elif flag(bundled-libsodium)
    extra-bundled-libraries: Csodium
    include-dirs: include
    install-includes: 
      include/sodium.h
      include/sodium/core.h
      include/sodium/crypto_aead_aes256gcm.h
	  […]

(full file here: https://github.com/haskell-cryptography/libsodium-bindings/blob/37-libsodium-vendoring/libsodium-bindings/libsodium-bindings.cabal)

It all seemed to work on my day-to-day system, but further tests on a system that did not have libsodium installed system-wide showed that there's still a missing part:

/usr/bin/ld.gold: error: cannot find -lsodium
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)

At this point I am simply baffled, because I thought that I had the right invocation for all of this to work.

What else can I do? Am I missing something obvious?

I have opened a ticket here with a bit more details: https://github.com/haskell/cabal/issues/9509

Cheers,

Hécate

-- 
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: https://glitchbra.in
RUN: BSD