Getting error while building node from source - Algorand

Getting error while building node from source

post by jonisace on Feb 16, 2022

On a step

make install

getting the error


# github.com/algorand/go-algorand/crypto
crypto/batchverifier.go:33:11: fatal error: 'sodium.h' file not found
#include "sodium.h"
          ^~~~~~~~~~
1 error generated.
make: *** [buildsrc] Error 2

Even though the file exists under crypto/libs/darwin/arm64/include/sodium.h

I am using MacOS Monterey 12.1 with Apple chip

post by tsachi on Feb 16, 2022

Did you follow the README.md instructions ?

post by jonisace on Feb 17, 2022

Yes I did follow the README.md instructions

post by jonisace on Feb 17, 2022

Are there any suggestions ?

post by jonisace on Feb 18, 2022

I explicitly created symlinks from


/usr/local/include/ to crypto/libs/darwin/arm64/include/sodium/
and crypto/libs/darwin/arm64/include/sodium.h

and the error has gone. But now I am facing a new error


# github.com/algorand/go-algorand/crypto
clang: error: no such file or directory: ...go-algorand/crypto/libs/darwin/amd64/lib/libsodium.a'
clang: error: no such file or directory: '...go-algorand/crypto/libs/darwin/amd64/lib/libsodium.a'

Why is it trying to use amd64 if my arch is arm64

post by jonisace on Feb 18, 2022

Manually replacing all occurrences with


// #cgo darwin,arm64 CFLAGS: -I${SRCDIR}/libs/darwin/arm64/include
// #cgo darwin,arm64 LDFLAGS: ${SRCDIR}/libs/darwin/arm64/lib/libsodium.a

results in


# github.com/algorand/go-algorand/crypto
Undefined symbols for architecture x86_64:
  "_crypto_sign_ed25519_bv_compatible_verify_detached", referenced from:
      __cgo_6c86a93ba422_Cfunc_crypto_sign_ed25519_bv_compatible_verify_detached in _x003.o
     (maybe you meant: __cgo_6c86a93ba422_Cfunc_crypto_sign_ed25519_bv_compatible_verify_detached)
  ...

post by jonisace on Feb 18, 2022

Solved the issue! I had a wrong go version for amd64 instead of arm64

Reinstalled go, started from the beginning building process and then needed to add one more workaround symlink (like in this thread Can't build node from source)

/usr/local/include/boost -> homebrew/include/boost

After this make install finished

post by LION on Mar 24, 2022

The amd64 go got me…

but for the symlink, I did it with


export CPLUS_INCLUDE_PATH="$(brew --prefix)/include"