ogham / dog

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

Error when attempting to run #109

Open StewAlexander-com opened 1 year ago

StewAlexander-com commented 1 year ago

I downloaded dog-v0.1.0-x86_64-unknown-linux-gnu.zip to my Ubuntu 22.04 release, and I got this error

support@Network-VM /t/completions> dog
dog: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Looking for libssl I found:

support@Network-VM /t/completions [124]> bash
support@Network-VM:/tmp/completions$ sudo dpkg -l |grep libssl*
ii  libss2:amd64                               1.46.5-2ubuntu1.1                       amd64        command-line interface parsing library
ii  libssh-4:amd64                             0.9.6-2build1                           amd64        tiny C SSH library (OpenSSL flavor)
ii  libssl3:amd64                              3.0.2-0ubuntu1.6                        amd64        Secure Sockets Layer toolkit - shared libraries

Looks like It needs to be perhaps installed, or there is a dependency issue

How do I install the correct ssl stuff, and could you please update your readme, thanks

DannyBen commented 1 year ago

Not only the libssl, I am also getting an error on Ubuntu 20.

➜ dog
dog: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by dog)
StewAlexander-com commented 1 year ago

Leaving dependency issues up to the user is lazy coding, python for instance has a "try" statement that is useful for loading dependencies ... here is some code I wrote before to install a python library for my app:

#check if the rich module exists, if not, install it
try:
    from rich import print
    from rich import pretty
except ImportError:
    subprocess.call([sys.executable, "-m", "pip", "install", "rich"])
    import rich
    time.sleep (1)
     #tell the user the library is installed
    print("[!] Rich module is now installed")
    print("Please restart the program")
    time.sleep(3)
    sys.exit()

If the system doesn't come pre-baked with some dependency let the program try to install it - if it cannot, tell the user something like, "this app requires a dependency "x" that appears incompatible with the current environment, please consult the web for possible fixes" etc etc

Just a thought

derVedro commented 1 year ago

You can get deb package with libssl.so.1.1 and libcrypto.so.1.1 from ubuntu repos. Just extract the libs from the package somewhere and then do LD_PRELOAD or LD_LIBRARY_PATH trick with them for starting dog.

Xevion commented 1 year ago

Leaving dependency issues up to the user is lazy coding, python for instance has a "try" statement that is useful for loading dependencies ... here is some code I wrote before to install a python library for my app:

#check if the rich module exists, if not, install it
try:
    from rich import print
    from rich import pretty
except ImportError:
    subprocess.call([sys.executable, "-m", "pip", "install", "rich"])
    import rich
    time.sleep (1)
     #tell the user the library is installed
    print("[!] Rich module is now installed")
    print("Please restart the program")
    time.sleep(3)
    sys.exit()

If the system doesn't come pre-baked with some dependency let the program try to install it - if it cannot, tell the user something like, "this app requires a dependency "x" that appears incompatible with the current environment, please consult the web for possible fixes" etc etc

Just a thought

Please tell me that you've never written code like that. Ever. Holy crap - never install dependencies in a user's environment - not without their explicit consent. It's fine to download stuff, but you shouldn't just install stuff randomly like that.

Suggest commands, but don't run them. "Leaving things up to the user" more like "giving users the option to install things themselves". These aren't end-user programs - these are command-line applications. It's not lazy to not mess with the user's setup or environment or make assumptions about it.

QuentinHsu commented 11 months ago

β€Œβ€ŒWhen I was using Docker to build dog, I also encountered similar pro

❯ dog
/dog: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

I don't know how to solve it. Trying to install this libssl.so.3 also failed to install.

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libssl.so.3
E: Couldn't find any package by glob 'libssl.so.3'
E: Couldn't find any package by regex 'libssl.so.3'
thomasmerz commented 10 months ago

Today I also ran in this problem after building dog docker container from scratch:

origin  https://github.com/ogham/dog.git (push)
🦎 βœ” ~/dev/github/dog [master|βœ”]
16:21 $ docker run -it --rm dog
/dog: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

Is my and @QuentinHsu's problem related to this issue? @ogham

