<p>I was running into this problem on MacOS Monterey (M1 Pro) while building <a href="https://github.com/input-output-hk/plutus-starter" rel="nofollow noreferrer">plutus-starter</a>.</p>
<p>Just like OP, I seemed to have installed libsodium correctly as I had all the libs in my PATH. Then I stumbled upon this <a href="https://forum.cardano.org/t/trying-to-build-a-cardano-node-cli-arm64v8-docker-image/41370/6" rel="nofollow noreferrer">thread</a> that solved it for me. What I needed was to add a <code>cabal.project.local</code> file in the root of my project with</p>
<pre><code>package cardano-crypto-praos
  flags: -external-libsodium-vrf 
</code></pre>
<p>which I think makes the <a href="https://github.com/input-output-hk/cardano-base/blob/master/cardano-crypto-praos/cardano-crypto-praos.cabal#L42" rel="nofollow noreferrer">VRF not be bundled</a>, and thus ignored as we can do without it anyway.</p>
<p>Also, before that, I rebuilt using libsodium-1.0.18-stable.tar.gz from <a href="https://download.libsodium.org/libsodium/releases/" rel="nofollow noreferrer">https://download.libsodium.org/libsodium/releases/</a>, which may also have helped.</p>
<p>Perhaps all of that is useful to someone!</p>

CC BY-SA 4.0
2022-03-21T19:37:16.277Z
I'm having the same issue but sadly this solution didn't work for me.
KugisMugis
CC BY-SA 4.0
2022-02-03T16:08:29.833Z
2022-02-03T16:08:29.833Z
carleryd
<p>If libsodium.so file is missing from /usr/local/lib, the problem here is that libsodium is not correctly installed on your Mac OS X environment.</p>

CC BY-SA 4.0
2021-10-26T16:40:35.497Z
2021-10-26T16:40:35.497Z
baocontact
<p>I've been trying to run the leader logs script, which happens to depend on <code>libsodium</code>. I run on OSX and this problem has had me dweling on the same questions many asked above.</p>
<p>If you are using OS, you should use the <code>.dylib</code> files as reference. I've found a few open source examples that opted for a best effor library detection mechanism (see <a href="https://github.com/papacarp/pooltool.io/blob/master/leaderLogs/leaderLogs.py#L109" rel="nofollow noreferrer">https://github.com/papacarp/pooltool.io/blob/master/leaderLogs/leaderLogs.py#L109</a>), which points to using <code>libsodium.23.dylib</code> for OSX.</p>
<p>Unfortunately, I  had an additional problem before being able to run the leaders log. I installed <code>libsodium</code> with <code>brew</code>, which installed the official libsodium project, but the code I needed to run required extra APIs that are only in the IOHK version of the library, so once I downloaded, compiled and installed the source code from this version, everything worked like a charm.</p>
<p>So, a couple of things:</p>
<ol>
<li>Make sure your configs point to the appropriate path of libdsodium (in OSX <code>/usr/local/lib/libsodium.23.dylib</code>).</li>
<li>Depending on the version you had compiled and installed you might be missing APIs/functions. Check you have the correct version of the library.</li>
</ol>

CC BY-SA 4.0
2022-01-22T11:08:28.687Z
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Community
CC BY-SA 4.0
2022-01-22T10:02:52.357Z
2022-01-22T12:41:10.867Z
2022-01-22T12:41:10.867Z
leonfs
<p>Did you compile and install libsodium?
Did you check environment variable to see that this is added?</p>

CC BY-SA 4.0
2021-10-22T22:51:10.040Z
Yep, env vars are there and I ran all of the steps to run libsodium that are in the instructions
Sandy Leach
CC BY-SA 4.0
2021-10-22T05:14:20.050Z
2021-10-22T05:14:20.050Z
PGWAD Pool
<p>Attempting to build the cardano-node on Mac OS Big Sur while following the instructions found here: <a href="https://developers.cardano.org/docs/get-started/installing-cardano-node/#macos" rel="noreferrer">https://developers.cardano.org/docs/get-started/installing-cardano-node/#macos</a></p>
<p>When I hit the <code>cabal build all</code> step I'm given the following error:</p>
<pre><code>[ 14 of 193] Compiling PlutusCore.Pretty.Readable ( plutus-core/src/PlutusCore/Pretty/Readable.hs, dist/build/PlutusCore/Pretty/Readable.o, dist/build/PlutusCore/Pretty/Readable.dyn_o )
&lt;command line&gt;: dlopen(/Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib, 5): Symbol not found: _sodium_free
  Referenced from: /Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib
  Expected in: flat namespace
 in /Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib
</code></pre>
<p><a href="https://i.sstatic.net/0BYLx.png" rel="noreferrer"><img src="https://i.sstatic.net/0BYLx.png" alt="" /></a></p>
<p>Note: I have the environmental vars.  Not sure how to check that libsodium is installed correctly but I ran the steps in the instructions.</p>
<p>Please help? Thank you!</p>
<p>EDIT 1: I see the libsodium files in my <code>/usr/local/lib</code> so I believe it's installed correctly</p>
<p>EDIT 2: At this point I've already created a node on an Ubuntu instance and it's working fine... not sure if its an issue with Mac OS but I recommend doing the same if you run into this issue.</p>

