Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nushell: init at 0.2.0 #68279

Closed
wants to merge 1 commit into from
Closed

nushell: init at 0.2.0 #68279

wants to merge 1 commit into from

Conversation

teto
Copy link
Member

@teto teto commented Sep 7, 2019

Motivation for this change

wanted to try the powershell-like nushell (https://news.ycombinator.com/item?id=20783006).
but so far it fails with


Caused by:
  process didn't exit successfully: `/build/source/target/release/build/openssl-sys-00f1cb53cf5cbc04/build-script-main` (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
run pkg_config fail: "Failed to run `\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"`: No such file or directory (os error 2)"

--- stderr
thread 'main' panicked at '

Could not find directory of OpenSSL installation, and this `-sys` crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

If you're in a situation where you think the directory *should* be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = x86_64-unknown-linux-gnu
$TARGET = x86_64-unknown-linux-gnu
openssl-sys = 0.9.48


It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.

', /build/nushell-0.2.0-vendor/openssl-sys/build/find_normal.rs:150:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@alyssais
Copy link
Member

alyssais commented Sep 7, 2019

Doesn’t it require Rust nightly anyway? There’s no way you’re going to get this to build as part of Nixpkgs until it can run on stable.

@evanjs
Copy link
Member

evanjs commented Sep 7, 2019

At any rate, it looks like you're missing some dependencies.
pkg-config and is going to be required if it's using external libraries.
In this case, openssl as well, and just whatever else it complains about.

@evanjs
Copy link
Member

evanjs commented Sep 7, 2019

diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix
index 03bc70ff643..607b87e0059 100644
--- a/pkgs/shells/nushell/default.nix
+++ b/pkgs/shells/nushell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, openssl }:
+{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, openssl, pkg-config }:
 
 with rustPlatform;
 
@@ -21,6 +21,8 @@ buildRustPackage rec {
 
   buildInputs = [ makeWrapper openssl ];
+  nativeBuildInputs = [ pkg-config ];
+
   RUST_SRC_PATH = rustPlatform.rustcSrc;
 
   # installPhase = ''

This allows me to continue with the build, but fails eventually with other, code-based errors.

@evanjs
Copy link
Member

evanjs commented Sep 7, 2019

After my changes, in addition to using the latest sources from master (for nushell), I failed on compiling surf, as it required async_await.

@jonringer
Copy link
Contributor

Also, there should be an entry in top-level/all-packages

@teto
Copy link
Member Author

teto commented Sep 8, 2019

thanks for the feedback, I've pusehd the recommandation.
Seems like it fails on

   Compiling prettyprint v0.7.0
   Compiling nu v0.2.0 (/build/source)
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src/object/types.rs:17:20
   |
17 |         let name = std::intrinsics::type_name::<T>();
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src/object/types.rs:35:20
   |
35 |         let name = std::intrinsics::type_name::<T>();
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src/object/types.rs:72:22
   |
72 |         let t_name = std::intrinsics::type_name::<T>();
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src/object/types.rs:73:22
   |
73 |         let u_name = std::intrinsics::type_name::<U>();
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
   --> src/object/types.rs:101:20
    |
101 |         let name = std::intrinsics::type_name::<T>();
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
    |
    = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
   --> src/object/types.rs:126:20
    |
126 |         let name = std::intrinsics::type_name::<T>();
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
    |
    = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src/parser/deserializer.rs:73:20
   |
73 |         let name = std::intrinsics::type_name::<V::Value>();
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
   --> src/parser/deserializer.rs:240:24
    |
240 |             let name = std::intrinsics::type_name::<V::Value>();
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
    |
    = note: consult the function's documentation for information on how to avoid undefined behavior

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0133`.
error: Could not compile `nu`.

so it does seem I should try master as @evanjs did. Compiling this took way too long, is there some work to install rust dependencies as derivations ? compiling from scratch everytime takes a toll on the machine and my mind. If master doesn't compile, maybe it's just easier to wait a bit for the ecosystem to catch up.

@evanjs
Copy link
Member

evanjs commented Sep 8, 2019

You could try installing sccache and run sccache --start-server, as it is now in tree.
Haven't used it on NixOS in a while, though, and I'm not sure how much it would impact this package's compilation time.

@marsam
Copy link
Contributor

marsam commented Sep 22, 2019

I think it's failing because it requires rust nightly:

To build Nu, you will need to use the nightly version of the compiler.

@timokau
Copy link
Member

timokau commented Nov 7, 2019

According to upstream, nushell should work with the just released rust 1.39.

@timokau
Copy link
Member

timokau commented Nov 7, 2019

So it should be possible to make progress on this after #72980.

@evanjs
Copy link
Member

evanjs commented Nov 8, 2019

As @timokau mentioned, this does seem to build fine on stable.
Just tested with the nixpkgs mozilla overlay in a pure nix shell locally with 1.39.0.
e.g.

with import <nixpkgs> {};
let
  inherit (stdenv) lib;
  moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
  pkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
  stdenv.mkDerivation {
    name = "rust-env";
    buildInputs = with pkgs; [
        # Additional Dependencies
        (pkgs.latest.rustChannels.stable.rust.override { extensions = [ "rust-src" "rust-std" "rustfmt-preview" "clippy-preview" ]; })
        pkgconfig
        openssl
      ];
    }

We should be good to go once 1.39.0 is built on hydra.
Just note the latest version is 0_5_0, rather than e.g. 0.5.0.

@teto
Copy link
Member Author

teto commented Nov 8, 2019

not sure when I can take a look at this so anyone feel free to pick it up.

@evanjs
Copy link
Member

evanjs commented Nov 8, 2019

Looks like it builds on 1.39.0, but all 17 tests fail :D One or more of the test groups are failing (cd operations)
Going to poke them a bit before I make a PR.

@marsam marsam mentioned this pull request Nov 9, 2019
10 tasks
@teto teto deleted the nushell branch November 19, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants