rnpgp / homebrew-rnp

Homebrew formula for rnp
4 stars 1 forks source link

Fresh installed rnp on macOS fails #31

Closed keachi closed 1 year ago

keachi commented 1 year ago

Description

I freshly installed RNP on my macOS with brew as described in installation. After the installation I'm not able to run RNP as there's a library missing.

Environment

macOS Ventura 13.3

$ brew info rnp
==> rnpgp/rnp/rnp: stable 0.15.2 (bottled), HEAD
High-performance OpenPGP command-line tools and library
https://github.com/rnpgp/rnp
/usr/local/Cellar/rnp/0.15.2 (16 files, 2.7MB) *
  Poured from bottle on 2023-04-13 at 08:14:34
From: https://github.com/rnpgp/homebrew-rnp/blob/HEAD/Formula/rnp.rb
==> Dependencies
Build: cmake ✔
Required: botan ✔, json-c ✔
==> Options
--HEAD
    Install HEAD version

Steps to Reproduce

  1. Get a freshly installed macOS with homebrew.
  2. Follow the instructions.
  3. Run rnp --version

Expected Behavior

RNP should find the library libbotan and print its version.

Actual Behavior

$ rnp --version
dyld[16402]: Library not loaded: /usr/local/opt/botan/lib/libbotan-2.18.dylib
  Referenced from: <7405531A-B97F-34D4-B9BE-4EB91C570555> /usr/local/Cellar/rnp/0.15.2/bin/rnp
  Reason: tried: '/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/usr/local/lib/libbotan-2.18.dylib' (no such file), '/usr/lib/libbotan-2.18.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/usr/local/lib/libbotan-2.18.dylib' (no such file), '/usr/lib/libbotan-2.18.dylib' (no such file, not in dyld cache)
ribose-jeffreylau commented 1 year ago

