dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

Terminated by signal SIGSEGV #29

Closed matthis-k closed 8 months ago

matthis-k commented 8 months ago

image

On nixos, relevant is:

    #input
    nur.url = github:nix-community/NUR;

    overlays = [
        <...>
        nur.overlay
    ];

    environment.systemPackages = with pkgs; [
      nur.repos.dustinblackman.oatmeal
    ];

When using cargo openssl-sys fails to build

Output of cargo install oatmeal

    Updating crates.io index
  Installing oatmeal v0.9.2
    Updating crates.io index
warning: profile package spec `insta` in profile `dev` did not match any packages

    Did you mean `idna`?
warning: profile package spec `similar` in profile `dev` did not match any packages
   Compiling proc-macro2 v1.0.70
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.151
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling pkg-config v0.3.28
   Compiling futures-core v0.3.29
   Compiling once_cell v1.18.0
   Compiling serde v1.0.193
   Compiling vcpkg v0.2.15
   Compiling futures-task v0.3.29
   Compiling log v0.4.20
   Compiling slab v0.4.9
   Compiling version_check v0.9.4
   Compiling zerocopy v0.7.31
   Compiling memchr v2.6.4
   Compiling crc32fast v1.3.2
   Compiling ahash v0.8.6
   Compiling quote v1.0.33
   Compiling itoa v1.0.10
   Compiling syn v2.0.42
   Compiling cc v1.0.83
   Compiling openssl v0.10.61
   Compiling allocator-api2 v0.2.16
   Compiling pin-project-lite v0.2.13
   Compiling bitflags v2.4.1
   Compiling native-tls v0.2.11
   Compiling simd-adler32 v0.3.7
   Compiling rustversion v1.0.14
   Compiling hashbrown v0.14.3
   Compiling httparse v1.8.0
   Compiling serde_json v1.0.107
   Compiling openssl-src v300.2.1+3.2.0
   Compiling adler v1.0.2
   Compiling signal-hook-registry v1.4.1
   Compiling mio v0.8.10
   Compiling bytes v1.5.0
   Compiling miniz_oxide v0.7.1
   Compiling thiserror v1.0.51
   Compiling openssl-sys v0.9.97
   Compiling onig_sys v69.8.1
   Compiling socket2 v0.5.5
   Compiling num_cpus v1.16.0
   Compiling lock_api v0.4.11
   Compiling tracing-core v0.1.32
   Compiling equivalent v1.0.1
   Compiling futures-sink v0.3.29
   Compiling fnv v1.0.7
   Compiling futures-channel v0.3.29
   Compiling parking_lot_core v0.9.9
   Compiling tokio v1.33.0
   Compiling indexmap v2.1.0
   Compiling scopeguard v1.2.0
   Compiling bitflags v1.3.2
   Compiling futures-util v0.3.29
   Compiling smallvec v1.11.2
   Compiling foreign-types-shared v0.1.1
   Compiling foreign-types v0.3.2
   Compiling tracing v0.1.40
   Compiling http v0.2.11
   Compiling num-traits v0.2.17
   Compiling futures-io v0.3.29
   Compiling signal-hook v0.3.17
   Compiling pin-utils v0.1.0
   Compiling ryu v1.0.16
   Compiling tinyvec_macros v0.1.1
   Compiling powerfmt v0.2.0
   Compiling tinyvec v1.6.0
   Compiling deranged v0.3.10
   Compiling flate2 v1.0.28
   Compiling memoffset v0.6.5
   Compiling unicode-width v0.1.11
   Compiling percent-encoding v2.3.1
   Compiling lazy_static v1.4.0
   Compiling num_threads v0.1.6
   Compiling time-core v0.1.2
   Compiling openssl-probe v0.1.5
   Compiling tokio-util v0.7.9
   Compiling try-lock v0.2.5
   Compiling want v0.3.1
   Compiling time v0.3.31
   Compiling form_urlencoded v1.2.1
   Compiling serde_derive v1.0.193
   Compiling openssl-macros v0.1.1
   Compiling tokio-macros v2.1.0
   Compiling thiserror-impl v1.0.51
   Compiling futures-macro v0.3.29
   Compiling h2 v0.3.22
   Compiling unicode-normalization v0.1.22
   Compiling http-body v0.4.6
   Compiling parking_lot v0.12.1
   Compiling num-integer v0.1.45
   Compiling utf8parse v0.2.1
   Compiling paste v1.0.14
   Compiling safemem v0.3.3
   Compiling heck v0.4.1
   Compiling anyhow v1.0.75
   Compiling base64 v0.21.5
   Compiling either v1.9.0
   Compiling syn v1.0.109
   Compiling httpdate v1.0.3
   Compiling tower-service v0.3.2
   Compiling unicode-bidi v0.3.14
   Compiling idna v0.5.0
   Compiling hyper v0.14.28
   Compiling strum_macros v0.25.3
   Compiling line-wrap v0.1.1
