<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi everyone,</p>
<p>I'm hitting a number of roadblocks while trying to embed a ".a"
file (and its headers) in Haskell code.</p>
<p>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. <br>
</p>
<p>As such, I use a combination of extra-bundled-libraries,
include-dirs and install-includes stanzas in my cabal file:</p>
<pre class="notranslate"><span data-rgh-whitespace="space"> </span>elif<span
data-rgh-whitespace="space"> </span>flag(bundled-libsodium)
<span data-rgh-whitespace="space"> </span><span class="pl-k">extra-bundled-libraries</span>: Csodium
<span data-rgh-whitespace="space"> </span><span class="pl-k">include-dirs</span>: include
<span data-rgh-whitespace="space"> </span><span class="pl-k">install-includes</span>:
<span data-rgh-whitespace="space"> </span>include/sodium.h
<span data-rgh-whitespace="space"> </span>include/sodium/core.h
<span data-rgh-whitespace="space"> </span>include/sodium/crypto_aead_aes256gcm.h
<span data-rgh-whitespace="tab"> </span><span
data-rgh-whitespace="space"> </span>[…]
</pre>
<p></p>
<p>(full file here:
<a class="moz-txt-link-freetext" href="https://github.com/haskell-cryptography/libsodium-bindings/blob/37-libsodium-vendoring/libsodium-bindings/libsodium-bindings.cabal">https://github.com/haskell-cryptography/libsodium-bindings/blob/37-libsodium-vendoring/libsodium-bindings/libsodium-bindings.cabal</a>)</p>
<p>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:</p>
<pre class="notranslate"><code class="notranslate">/usr/bin/ld.gold:<span
data-rgh-whitespace="space"> </span>error:<span
data-rgh-whitespace="space"> </span>cannot<span
data-rgh-whitespace="space"> </span>find<span
data-rgh-whitespace="space"> </span>-lsodium
collect2:<span data-rgh-whitespace="space"> </span>error:<span
data-rgh-whitespace="space"> </span>ld<span
data-rgh-whitespace="space"> </span>returned<span
data-rgh-whitespace="space"> </span>1<span
data-rgh-whitespace="space"> </span>exit<span
data-rgh-whitespace="space"> </span>status
`gcc'<span data-rgh-whitespace="space"> </span>failed<span
data-rgh-whitespace="space"> </span>in<span
data-rgh-whitespace="space"> </span>phase<span
data-rgh-whitespace="space"> </span>`Linker'.<span
data-rgh-whitespace="space"> </span>(Exit<span
data-rgh-whitespace="space"> </span>code:<span
data-rgh-whitespace="space"> </span>1)</code></pre>
<p>At this point I am simply baffled, because I thought that I had
the right invocation for all of this to work. <br>
</p>
<p>What else can I do? Am I missing something obvious?<br>
</p>
<p>I have opened a ticket here with a bit more details:
<a class="moz-txt-link-freetext" href="https://github.com/haskell/cabal/issues/9509">https://github.com/haskell/cabal/issues/9509</a></p>
<p>Cheers,</p>
<p>Hécate<br>
</p>
<pre class="moz-signature" cols="72">--
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: <a class="moz-txt-link-freetext" href="https://glitchbra.in">https://glitchbra.in</a>
RUN: BSD</pre>
</body>
</html>