anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.39k stars 947 forks source link

Support FreeBSD amd64 #1691

Closed mdyring closed 4 months ago

mdyring commented 1 year ago

Hi team,

Trying to build namada from source inside a FreeBSD jail. On FreeBSD 13.2 amd64.

Inside a clean jail, doing a pkg install gmake rust llvm protobuf before the build will get me pretty far. However I am stuck here:

Compiling sysinfo v0.21.1
error[E0433]: failed to resolve: use of undeclared crate or module `fmt`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:11:6
   |
11 | impl fmt::Display for ProcessStatus {
   |      ^^^ use of undeclared crate or module `fmt`

error[E0433]: failed to resolve: use of undeclared crate or module `fmt`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:12:27
   |
12 |     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
   |                           ^^^ use of undeclared crate or module `fmt`

error[E0433]: failed to resolve: use of undeclared crate or module `fmt`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:12:46
   |
12 |     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
   |                                              ^^^ use of undeclared crate or module `fmt`

error[E0412]: cannot find type `ProcessStatus` in this scope
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:11:23
   |
11 | impl fmt::Display for ProcessStatus {
   |                       ^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing this enum
   |
7  + use crate::ProcessStatus;
   |

error[E0412]: cannot find type `ProcessStatus` in this scope
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:73:25
   |
73 |     fn status(&self) -> ProcessStatus {
   |                         ^^^^^^^^^^^^^ not found in this scope
   |
help: consider importing this enum
   |
7  + use crate::ProcessStatus;
   |

error[E0433]: failed to resolve: use of undeclared type `ProcessStatus`
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sysinfo-0.21.1/src/unknown/process.rs:74:9
   |
74 |         ProcessStatus::Unknown(0)
   |         ^^^^^^^^^^^^^ use of undeclared type `ProcessStatus`
   |
help: consider importing this enum
   |
7  + use crate::ProcessStatus;
   |

Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `sysinfo` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: src/file_lock.c:12:17: error: use of undeclared identifier 'SEEK_SET'
warning:   fl.l_whence = SEEK_SET;
warning:                 ^
warning: src/file_lock.c:31:17: error: use of undeclared identifier 'SEEK_SET'
warning:   fl.l_whence = SEEK_SET;
warning:                 ^
warning: 2 errors generated.

error: failed to run custom build command for `file-lock v2.1.9`

Caused by:
  process didn't exit successfully: `/root/namada/target/debug/build/file-lock-c29565a7cef5f6fc/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-freebsd")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-freebsd")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-freebsd
  CC_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_freebsd
  CC_x86_64_unknown_freebsd = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-freebsd
  CFLAGS_x86_64-unknown-freebsd = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_freebsd
  CFLAGS_x86_64_unknown_freebsd = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/root/namada/target/debug/build/file-lock-9bfde4798d649731/out/src/file_lock.o" "-c" "src/file_lock.c"
  cargo:warning=src/file_lock.c:12:17: error: use of undeclared identifier 'SEEK_SET'
  cargo:warning=  fl.l_whence = SEEK_SET;
  cargo:warning=                ^
  cargo:warning=src/file_lock.c:31:17: error: use of undeclared identifier 'SEEK_SET'
  cargo:warning=  fl.l_whence = SEEK_SET;
  cargo:warning=                ^
  cargo:warning=2 errors generated.
  exit status: 1

  --- stderr

  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/root/namada/target/debug/build/file-lock-9bfde4798d649731/out/src/file_lock.o" "-c" "src/file_lock.c" with args "cc" did not execute successfully (status code exit status: 1).

It would be great if you could provide release binaries alongside the Linux and Darwin builds. Hopefully not far from Darwin to FreeBSD and it would be great to get native FreeBSD performance instead of having to run it in a Linux VM.

sug0 commented 1 year ago

Hi @mdyring, thanks for opening up an issue! I think right now this isn't at the top of the list of our priorities, but it would be a nice thing to have in the foreseeable future.

Regardless, I can already identify the culprits that make your build fail:

mdyring commented 1 year ago

Sounds like there is a good path forward, building locally is not a major issue for me. Happy to give it a spin once ready.

tzemanovic commented 1 year ago

I've opened #1695 as it looks like a low hanging fruit - we'll try to include both of these in the next release

mdyring commented 1 year ago

I'm keeping my fingers crossed that this will be ready for next testnet, that way I can claim "first Namada on FreeBSD" :-)

tzemanovic commented 1 year ago

the PRs were released in 0.20 so hopefully that unblocked building on FreeBSD. If something doesn't work, please comment and/or reopen this issue

mdyring commented 1 year ago

Almost there, stuck on wasmer-vm.

error: Unsupported platform
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-vm-2.3.0/src/trap/traphandlers.rs:305:21
    |
305 |                     compile_error!("Unsupported platform");
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It is supported from v3.3.0 onwards: https://github.com/wasmerio/wasmer/blob/master/CHANGELOG.md#330---03052023

tzemanovic commented 1 year ago

depends on #821

sug0 commented 3 months ago

@mdyring hey, in case you are still interested, could you please confirm that version v0.38.0 (the latest release) of Namada works with FreeBSD? cheers