building Grin openbsd
openbsd now ships with updated rust packages. (not_rust-up) I'm hoping there can be a successful build on obsd platforms. errors thrown during build process follows:
Compiling darling_core v0.10.2
error[E0432]: unresolved import `self::os`
--> /home/cuento/.cargo/registry/src/index.crates.io-1cd66030c949c28d/liblmdb-sys-0.2.2/src/lib.rs:5:15
|
5 | pub use self::os::{mdb_mode_t, mdb_filehandle_t};
| ^^
| |
| unresolved import
| help: a similar path exists: `std::os`
For more information about this error, try `rustc --explain E0432`.
The following warnings were emitted during compilation:
warning: mdb/libraries/liblmdb/mdb.c:9821:33: warning: unused parameter 'env' [-Wunused-parameter]
warning: mdb_env_get_maxkeysize(MDB_env *env)
warning: ^
warning: 1 warning generated.
error: could not compile `liblmdb-sys` (lib) due to previous error
Second:
warning: CRoaring/roaring.c:287:10: fatal error: 'malloc.h' file not found
warning: #include <malloc.h> // this should never be needed but there are some reports that it is needed.
warning: ^~~~~~~~~~
warning: 1 error generated.
error: failed to run custom build command for `croaring-sys v0.5.2`
Caused by:
process didn't exit successfully: `/home/cuento/grin/target/release/build/croaring-sys-09e6b 81596a21284/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=CRoaring
cargo:rerun-if-env-changed=ROARING_ARCH
TARGET = Some("i686-unknown-openbsd")
OPT_LEVEL = Some("3")
HOST = Some("i686-unknown-openbsd")
cargo:rerun-if-env-changed=CC_i686-unknown-openbsd
CC_i686-unknown-openbsd = None
cargo:rerun-if-env-changed=CC_i686_unknown_openbsd
CC_i686_unknown_openbsd = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = None
cargo:rerun-if-env-changed=CFLAGS_i686-unknown-openbsd
CFLAGS_i686-unknown-openbsd = None
cargo:rerun-if-env-changed=CFLAGS_i686_unknown_openbsd
CFLAGS_i686_unknown_openbsd = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-Wall" "-Wextra" "-Wno-unused-function" "-o" "/home/woodstock2/grin/target/release/build/croaring-sys-b4266b1e615e10b4/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
cargo:warning=CRoaring/roaring.c:287:10: fatal error: 'malloc.h' file not found
cargo:warning=#include <malloc.h> // this should never be needed but there are some reports that it is needed.
cargo:warning= ^~~~~~~~~~
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-Wall" "-Wextra" "-Wno-unused-function" "-o" "/home/woodstock2/grin/target/release/build/croaring-sys-b4266b1e615e10b4/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c" with args "cc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...xit status: 1)
--- stdout
cargo:rerun-if-changed=CRoaring
cargo:rerun-if-env-changed=ROARING_ARCH
TARGET = Some("i686-unknown-openbsd")
OPT_LEVEL = Some("3")
HOST = Some("i686-unknown-openbsd")
cargo:rerun-if-env-changed=CC_i686-unknown-openbsd
CC_i686-unknown-openbsd = None
cargo:rerun-if-env-changed=CC_i686_unknown_openbsd
CC_i686_unknown_openbsd = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = None
cargo:rerun-if-env-changed=CFLAGS_i686-unknown-openbsd
CFLAGS_i686-unknown-openbsd = None
cargo:rerun-if-env-changed=CFLAGS_i686_unknown_openbsd
CFLAGS_i686_unknown_openbsd = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-Wall" "-Wextra" "-Wno-unused-function" "-o" "/home/woodstock2/grin/target/release/build/croaring-sys-b4266b1e615e10b4/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
cargo:warning=CRoaring/roaring.c:287:10: fatal error: 'malloc.h' file not found
cargo:warning=#include <malloc.h> // this should never be needed but there are some reports that it is needed.
cargo:warning= ^~~~~~~~~~
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m32" "-Wall" "-Wextra" "-Wno-unused-function" "-o" "/home/woodstock2/grin/target/release/build/croaring-sys-b4266b1e615e10b4/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c" with args "cc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
Hi. OpenBSD and Grin user and miner here. Let me tell you that it took me a long time to get the grin node running on OpenBSD since I had to sit for many hours to experiment. Let's take things from the beginning.
- OpenBSD is a tier 3 arch. Tier 3 targets are those which the Rust codebase has support for, but which the Rust project does not build or test automatically, so they may or may not work.
- pkg_add rust llvm
- In your .profile add the following line and in .xsession export LC_CTYPE="en_US.UTF-8" otherwise your node will have some strange characters because of ncurses.
- Reboot and start building Grin Node.
- The errors you get, can easilly configured in ~/.cargo/registry/src/index.crates.io-1cd66030c949c28d/liblmdb-sys-0.2.2/src/lib.rs:5:15 line, Change the freebsd target to openbsd.
- cargo:warning=CRoaring/roaring.c:287:10 Solution
- After these changes your Grin Node will successfully build.
- When you start Grin Node you cannot connect to peers because lmdb built from upstream source code rather than the package, it won't have the patch to force MDB_WRITEMAP which is needed on OpenBSD where you can't mix file and mmap access without syncs (no unified buffer cache). It has downsides too, less safety against application bugs!
- Now we go deeper... As you know you can costumize and build a kernel and force MDB_WRITEMAP
- If you do all the above Grin Node will run.
I'm not a developer. However, with a lot of reading and experimentation the node ran successfully.
OpenBSD is one of the most secure operating systems, if not the most secure! A basic principle of the OpenBSD developers is that under no circumstances should we touch the kernel of the operating system. It is not Linux. Even in communication that I had with some of them they recommended that I not go any further for security reasons. The slightest change is bound to create a crash or security vulnerabilities which we do not want under any circumstances. Of course if you have a deep knowledge of C and Rust language and know how costumize kernels without security holes then you can do it. Although usually the kernel costumize is done by the OpenBSD developers (testing purposes) for new software releases every 6 months. It is not for ordinary users.
This may all seem disappointing to you, but it's not. OpenBSD is definitely the most secure and solid server. So what I do and recommend to those who want to use OpenBSD is to create virtual machines, connect and run Grin nodes over ssh On a vmm you can install debian in cli mode (no desktop environment supported) and connect over ssh. The memory used is very small. Also you can create 3-4 different network interfaces on different machines and run nodes in parallel. OpenBSD is built to have such features!
Conclusion If you really want to help Grin network, create virtual machines, run nodes on the most secure operating system over ssh. Know that nothing breaks the connection (OpenBSD and OpenSSH are real rocks) and all you will need every 6 months is the $ sysupgrade -s command
Any help you need in setting up virtual machines and firewall configuration I am ready to help you
Good Luck!
P.S: Everything I have written relates to older versions of the grin node. I have not tested the latest one. Maybe even more changes and configuration are needed.