StewAlexander-com commented 10 months ago

Leaving dependency issues up to the user is lazy coding, python for instance has a "try" statement that is useful for loading dependencies ... here is some code I wrote before to install a python library for my app:


#check if the rich module exists, if not, install it

try:

    from rich import print

    from rich import pretty

except ImportError:

    subprocess.call([sys.executable, "-m", "pip", "install", "rich"])

    import rich

    time.sleep (1)

     #tell the user the library is installed

    print("[!] Rich module is now installed")

    print("Please restart the program")

    time.sleep(3)

    sys.exit()

If the system doesn't come pre-baked with some dependency let the program try to install it - if it cannot, tell the user something like, "this app requires a dependency "x" that appears incompatible with the current environment, please consult the web for possible fixes" etc etc

Just a thought

Please tell me that you've never written code like that. Ever.

Holy crap - never install dependencies in a user's environment - not without their explicit consent.

It's fine to download stuff, but you shouldn't just install stuff randomly like that.

Suggest commands, but don't run them.

"Leaving things up to the user" more like "giving users the option to install things themselves".

These aren't end-user programs - these are command-line applications. It's not lazy to not mess with the user's setup or environment or make assumptions about it.

Quite right (hey I was a noob - thank goodness I came to my senses) still me thinks you can add to the code something like, "hey user, it seems dependencies are missing, this needs libraries x,y,z to function would you like us to install this for you?" or of the ilk

If not gracefully quit

Again, dependency management is to me worthwhile; but you're πŸ’―% right this is something the user should absolutely have control over

theAkito commented 10 months ago

Here's the same issue, including one possible fix.

https://github.com/ogham/dog/issues/122

YadominJinta commented 10 months ago

try this static build

https://github.com/YadominJinta/dog/releases/tag/v0.1.0-multi-target

thomasmerz commented 10 months ago

@YadominJinta , I build a fresh docker container from your fork:

🦎 βœ” ~/dev/github/dog-fork [master|βœ”]
12:42 $ docker images|ack dog
dog                                      latest        19c2b51fa1e7   43 seconds ago   98MB
🦎 βœ” ~/dev/github/dog-fork [master|βœ”]
12:42 $ docker run -it --rm dog github.com
/dog: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory
🦎 ✘-127 ~/dev/github/dog-fork [master|βœ”]
12:42 $
YadominJinta commented 10 months ago

@thomasmerz I didn't modify the original Dockerfile. You can run command below to get a static binary

docker buildx build --file Dockerfile.build.static --output out/ .
thomasmerz commented 10 months ago

@YadominJinta - My docker seems to be too old?

🦎 βœ” ~/dev/github/dog-fork [master|βœ”]
17:29 $ docker --version
Docker version 24.0.5-ce, build a61e2b4c9
🦎 βœ” ~/dev/github/dog-fork [master|βœ”]
17:29 $ docker buildx build --file Dockerfile.build.static --output out/ .
unknown flag: --file
…
YadominJinta commented 9 months ago

@thomasmerz I'm not sure, maybe you don't have docker buildx plugin

thomasmerz commented 9 months ago

Now with your @YadominJinta's help I have πŸ˜„ But…

