guilhermeprokisch / see

A cute cat(1) for the terminal with advanced code viewing, Markdown rendering, 🌳 tree-sitter syntax highlighting, images view and more.
MIT License
164 stars 2 forks source link

OpenSSL Compile Error - Rustls support? #14

Closed ShiromMakkad closed 5 days ago

ShiromMakkad commented 1 week ago

Hi, I'm trying to install see but it fails on OpenSSL:

running cd "/tmp/cargo-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && "make" "depend"
  running cd "/tmp/cargo-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,10 --jobserver-auth=8,10" "make" "build_libs"
  /usr/bin/perl util/mkinstallvars.pl PREFIX=. BINDIR=apps APPLINKDIR=ms LIBDIR= INCLUDEDIR=include "INCLUDEDIR=./include" ENGINESDIR=engines MODULESDIR=providers "VERSION=3.3.2" "LDLIBS=-ldl -pthread " > builddata.pm

  --- stderr
   Compiling tree-sitter v0.23.0
   Compiling qoi v0.4.1
   Compiling simd_helpers v0.1.0
   Compiling itertools v0.12.1
   Compiling ahash v0.8.11
error: failed to run custom build command for `openssl-sys v0.9.103`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installFvutak/release/build/openssl-sys-28799de2b8acb990/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_
  cargo:rustc-check-cfg=cfg(openssl)
  cargo:rustc-check-cfg=cfg(libressl)
  cargo:rustc-check-cfg=cfg(boringssl)
  cargo:rustc-check-cfg=cfg(libressl250)
  cargo:rustc-check-cfg=cfg(libressl251)
  cargo:rustc-check-cfg=cfg(libressl252)
  cargo:rustc-check-cfg=cfg(libressl261)
  cargo:rustc-check-cfg=cfg(libressl270)
  cargo:rustc-check-cfg=cfg(libressl271)
  cargo:rustc-check-cfg=cfg(libressl273)
  cargo:rustc-check-cfg=cfg(libressl280)
  cargo:rustc-check-cfg=cfg(libressl281)
  cargo:rustc-check-cfg=cfg(libressl291)
  cargo:rustc-check-cfg=cfg(libressl310)
  cargo:rustc-check-cfg=cfg(libressl321)
  cargo:rustc-check-cfg=cfg(libressl332)
  cargo:rustc-check-cfg=cfg(libressl340)
  cargo:rustc-check-cfg=cfg(libressl350)
  cargo:rustc-check-cfg=cfg(libressl360)
  cargo:rustc-check-cfg=cfg(libressl361)
  cargo:rustc-check-cfg=cfg(libressl370)
  cargo:rustc-check-cfg=cfg(libressl380)
  cargo:rustc-check-cfg=cfg(libressl381)
  cargo:rustc-check-cfg=cfg(libressl382)
  cargo:rustc-check-cfg=cfg(libressl390)
  cargo:rustc-check-cfg=cfg(libressl400)
  cargo:rustc-check-cfg=cfg(ossl101)
  cargo:rustc-check-cfg=cfg(ossl102)
  cargo:rustc-check-cfg=cfg(ossl102f)
  cargo:rustc-check-cfg=cfg(ossl102h)
  cargo:rustc-check-cfg=cfg(ossl110)
  cargo:rustc-check-cfg=cfg(ossl110f)
  cargo:rustc-check-cfg=cfg(ossl110g)
  cargo:rustc-check-cfg=cfg(ossl110h)
  cargo:rustc-check-cfg=cfg(ossl111)
  cargo:rustc-check-cfg=cfg(ossl111b)
  cargo:rustc-check-cfg=cfg(ossl111c)
  cargo:rustc-check-cfg=cfg(ossl111d)
  cargo:rustc-check-cfg=cfg(ossl300)
  cargo:rustc-check-cfg=cfg(ossl310)
  cargo:rustc-check-cfg=cfg(ossl320)
  cargo:rustc-check-cfg=cfg(ossl330)
  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=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_CONFIG_DIR
  X86_64_UNKNOWN_LINUX_GNU_OPENSSL_CONFIG_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_CONFIG_DIR
  OPENSSL_CONFIG_DIR unset
  OUT_DIR = Some(/tmp/cargo-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out)
  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=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = 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-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="ar" CC="cc" RANLIB="ranlib" "
  Configuring OpenSSL version 3.3.2 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-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && "make" "depend"
  running cd "/tmp/cargo-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,10 --jobserver-auth=8,10" "make" "build_libs"
  /usr/bin/perl util/mkinstallvars.pl PREFIX=. BINDIR=apps APPLINKDIR=ms LIBDIR= INCLUDEDIR=include "INCLUDEDIR=./include" ENGINESDIR=engines MODULESDIR=providers "VERSION=3.3.2" "LDLIBS=-ldl -pthread " > builddata.pm

  --- stderr
  "pairs" is not exported by the List::Util module
  Can't continue after import errors at util/mkinstallvars.pl line 14.
  BEGIN failed--compilation aborted at util/mkinstallvars.pl line 14.
  make: *** [builddata.pm] Error 255
  thread 'main' panicked at /home/smakkad/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.3.2+3.3.2/src/lib.rs:633:9:

  Error building OpenSSL:
      Command: cd "/tmp/cargo-installFvutak/release/build/openssl-sys-f4be5ae86a3e40c7/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,10 --jobserver-auth=8,10" "make" "build_libs"
      Exit status: exit status: 2

