1

I'm trying to build deno (a javascript runtime built in rust) from source on FreeBSD 12.1.
The compilation failed at rusty_v8.

I then try to compile directly from the rusty_v8 repo.

I've followed the instructions from the github repository (installed python2.7 - symlinked to python since it's required to have python for the installation, installed glib-2.56.3_7,1).

I then ran cargo build and everything compiles until I get this error:

 Compiling rusty_v8 v0.5.0 (/root/rusty_v8)
     Running `CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_HOMEPAGE= CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=5 CARGO_PKG_NAME=rusty_v8 CARGO_PKG_REPOSITORY='https://github.com/denoland/rusty_v8' CARGO_PKG_AUTHORS='the Deno authors' CARGO_PKG_DESCRIPTION='Rust bindings to V8' CARGO_MANIFEST_DIR=/root/rusty_v8 CARGO=/usr/local/bin/cargo LD_LIBRARY_PATH='/root/rusty_v8/target/debug/deps:/usr/local/lib' CARGO_PKG_VERSION_PRE= CARGO_PKG_VERSION=0.5.0 rustc --crate-name build_script_build --edition=2018 build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=719d54043908067c -C extra-filename=-719d54043908067c --out-dir /root/rusty_v8/target/debug/build/rusty_v8-719d54043908067c -C incremental=/root/rusty_v8/target/debug/incremental -L dependency=/root/rusty_v8/target/debug/deps --extern cargo_gn=/root/rusty_v8/target/debug/deps/libcargo_gn-b31804f02f0a6a61.rlib --extern which=/root/rusty_v8/target/debug/deps/libwhich-e5ce3a8d7f279796.rlib -L native=/root/rusty_v8/target/debug/build/backtrace-sys-2d9c9cf21034351a/out`
error[E0308]: mismatched types
   --> build.rs:117:18
    |
117 | fn platform() -> &'static str {
    |    --------      ^^^^^^^^^^^^ expected `&str`, found `()`
    |    |
    |    implicitly returns `()` as its body has no tail or `return` expression

error: aborting due to previous error


The error comes from this function:

fn platform() -> &'static str {
  #[cfg(target_os = "windows")]
  {
    "win"
  }
  #[cfg(target_os = "linux")]
  {
    "linux64"
  }
  #[cfg(target_os = "macos")]
  {
    "mac"
  }
}

As target_os = "freebsd", the functions returns nothing, hence the error. I'll try to modify the values to see if it changes anything and I'll deep a bit more into the source code.

Hugh
  • 367
  • 1
  • 10
  • 1
    What is the output of `rustc --explain E9308`? Also Python2.7 has been deprecated on FreeBSD. Do you really have that installed? – Rob Jun 02 '20 at 18:14
  • I've updated my post about `rustc --explain E9308`. `pkg install python2` installs python2.7, but I've had a warning message stating it's deprecated. However, python seems to work fine and `python --version` outputs "Python 2.7.18" – Hugh Jun 02 '20 at 18:42

1 Answers1

2

Deno is currently (20200602) listed as a WantedPorts now available as a port in www/deno.

Note that this lists pull request 60 as a prerequisite for sys-info-rs. This has been merged in 15 days ago and is then not part of the latest release 0.5.7 from 6 sep 2019. From the changelog it will be part of 0.7.0 but it does not seem to be released yet.

You then need to build this yourself or wait for sys-info-rs 0.7.0 to be generally available.

If it is smooth sailing after that I do not know.

If all this seems a little hairy then the good news is that LiWenHsu is listed as working on the port. So you could lean back and monitor FreshPorts to see when it becomes available.

Claus Andersen
  • 3,239
  • 1
  • 12
  • 24