ogham / dog

A command-line DNS client.
https://dns.lookup.dog/
European Union Public License 1.2
6.19k stars 177 forks source link

Could not find openssl on build (fix included) #122

Open sem-hub opened 1 year ago

sem-hub commented 1 year ago

$ git rev-parse --short HEAD 721440b $ rustc --version rustc 1.73.0 (cc66ad468 2023-10-03) $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy $ rustc --print cfg debug_assertions panic="unwind" target_arch="x86_64" target_endian="little" target_env="gnu" target_family="unix" target_feature="fxsr" target_feature="sse" target_feature="sse2" target_has_atomic="16" target_has_atomic="32" target_has_atomic="64" target_has_atomic="8" target_has_atomic="ptr" target_os="linux" target_pointer_width="64" target_vendor="unknown" unix $ dpkg -l libssl-dev Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-================-=================-============-================================================ ii libssl-dev:amd64 3.0.2-0ubuntu1.10 amd64 Secure Sockets Layer toolkit - development files $ cargo build --release ... running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-march=x86-64" "-mtune=generic" "-O2" "-pipe" "-fno-plt" "-fexceptions" "-Wp,-D_FORTIFY_SOURCE=2" "-Wformat" "-Werror=format-security" "-fstack-clash-protection" "-fcf-protection" "-I" "/usr/include" "-E" "build/expando.c" cargo:warning=build/expando.c:4:24: error: pasting "RUST_VERSIONOPENSSL" and "(" does not give a valid preprocessing token cargo:warning= 4 | #define VERSION2(n, v) RUSTVERSION##n##_##v cargo:warning= | ^~~~~ cargo:warning=build/expando.c:5:23: note: in expansion of macro ‘VERSION2’ cargo:warning= 5 | #define VERSION(n, v) VERSION2(n, v) cargo:warning= | ^~~~ cargo:warning=build/expando.c:10:1: note: in expansion of macro ‘VERSION’ cargo:warning= 10 | VERSION(OPENSSL, OPENSSL_VERSION_NUMBER) cargo:warning= | ^~~ exit status: 1

--- stderr thread 'main' panicked at ' Header expansion error: Error { kind: ToolExecError, message: "Command \"cc\" \"-O3\" \"-ffunction-sections\" \"-fdata-sections\" \"-fPIC\" \"-m64\" \"-march=x86-64\" \"-mtune=generic\" \"-O2\" \"-pipe\" \"-fno-plt\" \"-fexceptions\" \"-Wp,-D_FORTIFY_SOURCE=2\" \"-Wformat\" \"-Werror=format-security\" \"-fstack-clash-protection\" \"-fcf-protection\" \"-I\" \"/usr/include\" \"-E\" \"build/expando.c\" with args \"cc\" did not execute successfully (status code exit status: 1)." }

Failed to find OpenSSL development headers.

You can try fixing this setting the OPENSSL_DIR environment variable pointing to your OpenSSL installation or installing OpenSSL headers package specific to your distribution:

  # On Ubuntu
  sudo apt-get install libssl-dev
  # On Arch Linux
  sudo pacman -S openssl
  # On Fedora
  sudo dnf install openssl-devel

I could easily fix it with adding 'openssl = { version = "0.10", features = ["vendored"] }' in Cargo.toml in [dependencies] target.

kaderud commented 10 months ago

Can confirm this fix also works on Linux Mint 21.3 (virginia) , it builds the source successfully.

johnchristopher commented 8 months ago

Can confirm this works on debian 12/bookworm:

  1. install libssl-dev with apt-install libssl-dev
  2. modify Cargo.toml by adding openssl = { version = "0.10", features = ["vendored"] } under [dependencies] section
  3. set OPENSSL_DIR env variable to /usr/lib/x86_64-linux-gnu
  4. finally run cargo build --release