I'm guessing it's because of an incompatible openssl version, but I can't install a different one due to being on a work laptop. I also can't use precompiled binaries because my installed glibc version is older than 2.27. Can rustls be used instead? If openssl is just used for reqwest, they have support for rustls. Also, why does this need to communicate over the network? Can I just disable that?

guilhermeprokisch commented 1 week ago

@ShiromMakkad I will look how to use rustls instead of openssl. I also had some problems to make releases due this lib in the past, I'm open to change it indeed.

About the network communication, it's to get images on markdown in case it have it. I need to think a way to ship this as a optional feature if the user don't want it. Not sure how now.

ShiromMakkad commented 1 week ago

I would look at reqwest's Cargo.toml: https://github.com/seanmonstar/reqwest/blob/master/Cargo.toml or rathole's Cargo.toml if you want to see a binary: https://github.com/rapiz1/rathole/blob/main/Cargo.toml for how to implement the optional feature support.

Also, I think that the rustls implementation should be the default. I think it's better from a security perspective, but some will prefer openssl due to its widespread usage. However, for this repo, since you're just using it to fetch images, I'd prefer the option that's easier to distribute, which is rustls, as the default. Or you could just remove openssl entirely, up to you.

guilhermeprokisch commented 1 week ago

@ShiromMakkad can you try the version https://github.com/guilhermeprokisch/see/releases/tag/v0.5.1 now?

I just dropped openssl and explicit put rustls as a feature to reqwest.

ShiromMakkad commented 1 week ago

It's still failing after running cargo install --git https://github.com/guilhermeprokisch/see. Looking at the Cargo.lock, openssl-sys is still a dependency and is being pulled in by reqwest. I think both the native tls and rustls features are on.

ShiromMakkad commented 1 week ago

You might have to do reqwest = { version = "0.12.7", features = ["blocking", "rustls-tls", "charset", "http2", "macos-system-configuration"], default-features = false } and then check the Cargo.lock.

ShiromMakkad commented 1 week ago

Unfortunately you can't disable one default feature: https://github.com/rust-lang/cargo/issues/3126

guilhermeprokisch commented 1 week ago

I used to have a musl compilation option that I guess should be independent of the glibc but one my decencies also not working with that option so for now I disable, I will try to fix that but should take a while.

guilhermeprokisch commented 1 week ago

@ShiromMakkad try the v0.5.2 now https://github.com/guilhermeprokisch/see/releases/tag/v0.5.2, please

ShiromMakkad commented 5 days ago

Works! Thanks