[rust, curl, tls] neovide failed to run custom build command for `sdl2-sys v0.34.0`

Hi, I’m trying to create package for neovide: GitHub - neovide/neovide: No Nonsense Neovim Client in Rust

shell.nix

let
  moz_overlay = import (
    builtins.fetchTarball
      "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"
  );
  nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
  ruststable = (
    nixpkgs.latest.rustChannels.stable.rust.override {
      extensions = [ "rust-src" "rust-analysis" "rustfmt-preview" ];
    }
  );
in
  with nixpkgs;
  stdenv.mkDerivation {
    name = "rust-stable";
    buildInputs =
      [ stdenv openssl pkgconfig cargo rustc rustup ruststable freetype ];
  }

The error:
nix-shell -p --run 'RUST_BACKTRACE=full cargo build --release'

error: failed to run custom build command for `sdl2-sys v0.34.0`

Caused by:
  process didn't exit successfully: `/c/neovide/target/release/build/sdl2-sys-97227988e5290b8e/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Command 'curl' failed:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
', /home/ksevelyar/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-sys-0.34.0/build.rs:53:17
stack backtrace:
   0:     0x5570a2b8a843 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf9a858612dbb4098
   1:     0x5570a2bae7ec - core::fmt::write::hde32b9032cc454bd
   2:     0x5570a2b88015 - std::io::Write::write_fmt::h2f623909338bd408
   3:     0x5570a2b939e5 - std::panicking::default_hook::{{closure}}::hcc427a59ad7415f9
   4:     0x5570a2b936f0 - std::panicking::default_hook::h3c27ea56707cd031
   5:     0x5570a2b93fea - std::panicking::rust_panic_with_hook::h41b614a0ce92c04c
   6:     0x5570a2b93bd0 - rust_begin_unwind
   7:     0x5570a2b93b4b - std::panicking::begin_panic_fmt::hfaed05fa7b9d8ee8
   8:     0x5570a2ab77e2 - build_script_build::run_command::h8f567d1027dd96f3
                               at /home/ksevelyar/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-sys-0.34.0/build.rs:53
   9:     0x5570a2ab77e2 - build_script_build::download_to::h6fbde805aace8c5a
                               at /home/ksevelyar/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-sys-0.34.0/build.rs:74
  10:     0x5570a2ab77e2 - build_script_build::download_sdl2::h1efc23e1fdb66eba
                               at /home/ksevelyar/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-sys-0.34.0/build.rs:117
  11:     0x5570a2ab77e2 - build_script_build::main::h5094fc1115d9867e
                               at /home/ksevelyar/.cargo/registry/src/github.com-1ecc6299db9ec823/sdl2-sys-0.34.0/build.rs:467
  12:     0x5570a2ab8d83 - std::rt::lang_start::{{closure}}::he1d2118144ddb9c2
                               at /build/rustc-1.42.0-src/src/libstd/rt.rs:67
  13:     0x5570a2b93ab3 - std::panicking::try::do_call::h68771d5c764c5b7c
  14:     0x5570a2b9e987 - __rust_maybe_catch_panic
  15:     0x5570a2b96567 - std::rt::lang_start_internal::h2ec653ad9ffd9dc5
  16:     0x5570a2ab8308 - main
  17:     0x7f89a5253d8b - __libc_start_main
  18:     0x5570a2ab11ca - _start
  19:                0x0 - <unknown>

warning: build failed, waiting for other jobs to finish...

Which is a bit odd because I can:

nix-shell -p  --run 'curl https://libsdl.org/release/SDL2-2.0.10.tar.gz -o test.tar.gz'                     master
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5420k  100 5420k    0     0   777k      0  0:00:06  0:00:06 --:--:-- 1115k

Perhaps you should try adding SDL2 to your buildInputs, and removing the line in cargo.toml that forces SDL2 to be statically linked. That worked for me, and now I’m fighting with skia, as it’s non-trivial to package, and the crate assumes it can access the network while running build.rs.

Might be fair to request upstream changes to account for that.

True. I’d like to get my modified version building in nix before I submit any changes upstream.

Packaging skia and making it available to skia-rust is being a pain. In other news, neovide is very snappy on my machine, and I’m really enjoying the cursor wipe animation (when I tune down the time it spends in the animation), as it helps me keep track of the cursor more. This makes me wonder if it would be useful for a terminal, or if ncurses apps would make it noisy.

1 Like

I have the same problem with skia-bings when packaging another rust app. Did you manage to resolve the problem?

Not really. I opened an issue, and a developer was able to help me get through some stuff (gn and ninja paths should be configurable on master), but I did not get much farther than that. I apparently don’t have the code anymore :sweat_smile: I don’t know how that happened.

1 Like