Tezos on NetBSD
Some notes on getting Octez to compile on NetBSD. Work in progress.
Problems with possible solutions
- Opam package doesn't include solver properly.
Three ways:
- Add lib-ext to targets and run before all (which isn't working for me)
- Is there another way to include the solver at runtime?
Builds natively - accept that we have to do this outside of pkgsrc
Once Opam is installed, it cannot compile OCaml on arm64 platforms (and probably others). Amd64 is fine.
OCaml builds in pkgsrc. Submit our pkgsrc patches back to OCaml team?
# [...]
# In file included from /usr/include/ctype.h:100,
# from sak.c:29:
# sak.c: In function 'add_stdlib_prefix':
# sak.c:126:26: warning: array subscript has type 'char' [-Wchar-subscripts]
# 126 | *name = toupper_os(*name);
# | ^
# sak.c:126:15: note: in expansion of macro 'toupper_os'
# 126 | *name = toupper_os(*name);
# | ^~~~~~~~~~
# gcc -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -g -Wl,-E -o sak sak.o
# gmake[1]: Leaving directory '/disc/tezos/_opam/.opam-switch/build/ocaml-base-compiler.4.14.1/runtime'
# Makefile:988: *** The native-code compiler is not supported on this platform. Stop.
HACL Star library explicitly excludes NetBSD Patch done. FreeBSD settings work. Sent to vdum.
GMP fix
Cannot find GMP where it expects.
zen: {343} setenv CFLAGS -I/usr/pkg/include
zen: {344} opam install conf-gmp --verbose
zen: {345} eval `opam env`
- Zarith 1.12
Zarith hackery 1.13 works out of the box. We seem to require 1.12?
cd ../
mkdir zarith-1.12
ftp -a https://github.com/ocaml/Zarith/archive/release-1.13.tar.gz
cd zarith-1.12/
tar zxvf ../release-1.13.tar.gz
zen: {363} cd ../../tezos/
zen: {364} pwd
/home/cjep/src/tezos
zen: {365} opam install ../zarith-1.12/Zarith-release-1.13
mirage-crypto-rng FreeBSD definition line in sources - needs NetBSD too! Add -DFreeBSD as a workaround
pringo.1.3 popcount function conflicts with native one I worked around by renaming it - what is the best way normally?
pyml pyml_arch.ml.c checks for unix. We have unix Pull request submitted to pyml https://github.com/thierry-martinez/pyml/pull/99
parsexp SEG FAULT
tezos-rust-libs.1.6
disc space error in /tmp. /tmp needs at least 906M free drwxrwxrwt 6 root wheel 384 Jan 27 15:32 tmp
error[E0412]: cannot find type
QueryIter
in moduleos
--> /home/cjep/src/tezos/_opam/.opam-switch/build/tezos-rust-libs.1.6/vendor/region/src/qu ery.rs:7:24 | 7 | iterator: Option, | ^^^^^^^^^ not found inos
| help: consider importing this struct
Repeatedly wanting to install autoconf. Has to be a path issue
Process
I will update this as I go.
Make sure /tmp has at least 1G available otherwise tezos-rust-libs cannot start to compile. On older machines /tmp is often in RAM to speed up.
Install prerequisites pkgin install gmake ocaml-opam jq git libev libhidapi autoconf
Get Rust
Get the Tezos sources
setenv C_INCLUDE_PATH /usr/pkg/include:/usr/pkg/include/ev setenv LIBRARY_PATH /usr/pkg/lib:/usr/pkg/lib/ev
setenv CFLAGS "-I/usr/pkg/include -DFreeBSD -fPIC"
setenv CFLAGS -I/usr/pkg/include
- init --bare gmake build-deps
Fix ups: opam install ../fixed up - hacl-star-raw needs the patch - pringo function fix - pyml - mirage-crypto-rng -DFreeBSD - zarith (install 13 instead of 12)
gmake build-deps
- class_group_vdf Cannot find gmpxx.h library
- p
- tezos-rust-lib