rustformers / llm

[Unmaintained, see README] An ecosystem of Rust libraries for working with large language models

Home Page:https://docs.rs/llm/latest/llm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I can't compile llm with nix

GENDRAUD opened this issue · comments

git clone https://github.com/rustformers/llm.git
nix build

error: builder for '/nix/store/zllzqwj422zqrsl24lgr6j5y0m4c1mx7-rust-workspace-deps-unknown.drv' failed with exit code 101; last 10 log lines: > [naersk] RUSTFLAGS: > [naersk] CARGO_BUILD_RUSTFLAGS: > [naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/772s1031nnkf5b5qzw55g6nkir1k2jjc-dependencies=/sources > building > cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format > error: package half v2.3.1 cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.69.0 > Either upgrade to rustc 1.70 or newer, or use > cargo update -p half@2.3.1 --precise ver > where ver is the latest version of half supporting rustc 1.69.0 > [naersk] cargo returned with exit code 101, exiting For full logs, run 'nix log /nix/store/zllzqwj422zqrsl24lgr6j5y0m4c1mx7-rust-workspace-deps-unknown.drv'.

This stackoverflow question add more informations

https://stackoverflow.com/questions/76675438/how-to-compile-the-llm-library-with-nix

This one too:

https://stackoverflow.com/questions/76675795/does-nix-always-create-virtual-environment-deterministically

Thanks, it looks like one of our dependencies raised its minimum Rust version to 1.70.0. I'll see if we can bring the MSRV down.

Should work now - let me know if it still occurs!

Hello,

I think the problem is fixed. I have another error now.

warning: Git tree '/mnt/c/Users/gendraup/llm/llm' is dirty
error: builder for '/nix/store/xyli650f4w0lpvvjgw57lszinvvwv80q-rust-workspace-deps-unknown.drv' failed with exit code 101;
last 10 log lines:
>
> 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.
>
> ', /sources/openssl-sys-0.9.90/build/find_normal.rs:190:5
> note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
> warning: build failed, waiting for other jobs to finish...
> [naersk] cargo returned with exit code 101, exiting
For full logs, run 'nix log /nix/store/xyli650f4w0lpvvjgw57lszinvvwv80q-rust-workspace-deps-unknown.drv'.
error: 1 dependencies of derivation '/nix/store/7jd7fpgcjs4hv435v3xl00yql8ba5qj0-rust-workspace-unknown.drv' failed to build

I change llm like that:

    llm = naersk'.buildPackage {
      src = ./.;
      nativeBuildInputs=[ pkgs.pkg-config];

Now I have another error.

warning: Git tree '/mnt/c/Users/gendraup/llm/llm' is dirty
error: builder for '/nix/store/8kz82i1fx8biiyd1g9f9xlci7ghn98fc-rust-workspace-deps-unknown.drv' failed with exit code 101;
last 10 log lines:
> 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.90
>
> ', /sources/openssl-sys-0.9.90/build/find_normal.rs:190:5
> note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
> warning: build failed, waiting for other jobs to finish...
> [naersk] cargo returned with exit code 101, exiting
For full logs, run 'nix log /nix/store/8kz82i1fx8biiyd1g9f9xlci7ghn98fc-rust-workspace-deps-unknown.drv'.
error: 1 dependencies of derivation '/nix/store/ck6lsynl0am8wqazg5ypdq27nvpxy364-rust-workspace-unknown.drv' failed to build

nix log /nix/store/8kz82i1fx8biiyd1g9f9xlci7ghn98fc-rust-workspace-deps-unknown.drv':

error: failed to run custom build command for openssl-sys v0.9.90

Caused by:
process didn't exit successfully: /build/dummy-src/target/release/build/openssl-sys-b1ba5b75368d72d5/build-script-main (exit sta>
--- stdout
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
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=OPENSSL_STATIC
cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl" did not exit successfully: ex>
error: could not find system library 'openssl' required by the 'openssl-sys' crate

--- stderr
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'openssl' found

--- 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.90

', /sources/openssl-sys-0.9.90/build/find_normal.rs:190:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
[naersk] cargo returned with exit code 101, exiting
lines 120-152/152 (END)

P.S. : could you please explain what does MSRV mean

previous problem fixed but another appears
llm = naersk'.buildPackage {
src = ./.;
nativeBuildInputs=[ pkgs.pkg-config pkgs.openssl] ;
};

    error: builder for '/nix/store/2d8ngvqrdx79sm1q8dmyqs753r1jf4f6-rust-workspace-unknown.drv' failed with exit code 101;
   last 10 log lines:
   > cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
   >    Compiling ggml-sys v0.2.0-dev (/build/source/crates/ggml/sys)
   > error: failed to run custom build command for `ggml-sys v0.2.0-dev (/build/source/crates/ggml/sys)`
   >
   > Caused by:
   >   process didn't exit successfully: `/build/source/target/release/build/ggml-sys-7b12760c63a3529b/build-script-build` (exit status: 101)
   >   --- stderr
   >   thread 'main' panicked at 'Could not find llama-cpp/ggml.c. Try running `git submodule update --init`', crates/ggml/sys/build.rs:111:5
   >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   > [naersk] cargo returned with exit code 101, exiting
   For full logs, run 'nix log /nix/store/2d8ngvqrdx79sm1q8dmyqs753r1jf4f6-rust-workspace-unknown.drv'.
    
    log file

error: failed to run custom build command for ggml-sys v0.2.0-dev (/build/source/crates/ggml/sys)

Caused by:
process didn't exit successfully: /build/source/target/release/build/ggml-sys-7b12760c63a3529b/build-script-build (exit status: >
--- stderr
thread 'main' panicked at 'Could not find llama-cpp/ggml.c. Try running git submodule update --init', crates/ggml/sys/build.rs:1>
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[naersk] cargo returned with exit code 101, exiting

P.S. : could you please explain what does MSRV mean

Thanks!

Yep, the two issues you've encountered are:

  • We have a dependency on OpenSSL for being able to remotely download tokenizers from Hugging Face. You can fix this by including OpenSSL in the flake, or by building with --no-default-features.
  • The repository has a Git submodule for llama.cpp, and I'm guessing the flake doesn't pull down the submodules for the repository.

I'm not familiar with how Nix flakes work, so I'm not sure what the correct fix for these would be. If you have any suggestions, we'd happily welcome a PR - otherwise you might have to wait for someone who knows Nix to fix this 😅

P.S. : could you please explain what does MSRV mean

Minimum Supported Rust Version. Ours is 1.65.0, but we started using 1.70.0 features by accident, which is why you ran into that issue (Nix bundles 1.69.0 in stable)

Hello

with this command I have llama.cpp pulled down in crates/ggml/sys/llama-cpp
git submodule init
git submodule update

It can be build independently.
but I still have the same problem