Closed figsoda closed 1 year ago
I just tested this on one of our macs and was unable to reproduce. Could you describe the circumstances under which cargo run
didn't work? Logs would help as well.
I think this is only needed for linux (I don't think LD_LIBRARY_PATH
is even a thing on darwin), I will update to only include this for linux
$ nix run . run cargo run
✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
Finished dev [unoptimized + debuginfo] target(s) in 0.21s
Running `target/debug/riff`
target/debug/riff: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
The command you attempted to run was not found.
Try running it in a shell; for example:
riff run -- sh -c 'cargo run'
....oh yeah. Derp :laughing:
Testing on a Linux box now.
Hmm... I tested this on a NixOS machine, a freshly-installed Steam Deck VM, and a freshly-installed Ubuntu VM, and I am still unable to reproduce. What distro are you seeing this on?
NixOS
Rereading the PR body, I notice you say you weren't using the registry. Does the issue persist if you do use the registry?
EDIT: Maybe I'm misreading, and you just didn't test if adding it to the registry fixes it...
by "didn't test with the registry" I meant I didn't test whether my change to the registry fixes the issue, however I was able to reproduce the issue on main, and this addition to Cargo.toml
resolves the issue for me
[package.metadata.riff]
runtime-inputs = ["openssl"]
If you could, the output of RUST_LOG=riff=trace nix run . run cargo run
where it fails would be useful. It would also be useful to know if this is only a problem with riff
(somehow?), or if other openssl-sys
-binding crates, like the git2
library have the same problem.
I'm hesitant to merge this because I'm not sure if this is the right solution (partially because I can't reproduce the issue in the first place).
I have tested with --offline
and this patch does fix the issue if only I use .#riff
instead of .#riffStatic
, I will open a new issue for that
Hmm I wonder if the reason you're not seeing a reproduction @cole-h is because all those VMs have libssl.so.3 on them?
$ RUST_LOG=riff=trace nix run .#riff run cargo run
2023-01-11T20:24:27.554847Z DEBUG riff::flake_generator: Project directory is '/home/figsoda/riff'.
at src/flake_generator.rs:24
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.555095Z DEBUG riff::dev_env: Adding Cargo dependencies...
at src/dev_env.rs:79
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.555111Z TRACE riff::dev_env: Running, command: "cargo" "metadata" "--format-version" "1" "--manifest-path" "/home/figsoda/riff/Cargo.toml"
at src/dev_env.rs:91
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
Running `cargo metadata` 🥁♩
2023-01-11T20:24:27.575024Z TRACE riff::dependency_registry: Fetching new registry data from https://registry.riff.determinate.systems/riff-registry.json
at src/dependency_registry/mod.rs:90
2023-01-11T20:24:27.680717Z DEBUG riff::dependency_registry: Refreshed remote registry into XDG cache, path: /home/figsoda/.cache/riff/registry.json.new1746617
at src/dependency_registry/mod.rs:140
2023-01-11T20:24:27.680929Z DEBUG riff::dependency_registry: Renamed new registry to replace cached registry, new: /home/figsoda/.cache/riff/registry.json.new1746617, curren
t: /home/figsoda/.cache/riff/registry.json
at src/dependency_registry/mod.rs:149
2023-01-11T20:24:27.753875Z DEBUG riff::dev_env: Cache freshness, fresh: true
at src/dev_env.rs:135
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.753938Z DEBUG riff::dev_env: Detected known crate information, package_name: core-foundation-sys, build-inputs: , environment-variables: , runtime-inputs
:
at src/dev_env.rs:143
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.753958Z DEBUG riff::dev_env: Detected known crate information, package_name: openssl-sys, build-inputs: openssl, environment-variables: , runtime-inputs:
at src/dev_env.rs:143
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.753971Z DEBUG riff::dev_env: Detected known crate information, package_name: pkg-config, build-inputs: pkg-config, environment-variables: , runtime-input
s:
at src/dev_env.rs:143
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.753984Z DEBUG riff::dev_env: Detected `package.metadata.riff` in `Crate.toml`, package: riff, build-inputs: , environment-variables: , runtime-inputs:
at src/dev_env.rs:163
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.753995Z DEBUG riff::dev_env: Detected known crate information, package_name: security-framework-sys, build-inputs: , environment-variables: , runtime-inp
uts:
at src/dev_env.rs:143
in riff::dev_env::add_deps_from_cargo with project_dir: /home/figsoda/riff
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
✓ 🦀 rust: cargo, openssl, pkg-config, rustc, rustfmt
2023-01-11T20:24:27.773965Z TRACE riff::telemetry: Sending telemetry data to https://registry.riff.determinate.systems/telemetry, data: Telemetry { distinct_id: Some(Secret(
[REDACTED riff::telemetry::DistinctId])), system_os: "linux", system_arch: "x86_64", os_release_name: Some("NixOS"), os_release_version_id: Some("23.05"), riff_version: "1.0.2
", nix_version: Some("nix (Nix) 2.12.0"), is_tty: true, subcommand: Some("run"), detected_languages: {Rust}, in_ci: false }
at src/telemetry.rs:121
in riff::telemetry::send
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.929498Z DEBUG riff::telemetry: Sent telemetry data to https://registry.riff.determinate.systems/telemetry, telemetry: Telemetry { distinct_id: Some(Secre
t([REDACTED riff::telemetry::DistinctId])), system_os: "linux", system_arch: "x86_64", os_release_name: Some("NixOS"), os_release_version_id: Some("23.05"), riff_version: "1.0
.2", nix_version: Some("nix (Nix) 2.12.0"), is_tty: true, subcommand: Some("run"), detected_languages: {Rust}, in_ci: false }
at src/telemetry.rs:129
in riff::telemetry::send
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.929561Z TRACE riff::flake_generator: Generated 'flake.nix':
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
nameValuePair = name: value: { inherit name value; };
genAttrs = names: f: builtins.listToAttrs (map (n: nameValuePair n (f n)) names);
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: genAttrs allSystems (system: f rec {
inherit system;
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
});
in
{
devShells = forAllSystems ({ system, pkgs, ... }: {
default = with pkgs;
stdenv.mkDerivation {
name = "riff-shell";
buildInputs = [
bashInteractive
cargo pkg-config rustc rustfmt openssl
] ++ lib.optionals (stdenv.isDarwin) [
libiconv
];
};
});
# Compatibility with older Nix installations that don't check for `devShells.<arch>.default` first.
devShell = forAllSystems ({ system, ... }: self.devShells.${system}.default);
};
}
at src/flake_generator.rs:82
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:27.929874Z TRACE riff::flake_generator: Running, command: "nix" "flake" "lock" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/.tmpgt
bIsX"
at src/flake_generator.rs:103
in riff::flake_generator::generate_flake_from_project_dir with project_dir: None, offline: false
2023-01-11T20:24:28.184449Z TRACE riff::nix_dev_env: Running, command: "nix" "print-dev-env" "--json" "--extra-experimental-features" "flakes nix-command" "-L" "path:///tmp/
.tmpgtbIsX"
at src/nix_dev_env.rs:48
Compiling riff v1.0.2 (/home/figsoda/riff)
Finished dev [unoptimized + debuginfo] target(s) in 2.99s
Running `target/debug/riff`
target/debug/riff: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
The command you attempted to run was not found.
Try running it in a shell; for example:
riff run -- sh -c 'cargo run'
$ ldd target/debug/riff
linux-vdso.so.1 (0x00007ffec4afb000)
libssl.so.3 => not found
libcrypto.so.3 => not found
libgcc_s.so.1 => /nix/store/ayfr5l52xkqqjn3n4h9jfacgnchz1z7s-glibc-2.35-224/lib/libgcc_s.so.1 (0x00007fccc9fef000)
libm.so.6 => /nix/store/ayfr5l52xkqqjn3n4h9jfacgnchz1z7s-glibc-2.35-224/lib/libm.so.6 (0x00007fccc9f0f000)
libc.so.6 => /nix/store/ayfr5l52xkqqjn3n4h9jfacgnchz1z7s-glibc-2.35-224/lib/libc.so.6 (0x00007fccc8a00000)
/nix/store/ayfr5l52xkqqjn3n4h9jfacgnchz1z7s-glibc-2.35-224/lib/ld-linux-x86-64.so.2 => /nix/store/ayfr5l52xkqqjn3n4h9jfacgnchz1z7s-glibc-2.35-224/lib64/ld-linux-x86-64
.so.2 (0x00007fccca00b000)
cargo run
didn't work for me withoutopenssl
in runtime inputs didn't test with the registry, but addingruntime-inputs = ["openssl"]
topackage.metadata.riff
fixes the issue for me