βœ” ~/temp/PRs/YadominJinta-dog [master|βœ”] 
20:03 $ docker buildx build -f Dockerfile.build.static --output out/ .
[+] Building 5.6s (8/9)                                                                                                                                                                                                                                                                                        docker:default
 => [internal] load build definition from Dockerfile.build.static                                                                                                                                                                                                                                                        0.1s
 => => transferring dockerfile: 471B                                                                                                                                                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                        0.2s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                                                                                                                                                         1.9s
 => [internal] load build context                                                                                                                                                                                                                                                                                        0.2s
 => => transferring context: 1.73MB                                                                                                                                                                                                                                                                                      0.1s
 => [build 1/4] FROM docker.io/library/alpine@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48                                                                                                                                                                                                    1.0s
 => => resolve docker.io/library/alpine@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48                                                                                                                                                                                                          0.1s
 => => sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48 1.64kB / 1.64kB                                                                                                                                                                                                                           0.0s
 => => sha256:13b7e62e8df80264dbb747995705a986aa530415763a6c58f84a3ca8af9a5bcd 528B / 528B                                                                                                                                                                                                                               0.0s
 => => sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418 1.47kB / 1.47kB                                                                                                                                                                                                                           0.0s
 => => sha256:661ff4d9561e3fd050929ee5097067c34bafc523ee60f5294a37fd08056a73ca 3.41MB / 3.41MB                                                                                                                                                                                                                           0.6s
 => => extracting sha256:661ff4d9561e3fd050929ee5097067c34bafc523ee60f5294a37fd08056a73ca                                                                                                                                                                                                                                0.2s
 => [build 2/4] COPY ./ /source                                                                                                                                                                                                                                                                                          0.2s
 => [build 3/4] WORKDIR /source                                                                                                                                                                                                                                                                                          0.1s
 => ERROR [build 4/4] RUN apk update &&     apk add rustup git gcc lld openssl1.1-compat-dev openssl1.1-compat-libs-static &&     rustup-init -y &&     source "$HOME/.cargo/env" &&     RUSTFLAGS="-C link-args=-fuse-ld=lld" cargo build &&     strip target/debug/dog                                                 2.2s
------                                                                                                                                                                                                                                                                                                                        
 > [build 4/4] RUN apk update &&     apk add rustup git gcc lld openssl1.1-compat-dev openssl1.1-compat-libs-static &&     rustup-init -y &&     source "$HOME/.cargo/env" &&     RUSTFLAGS="-C link-args=-fuse-ld=lld" cargo build &&     strip target/debug/dog:                                                            
0.434 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz                                                                                                                                                                                                                                           
1.029 fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz                                                                                                                                                                                                                                      
1.643 v3.19.0-31-g89af40de256 [https://dl-cdn.alpinelinux.org/alpine/v3.19/main]                                                                                                                                                                                                                                              
1.643 v3.19.0-32-gc55ce71cc56 [https://dl-cdn.alpinelinux.org/alpine/v3.19/community]                                                                                                                                                                                                                                         
1.643 OK: 22983 distinct packages available
2.111 ERROR: unable to select packages:
2.111   openssl1.1-compat-dev (no such package):
2.111     required by: world[openssl1.1-compat-dev]
2.111   openssl1.1-compat-libs-static (no such package):
2.111     required by: world[openssl1.1-compat-libs-static]
------
Dockerfile.build.static:6
--------------------
   5 |     
   6 | >>> RUN apk update && \
   7 | >>>     apk add rustup git gcc lld openssl1.1-compat-dev openssl1.1-compat-libs-static && \
   8 | >>>     rustup-init -y && \
   9 | >>>     source "$HOME/.cargo/env" && \
  10 | >>>     RUSTFLAGS="-C link-args=-fuse-ld=lld" cargo build && \
  11 | >>>     strip target/debug/dog
  12 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apk update &&     apk add rustup git gcc lld openssl1.1-compat-dev openssl1.1-compat-libs-static &&     rustup-init -y &&     source \"$HOME/.cargo/env\" &&     RUSTFLAGS=\"-C link-args=-fuse-ld=lld\" cargo build &&     strip target/debug/dog" did not complete successfully: exit code: 2
✘-1 ~/temp/PRs/YadominJinta-dog [master|βœ”] 

Does my distro (OpenSUSE) need packages openssl1.1-compat-dev and openssl1.1-compat-libs-static (which are not available) or is this a different problem? πŸ€·πŸΌβ€β™‚οΈ

YadominJinta commented 9 months ago

@thomasmerz alpine 3.19 breaks the dependencies, I have fixed that by specific alpine version to 3.18 in Dockerfile

thomasmerz commented 9 months ago

Well… that works fine - thank you! πŸ‘πŸΌ

20:31 $ ./dog_linux_amd64 -v
dog ● command-line DNS client
v0.2.0-pre (pre-release debug build!)
https://dns.lookup.dog/

But I really would like this problem being solved in THIS repo, too, by @ogham πŸ€”