error: failed to run custom build command for `openssl-sys v0.9.97`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installNPfWyO/release/build/openssl-sys-81eb1754cc439330/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
  AR_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
  AR_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
  ARFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
  ARFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_x86_64-unknown-linux-gnu
  RANLIB_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIB_x86_64_unknown_linux_gnu
  RANLIB_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIB
  HOST_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-unknown-linux-gnu
  RANLIBFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_unknown_linux_gnu
  RANLIBFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIBFLAGS
  HOST_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-d95e5824db77a078/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/tmp/cargo-installNPfWyO/release/build/openssl-sys-d95e5824db77a078/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64"
  Configuring OpenSSL version 3.2.0 for target linux-x86_64
  Using os-specific seed configuration
  Created configdata.pm
  Running configdata.pm
  Created Makefile.in
  Created Makefile
  Created include/openssl/configuration.h

  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL.md file first)      ***
  ***                                                                ***
  **********************************************************************
  running cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-d95e5824db77a078/out/openssl-build/build/src" && "make" "depend"

  --- stderr
  thread 'main' panicked at /home/matthisk/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.2.1+3.2.0/src/lib.rs:611:9:

  Error building OpenSSL dependencies:
      Command: cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-d95e5824db77a078/out/openssl-build/build/src" && "make" "depend"
      Failed to execute: No such file or directory (os error 2)

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `openssl-sys v0.9.97`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installNPfWyO/release/build/openssl-sys-81eb1754cc439330/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
  AR_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
  AR_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
  ARFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
  ARFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_x86_64-unknown-linux-gnu
  RANLIB_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIB_x86_64_unknown_linux_gnu
  RANLIB_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIB
  HOST_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-unknown-linux-gnu
  RANLIBFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_unknown_linux_gnu
  RANLIBFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIBFLAGS
  HOST_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-eaf2aa7bde328763/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "perl" "./Configure" "--prefix=/tmp/cargo-installNPfWyO/release/build/openssl-sys-eaf2aa7bde328763/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
  Configuring OpenSSL version 3.2.0 for target linux-x86_64
  Using os-specific seed configuration
  Created configdata.pm
  Running configdata.pm
  Created Makefile.in
  Created Makefile
  Created include/openssl/configuration.h

  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL.md file first)      ***
  ***                                                                ***
  **********************************************************************
  running cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-eaf2aa7bde328763/out/openssl-build/build/src" && "make" "depend"

  --- stderr
  thread 'main' panicked at /home/matthisk/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.2.1+3.2.0/src/lib.rs:611:9:

  Error building OpenSSL dependencies:
      Command: cd "/tmp/cargo-installNPfWyO/release/build/openssl-sys-eaf2aa7bde328763/out/openssl-build/build/src" && "make" "depend"
      Failed to execute: No such file or directory (os error 2)

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `oatmeal v0.9.2`, intermediate artifacts can be found at `/tmp/cargo-installNPfWyO`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
dustinblackman commented 8 months ago

Thanks for reporting!

For oatmeal --help failing, it feels like a NixOS thing. I have a similar repro in a docker container that may be related to this. I'll dig a deeper to see if this is something I can fix in the binary distribution, or if I have to update docs.

For openssl, this is a common nixos problem. More details here, but I'll look to fix it in the next release.

dustinblackman commented 8 months ago

SSL related issues should be fixed in v0.10.0

dustinblackman commented 8 months ago

@matthis-k I got the application running in a container, but I don't have an active NixOS installation to test in a real scenario. Would you mind giving this a run for me and confirm if Oatmeal starts, please?

nix-shell -p binutils stdenv curl gzip
mkdir test
cd test
curl -L https://github.com/dustinblackman/oatmeal/releases/download/v0.10.0/oatmeal_0.10.0_linux_amd64.tar.gz | tar -xz oatmeal
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./oatmeal
./oatmeal --help

Thanks!

matthis-k commented 8 months ago

This works.

dustinblackman commented 8 months ago

Thanks! I've updated my NUR packages, and should be available in the main repository in a couple hours.