# Build error: libsodium.a , macOS-x86\_64

**URL:** <https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845>\
**Category:** Question\
**Created:** [January 20, 2022, 10:08am UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845 "2022-01-20T10:08:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbaube](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/fbaube/32/174_2.png) [@fbaube](https://discourse.pijul.org/u/fbaube)\
**Post date:** [January 20, 2022, 10:08am UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/1 "2022-01-20T10:08:48Z")

</div>

I have never been able to build pijul on macOS, using Homebrew as package manager, and now this includes the version 1 beta. Very frustrating. First I set envvars as suggested:

```auto
export LIBRARY_PATH=/usr/local/lib \
OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib \
OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include \
DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include

```

Then for the build command  
`cargo install pijul --version "~1.0.0-alpha"`

after dozens of compiler warnings about various things, I get this very odd message:

`ld: warning: ignoring file ../../src/libsodium/.libs/libsodium.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64`

and this leads to very many symbols not found.

I have no idea how to fix this.

---

<div class="post-metadata">

**Author:** ![joyously](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/joyously/32/266_2.png) [@joyously](https://discourse.pijul.org/u/joyously)\
**Post date:** [January 20, 2022, 7:12pm UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/2 "2022-01-20T19:12:34Z")

</div>

Your text says “1.0.0-beta” but your command says “1.0.0-alpha”.  
I don’t know if it has anything to do with it.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [January 20, 2022, 10:14pm UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/3 "2022-01-20T22:14:59Z")

</div>

@joyously: you’re right, that command should by `--version "~1.0.0-beta"` indeed.

I don’t know much about OSX. My dream would be to have people with OSX and Windows experience test and benchmark Pijul on these platforms. I’ve heard it’s terribly slow on some repos on Windows, and now it’s hard to compile on OSX.

---

<div class="post-metadata">

**Author:** ![DidiBear](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/didibear/32/423_2.png) [@DidiBear](https://discourse.pijul.org/u/DidiBear)\
**Post date:** [January 21, 2022, 5:59am UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/4 "2022-01-21T05:59:16Z")

</div>

@fbaube I just installed it on my macOS by doing:

- Install dependencies as described in [the documented instructions here](https://pijul.org/manual/installing.html):

```auto
brew install llvm libsodium openssl xxhash zstd

```

- Compile `pijul` to [the latest released version](https://lib.rs/crates/pijul/versions) (currently `1.0.0-beta`)

```auto
cargo install pijul --version "~1.0.0-beta" --features git

```

The `--features git` is just to have the `pijul git` subcommand.

---

<div class="post-metadata">

**Author:** ![fbaube](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/fbaube/32/174_2.png) [@fbaube](https://discourse.pijul.org/u/fbaube)\
**Post date:** [January 21, 2022, 11:29am UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/5 "2022-01-21T11:29:15Z")

</div>

My mistake - too much cutting & pasting between windows. Just to be sure, I just re-ran the build with “beta”, and got the same failure.

---

<div class="post-metadata">

**Author:** ![fbaube](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/fbaube/32/174_2.png) [@fbaube](https://discourse.pijul.org/u/fbaube)\
**Post date:** [January 21, 2022, 12:13pm UTC](https://discourse.pijul.org/t/build-error-libsodium-a-macos-x86-64/845/6 "2022-01-21T12:13:54Z")

</div>

Just to be sure, I did a `brew reinstall` on the dependencies and then re-ran the build. I got the same error. So I guess there is something amiss in my Mac’s libraries.  
The `brew reinstall` reinstalled these versions:

```auto
🍺 /usr/local/Cellar/llvm/13.0.0_2: 5,449 files, 940.8MB
🍺 /usr/local/Cellar/libsodium/1.0.18_1: 73 files, 1MB
🍺 /usr/local/Cellar/openssl@3/3.0.1: 6,420 files, 28.1MB
🍺 /usr/local/Cellar/xxhash/0.8.1: 17 files, 381.7KB
🍺 /usr/local/Cellar/zstd/1.5.1: 31 files, 2.7MB
🍺 /usr/local/Cellar/php/8.1.2: 507 files, 79.8MB

```

The build fail is being caused by `libsodium.a`, and my Mac has these files:

```auto
/usr/local/Cellar/libsodium/1.0.18_1/lib >> ls -l
total 848K
drwxr-xr-x 6 fbaube staff 192 May 30 2019 ./
drwxr-xr-x 10 fbaube staff 320 Jan 21 13:32 ../
-r--r--r-- 1 fbaube staff 345K Jan 21 13:32 libsodium.23.dylib
-r--r--r-- 1 fbaube staff 500K May 30 2019 libsodium.a
lrwxr-xr-x 1 fbaube staff 18 May 30 2019 libsodium.dylib -> libsodium.23.dylib
drwxr-xr-x 3 fbaube staff 96 Jan 21 13:32 pkgconfig/
/usr/local/Cellar/libsodium/1.0.18_1/lib >> file libsodium.a
libsodium.a: current ar archive random library

```

So, still no idea why I get the errors

```auto
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[3]: *** [aead_aes256gcm] Error 1
  make[3]: *** Waiting for unfinished jobs....
  clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
  ld: warning: ignoring file ../../src/libsodium/.libs/libsodium.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64

```