CC BY-SA 4.0
2021-10-22T23:28:09.857Z
Do you have a libsodium.so file in your $LD_LIBRARY_PATH (/usr/local/lib)?
baocontact
CC BY-SA 4.0
2021-10-25T01:03:56.770Z
I don't believe I do... is that something that's supposed to happen on the install?
Sandy Leach
CC BY-SA 4.0
2021-10-25T01:23:48.060Z
I see ```libsodium.23.dylib, libsodium.dylib,  libsodium.a, libsodium.la``` in my ```/usr/local/lib``` but not ```libsodium.so```....

```libsodium.pc``` is present in my pkgconfig
Sandy Leach
CC BY-SA 4.0
2022-04-21T17:41:34.120Z
@sandy-leach did you find any solution?
Piyush
<cardano-node><build>
Cabal build all failing with error: Symbol not found: _sodium_free
# Cabal build all failing with error: Symbol not found: _sodium_free

(Asked by: username_0 on 2021-10-21)

Attempting to build the cardano-node on Mac OS Big Sur while following the instructions found here: https://developers.cardano.org/docs/get-started/installing-cardano-node/#macos
When I hit the cabal build all step I'm given the following error:
[ 14 of 193] Compiling PlutusCore.Pretty.Readable ( plutus-core/src/PlutusCore/Pretty/Readable.hs, dist/build/PlutusCore/Pretty/Readable.o, dist/build/PlutusCore/Pretty/Readable.dyn_o )
: dlopen(/Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib, 5): Symbol not found: _sodium_free
  Referenced from: /Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib
  Expected in: flat namespace
 in /Users/sanfordleach/.cabal/store/ghc-8.10.4/lib/libHScrdn-crypt-clss-2.0.0-a62d56db-ghc8.10.4.dylib


Note: I have the environmental vars.  Not sure how to check that libsodium is installed correctly but I ran the steps in the instructions.
Please help? Thank you!
EDIT 1: I see the libsodium files in my /usr/local/lib so I believe it's installed correctly
EDIT 2: At this point I've already created a node on an Ubuntu instance and it's working fine... not sure if its an issue with Mac OS but I recommend doing the same if you run into this issue.

**Tags:** cardano-node, build
> **Comments:**
> **username_1**: Do you have a libsodium.so file in your $LD_LIBRARY_PATH (/usr/local/lib)?  
> **username_0**: I don't believe I do... is that something that's supposed to happen on the install?  
> **username_0**: I see ```libsodium.23.dylib, libsodium.dylib,  libsodium.a, libsodium.la``` in my ```/usr/local/lib``` but not ```libsodium.so```....  ```libsodium.pc``` is present in my pkgconfig  
> **username_2**: @sandy-leach did you find any solution?  

---

## 4 answers

### Answer by username_3 on 2022-02-03. Score: 2

I was running into this problem on MacOS Monterey (M1 Pro) while building plutus-starter.
Just like OP, I seemed to have installed libsodium correctly as I had all the libs in my PATH. Then I stumbled upon this thread that solved it for me. What I needed was to add a cabal.project.local file in the root of my project with
package cardano-crypto-praos
  flags: -external-libsodium-vrf 

which I think makes the VRF not be bundled, and thus ignored as we can do without it anyway.
Also, before that, I rebuilt using libsodium-1.0.18-stable.tar.gz from https://download.libsodium.org/libsodium/releases/, which may also have helped.
Perhaps all of that is useful to someone!

> **Comments:**
> **username_4**: I'm having the same issue but sadly this solution didn't work for me.  

---

### Answer by username_1 on 2021-10-26. Score: 1

If libsodium.so file is missing from /usr/local/lib, the problem here is that libsodium is not correctly installed on your Mac OS X environment.


---

### Answer by username_5 on 2022-01-22. Score: 0

I've been trying to run the leader logs script, which happens to depend on `libsodium`. I run on OSX and this problem has had me dweling on the same questions many asked above.

If you are using OS, you should use the `.dylib` files as reference. I've found a few open source examples that opted for a best effor library detection mechanism (see <https://github.com/papacarp/pooltool.io/blob/master/leaderLogs/leaderLogs.py#L109>), which points to using `libsodium.23.dylib` for OSX.

Unfortunately, I had an additional problem before being able to run the leaders log. I installed `libsodium` with `brew`, which installed the official libsodium project, but the code I needed to run required extra APIs that are only in the IOHK version of the library, so once I downloaded, compiled and installed the source code from this version, everything worked like a charm.

So, a couple of things:

1. Make sure your configs point to the appropriate path of libdsodium (in OSX `/usr/local/lib/libsodium.23.dylib`).
2. Depending on the version you had compiled and installed you might be missing APIs/functions. Check you have the correct version of the library.

> **Comments:**
> **username_6**: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  

---

### Answer by username_7 on 2021-10-22. Score: 0

Did you compile and install libsodium?
Did you check environment variable to see that this is added?

> **Comments:**
> **username_0**: Yep, env vars are there and I ran all of the steps to run libsodium that are in the instructions  

---

