Failure while building on FreeBSD
I'm quite sure that FreeBSD is not officially supported by Tezos, but I gave it a try. I think the effort to support also this system could be minimal. In the next section I'll present my journey trying to compile tezos on FreeBSD12, proposing some hotfixes which finally provide me the tezos-node binary: this could be helpful for other users who want to install tezos on FreeBSD, and for tezos developers if you have in mind to support FreeBSD in the future.
Steps to fix the compilation on FreeBSD
-
conf-hidapi: fix pkg-config file https://github.com/ocaml/opam-repository/pull/13781 -
ocaml-hidapi: fix include path for hidapi.h https://github.com/vbmithr/ocaml-hidapi/issues/1 -
vendors/ocaml-secp256k1: fix include path for gmp.h -
vendors/ocaml-lmdb: fix semun definition
Steps to reproduce (and hotfixes)
bash git clone https://gitlab.com/tezos/tezos
cd tezos
gmake build-deps
And here problems start to arise; the deps installation fails on hidapi (which as I suppose is required for the ledger support): but hidapi is installed, so I don't know what's the reale problem.
The following actions will be performed:
∗ install conf-hidapi 0
∗ install hidapi 1.0-1
===== ∗ 2 =====
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[hidapi.1.0-1] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of conf-hidapi failed at "/usr/local/bin/pkg-config hidapi-libusb".
#=== ERROR while compiling conf-hidapi.0 ======================================#
# context 2.0.3 | freebsd/x86_64 | ocaml-base-compiler.4.06.1 | git+https://gitlab.com/tezos/opam-repository.git#9f0956e21f4dcd2803d83072903872eba196bef8
# path /usr/home/dakk/Repositories/tezos/_opam/.opam-switch/build/conf-hidapi.0
# command /usr/local/bin/pkg-config hidapi-libusb
# exit-code 1
# env-file /usr/home/dakk/.opam/log/conf-hidapi-95896-58c514.env
# output-file /usr/home/dakk/.opam/log/conf-hidapi-95896-58c514.out
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build conf-hidapi 0
└─
╶─ No changes have been performed
Since I'm a bit stubborn, I removed the Ledger code from few files and I started the compilation running gmake
. Then another error:
dakk ~/Repositories/tezos gmake
ocamlc vendors/ocaml-secp256k1/src/secp256k1.o (exit 2)
(cd _build/default/vendors/ocaml-secp256k1/src && /usr/home/dakk/Repositories/tezos/_opam/bin/ocamlc.opt -g -I /usr/home/dakk/Repositories/tezos/_opam/lib/bigstring -I /usr/home/dakk/Repositories/tezos/_opam/lib/bytes -I /usr/home/dakk/Repositories/tezos/_opam/lib/cstruct -I /usr/home/dakk/Repositories/tezos/_opam/lib/parsexp -I /usr/home/dakk/Repositories/tezos/_opam/lib/sexplib -I /usr/home/dakk/Repositories/tezos/_opam/lib/sexplib0 -ccopt -DHAVE___INT128 -ccopt -DUSE_SCALAR_4X64 -ccopt -DUSE_FIELD_5X52 -ccopt -DUSE_NUM_GMP -ccopt -DUSE_SCALAR_INV_NUM -ccopt -DUSE_FIELD_INV_NUM -ccopt -DSECP256K1_INLINE=inline -ccopt -DSECP256K1_RESTRICT=restrict -ccopt -DSECP256K1_TAG_PUBKEY_EVEN=0x02 -ccopt -DSECP256K1_TAG_PUBKEY_ODD=0x03 -ccopt -DSECP256K1_TAG_PUBKEY_UNCOMPRESSED=0x04 -ccopt -DSECP256K1_TAG_PUBKEY_HYBRID_EVEN=0x06 -ccopt -DSECP256K1_TAG_PUBKEY_HYBRID_ODD=0x07 -ccopt -DENABLE_MODULE_RECOVERY -o secp256k1.o secp256k1.c)
In file included from secp256k1.c:10:
In file included from ./num_impl.h:14:
In file included from ./num.h:17:
./num_gmp.h:10:10: fatal error: 'gmp.h' file not found
#include <gmp.h>
^~~~~~~
1 error generated.
A messy hotfix: sudo ln -s /usr/local/include/gmp.h /usr/include/gmp.h
Again gmake, and I got another problem (the last, I guess):
dakk ~/Repositories/tezos gmake
ocamlc vendors/ocaml-lmdb/src/mdb.o (exit 2)
(cd _build/default/vendors/ocaml-lmdb/src && /usr/home/dakk/Repositories/tezos/_opam/bin/ocamlc.opt -g -I /usr/home/dakk/Repositories/tezos/_opam/lib/result -I /usr/home/dakk/Repositories/tezos/_opam/lib/rresult -ccopt -W -ccopt -Wall -ccopt -Wno-unused-parameter -ccopt -Wbad-function-cast -ccopt -Wuninitialized -ccopt -pthread -ccopt -O2 -ccopt -g -o mdb.o mdb.c)
mdb.c:5126:14: error: variable has incomplete type 'union semun'
union semun semu;
^
mdb.c:5126:8: note: forward declaration of 'union semun'
union semun semu;
^
mdb.c:7623:6: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^
1 warning and 1 error generated.
gmake: *** [Makefile:20: all] Error 1
So I modified vendors/ocaml-lmdb/src/mdb.c and i commented the #ifdef _SEM_SEMUN_UNDEFINED
and the next #endif
which prevented the semun union definition. Again gmake and now I have all my beloved tezos binaries (whitout ledger support).
Mar 29 17:10:02 - node.main: The Tezos node is now running!