@maxirmx Hello, could you please help take a look? Maybe this issue (https://github.com/rnpgp/homebrew-rnp/issues/30) could be dealt with together? Thank you!

ribose-jeffreylau commented 1 year ago

Description

I freshly installed RNP on my macOS with brew as described in installation. After the installation I'm not able to run RNP as there's a library missing.

Environment

macOS Ventura 13.3

$ brew info rnp
==> rnpgp/rnp/rnp: stable 0.15.2 (bottled), HEAD
High-performance OpenPGP command-line tools and library
https://github.com/rnpgp/rnp
/usr/local/Cellar/rnp/0.15.2 (16 files, 2.7MB) *
  Poured from bottle on 2023-04-13 at 08:14:34
From: https://github.com/rnpgp/homebrew-rnp/blob/HEAD/Formula/rnp.rb
==> Dependencies
Build: cmake ✔
Required: botan ✔, json-c ✔
==> Options
--HEAD
  Install HEAD version

Steps to Reproduce

1. Get a freshly installed macOS with homebrew.

2. Follow the [instructions](https://github.com/rnpgp/rnp/blob/main/docs/installation.adoc#on-macos-using-homebrew).

3. Run `rnp --version`

Expected Behavior

RNP should find the library libbotan and print its version.

Actual Behavior

$ rnp --version
dyld[16402]: Library not loaded: /usr/local/opt/botan/lib/libbotan-2.18.dylib
  Referenced from: <7405531A-B97F-34D4-B9BE-4EB91C570555> /usr/local/Cellar/rnp/0.15.2/bin/rnp
  Reason: tried: '/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/usr/local/opt/botan/lib/libbotan-2.18.dylib' (no such file), '/usr/local/lib/libbotan-2.18.dylib' (no such file), '/usr/lib/libbotan-2.18.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/usr/local/Cellar/botan/2.19.3/lib/libbotan-2.18.dylib' (no such file), '/usr/local/lib/libbotan-2.18.dylib' (no such file), '/usr/lib/libbotan-2.18.dylib' (no such file, not in dyld cache)

Thank you @keachi for reporting! We'll have it fixed asap.

maxirmx commented 1 year ago

Hi @keachi Could you please run two commands and share the output

ls $(brew --prefix)/lib/*botan*  
otool -L $(brew --prefix)/bin/rnp

Thank you

keachi commented 1 year ago

Hi @maxirmx,

$ ls $(brew --prefix)/lib/*botan*
/usr/local/lib/libbotan-2.19.19.3.dylib
/usr/local/lib/libbotan-2.19.dylib
/usr/local/lib/libbotan-2.a
/usr/local/lib/libbotan-2.dylib

and

$ otool -L $(brew --prefix)/bin/rnp
/usr/local/bin/rnp:
    /usr/local/opt/json-c/lib/libjson-c.5.dylib (compatibility version 5.0.0, current version 5.1.0)
    /usr/local/opt/botan/lib/libbotan-2.18.dylib (compatibility version 2018.18.0, current version 2018.18.1)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 902.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
maxirmx commented 1 year ago

Thank you, @keachi

There is an interesting version mismatch: you have botan 2.19 installed but rnp was linked against botan 2.18 which is probably installed as well.

It may take some time for me to understand how this can happen. I guess uninstalling rnp and both versions of botan and installing rnp back shall be a quick fix for you. If you need a quick fix, of course.

keachi commented 1 year ago

Thank you, @maxirmx

I see the version mismatch of botan. I tryied to find any additional install botan library but didn't found anything (find / -type f -name libbotan-2.18.dylib 2>/dev/null didn't bring any results).

I completely removed rnp and botan and reinstalled rnp but that didn't help. But I don't need a quick fix.

Here my complete output of the reinstallation (with another strange behaviour):

$ brew install rnp
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#=#=#
==> Downloading https://formulae.brew.sh/api/cask.jws.json
#=#=#
==> Fetching dependencies for rnpgp/rnp/rnp: botan
==> Fetching botan
==> Downloading https://ghcr.io/v2/homebrew/core/botan/manifests/2.19.3
Already downloaded: /Users/taaruto1/Library/Caches/Homebrew/downloads/e908a24344f135e9115c049f00a2f7b188ad70ec3748ef0ec3308b056326c2c3--botan-2.19.3.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/botan/blobs/sha256:b29a58fa7e9b7663d5640fd4930e0beb28a14db52cb7e6657f6c087f85fc486c
Already downloaded: /Users/taaruto1/Library/Caches/Homebrew/downloads/903ac14515f4bf745bc63eb66ee850b1750b4add5519b3592e0fad760bd9b320--botan--2.19.3.ventura.bottle.tar.gz
==> Fetching rnpgp/rnp/rnp
==> Downloading https://github.com/rnpgp/homebrew-rnp/releases/download/rnp-0.15.2/rnp-0.15.2.catalina.bottle.tar.gz
Already downloaded: /Users/taaruto1/Library/Caches/Homebrew/downloads/3fe86cf6e94391b4ea7fe6862b0c1fcc9498196076b7400941af8bfccd96ee5a--rnp-0.15.2.catalina.bottle.tar.gz
==> Installing rnp from rnpgp/rnp
==> Installing dependencies for rnpgp/rnp/rnp: botan
==> Installing rnpgp/rnp/rnp dependency: botan
==> Pouring botan--2.19.3.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/botan/2.19.3: 393 files, 18.8MB
==> Installing rnpgp/rnp/rnp
==> Pouring rnp-0.15.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/rnp/0.15.2: 16 files, 2.7MB
==> Running `brew cleanup rnp`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> No outdated dependents to upgrade!
==> Checking for dependents of upgraded formulae...
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Reinstalling 1 dependent with broken linkage from source:
rnpgp/rnp/rnp

$ ls $(brew --prefix)/Cellar/rnp
0.15.2.reinstall

$ ls /usr/local/bin/rnp
ls: /usr/local/bin/rnp: No such file or directory

$ brew reinstall rnp
==> Fetching rnpgp/rnp/rnp
==> Downloading https://github.com/rnpgp/homebrew-rnp/releases/download/rnp-0.15.2/rnp-0.15.2.catalina.bottle.tar.gz
Already downloaded: /Users/taaruto1/Library/Caches/Homebrew/downloads/3fe86cf6e94391b4ea7fe6862b0c1fcc9498196076b7400941af8bfccd96ee5a--rnp-0.15.2.catalina.bottle.tar.gz
==> Reinstalling rnpgp/rnp/rnp
==> Pouring rnp-0.15.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/rnp/0.15.2: 16 files, 2.7MB
==> Running `brew cleanup rnp`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

$ ls $(brew --prefix)/Cellar/rnp
0.15.2           0.15.2.reinstall

$ ls -g /usr/local/bin/rnp
lrwxr-xr-x@ 1 admin  28 13 Apr 14:00 /usr/local/bin/rnp -> ../Cellar/rnp/0.15.2/bin/rnp

I never had such strange behaviours with other formulaes before.

If I download https://github.com/rnpgp/rnp/archive/refs/tags/v0.15.2.tar.gz and run "cmake", "make rnp" I works as expected:

$ otool -L src/rnp/rnp
src/rnp/rnp:
    /usr/local/opt/json-c/lib/libjson-c.5.dylib (compatibility version 5.0.0, current version 5.2.0)
    /usr/local/opt/botan/lib/libbotan-2.19.dylib (compatibility version 2019.19.0, current version 2019.19.3)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

$ src/rnp/rnp --version
rnp 0.15.2
All bug reports, praise and chocolate, please, to:
Ribose Inc. <rnpgp@ribose.com>
maxirmx commented 1 year ago

@keachi Thank you for the hint Although I cannot I reproduce it anyway I have an idea now how to fix it.

maxirmx commented 1 year ago

@keachi Can you try brew install rnp --build-from-source ? Thank you

keachi commented 1 year ago

@maxirmx That works without any issues. I removed rnp and botan and after I reinstalled rnp.

$ brew install rnp --build-from-source
==> Fetching dependencies for rnpgp/rnp/rnp: botan
==> Fetching botan
==> Downloading https://ghcr.io/v2/homebrew/core/botan/manifests/2.19.3
Already downloaded: /Users/tr/Library/Caches/Homebrew/downloads/e908a24344f135e9115c049f00a2f7b188ad70ec3748ef0ec3308b056326c2c3--botan-2.19.3.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/botan/blobs/sha256:b29a58fa7e9b7663d5640fd4930e0beb28a14db52cb7e6657f6c
Already downloaded: /Users/tr/Library/Caches/Homebrew/downloads/903ac14515f4bf745bc63eb66ee850b1750b4add5519b3592e0fad760bd9b320--botan--2.19.3.ventura.bottle.tar.gz
==> Fetching rnpgp/rnp/rnp
==> Downloading https://github.com/rnpgp/rnp/archive/refs/tags/v0.15.2.tar.gz
Already downloaded: /Users/tr/Library/Caches/Homebrew/downloads/470c581eb7f03177c3642912706a532abd7a6d07274e7eb3803d44c16c8afb27--rnp-0.15.2.tar.gz
==> Installing rnp from rnpgp/rnp
==> Installing dependencies for rnpgp/rnp/rnp: botan
==> Installing rnpgp/rnp/rnp dependency: botan
==> Pouring botan--2.19.3.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/botan/2.19.3: 393 files, 18.8MB
==> Installing rnpgp/rnp/rnp
==> cmake ..
==> make install
🍺  /usr/local/Cellar/rnp/0.15.2: 17 files, 2.8MB, built in 43 seconds
==> Running `brew cleanup rnp`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

$ rnp --version
rnp 0.15.2
All bug reports, praise and chocolate, please, to:
Ribose Inc. <rnpgp@ribose.com>
maxirmx commented 1 year ago

Hi @keachi Updated formulae (0.16.3) should install without additional flags Thank you for your help 👍

keachi commented 1 year ago

Hi @maxirmx Thank you for providing a fix for this issue.