timsutton / brew-pkg

Build OS X installer packages directly from Homebrew formulae
MIT License
196 stars 38 forks source link

Missing or wrong installation of dependencies #15

Closed arall closed 4 years ago

arall commented 4 years ago

I'm trying to build a package for ClamAV. Here is what I do for building:

$ brew pkg --with-deps clamav
==> Creating package staging root using Homebrew prefix /usr/local
==> Staging formula clamav
==> Staging directory /usr/local/Cellar/clamav/0.103.0
==> Staging formula pkg-config
==> Staging directory /usr/local/Cellar/pkg-config/0.29.2_3
==> Staging formula gdbm
==> Staging directory /usr/local/Cellar/gdbm/1.18.1_1
==> Staging formula openssl@1.1
==> Staging formula readline
==> Staging directory /usr/local/Cellar/readline/8.0.4
==> Staging formula sqlite
==> Staging directory /usr/local/Cellar/sqlite/3.33.0
==> Staging formula xz
==> Staging directory /usr/local/Cellar/xz/5.2.5
==> Staging formula python@3.9
==> Staging formula sphinx-doc
==> Staging formula cmake
==> Staging formula json-c
==> Staging directory /usr/local/Cellar/json-c/0.15
==> Staging formula libiconv
==> Staging directory /usr/local/Cellar/libiconv/1.16
==> Staging formula libtool
==> Staging directory /usr/local/Cellar/libtool/2.4.6_2
==> Staging formula pcre2
==> Staging directory /usr/local/Cellar/pcre2/10.35
==> Staging formula autoconf
==> Staging directory /usr/local/Cellar/autoconf/2.69
==> Staging formula automake
==> Staging directory /usr/local/Cellar/automake/1.16.2_1
==> Staging formula jansson
==> Staging directory /usr/local/Cellar/jansson/2.13.1
==> Staging formula libmagic
==> Staging directory /usr/local/Cellar/libmagic/5.39
==> Staging formula protobuf
==> Staging formula protobuf-c
==> Staging directory /usr/local/Cellar/protobuf-c/1.3.3_2
==> Staging formula yara
==> Staging directory /usr/local/Cellar/yara/4.0.2
==> Building package clamav-0.103.0.pkg

But those are the results after running ClamAV:

$ clamdscan    
dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /usr/local/bin/clamdscan
  Reason: image not found
zsh: abort      clamdscan

I tried it on a fresh macOS 10.15 virtual image. If I install it using brew install clamav, it works as expected:

$ brew install clamav
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 1 formula.

==> Downloading https://homebrew.bintray.com/bottles/json-c-0.15.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libiconv-1.16.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/24d81638fcd7416a56c3dbdac7e2265d7b0476b17a71b631045425380122e6b
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_2.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/af317b35d0a394b7ef55fba4950735b0392d9f31bececebf9c412261c23a01f
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/openssl%401.1-1.1.1h.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/4e5357c0cfd55cfa4ef0b632c6fc9f49d39337dd070dc12d3c862e28bd28f07
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pcre2-10.35.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6a1e59a5db23d684f92d2bf695601d1b466f3e9d5407f704ba4679d885d13ce
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/jansson-2.13.1.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libmagic-5.39.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/90b17cb74e853804227abdd32c6810ff535fb98e8862f946c49860b697faece
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/protobuf-3.13.0_1.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/10df8a94c8077b4d2578e4db9410b586b865e4299cd6e7199993ca1c5a88af9
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/protobuf-c-1.3.3_2.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/yara-4.0.2.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/e0a9565366bfa84e65ebc338c7862848aac15345570433c632311c5e0c1b781
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/clamav-0.103.0.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/223f07db86b0ed0e4e51db8d634111bb842dcc49c01df6dbe5dedcf46e786e4
######################################################################## 100.0%
==> Installing dependencies for clamav: json-c, libiconv, libtool, openssl@1.1, pcre2, jansson, libmagic, protobuf, protobuf-c and yara
==> Installing clamav dependency: json-c
==> Pouring json-c-0.15.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/json-c/0.15: 32 files, 276.9KB
==> Installing clamav dependency: libiconv
==> Pouring libiconv-1.16.catalina.bottle.tar.gz
==> Caveats
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libiconv first in your PATH run:
  echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.zshrc

For compilers to find libiconv you may need to set:
  export LDFLAGS="-L/usr/local/opt/libiconv/lib"
  export CPPFLAGS="-I/usr/local/opt/libiconv/include"

==> Summary
🍺  /usr/local/Cellar/libiconv/1.16: 30 files, 2.4MB
==> Installing clamav dependency: libtool
==> Pouring libtool-2.4.6_2.catalina.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺  /usr/local/Cellar/libtool/2.4.6_2: 71 files, 3.7MB
==> Installing clamav dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1h.catalina.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1h: 8,067 files, 18.5MB
==> Installing clamav dependency: pcre2
==> Pouring pcre2-10.35.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.35: 230 files, 6.0MB
==> Installing clamav dependency: jansson
==> Pouring jansson-2.13.1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/jansson/2.13.1: 11 files, 169KB
==> Installing clamav dependency: libmagic
==> Pouring libmagic-5.39.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/libmagic/5.39: 330 files, 7.9MB
==> Installing clamav dependency: protobuf
==> Pouring protobuf-3.13.0_1.catalina.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/protobuf
==> Summary
🍺  /usr/local/Cellar/protobuf/3.13.0_1: 266 files, 19.8MB
==> Installing clamav dependency: protobuf-c
==> Pouring protobuf-c-1.3.3_2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/protobuf-c/1.3.3_2: 14 files, 303.3KB
==> Installing clamav dependency: yara
==> Pouring yara-4.0.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/yara/4.0.2: 46 files, 1.5MB
==> Installing clamav
==> Pouring clamav-0.103.0.catalina.bottle.tar.gz
==> Caveats
To finish installation & run clamav you will need to edit
the example conf files at /usr/local/etc/clamav/
==> Summary
🍺  /usr/local/Cellar/clamav/0.103.0: 57 files, 4.0MB
==> Caveats
==> libiconv
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have libiconv first in your PATH run:
  echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.zshrc

For compilers to find libiconv you may need to set:
  export LDFLAGS="-L/usr/local/opt/libiconv/lib"
  export CPPFLAGS="-I/usr/local/opt/libiconv/include"

==> libtool
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

==> protobuf
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/protobuf
==> clamav
To finish installation & run clamav you will need to edit
the example conf files at /usr/local/etc/clamav/
$ clamscan
----------- SCAN SUMMARY -----------
Known viruses: 0
Engine version: 0.103.0
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 0.438 sec (0 m 0 s)
Start Date: 2020:11:12 05:18:05
End Date:   2020:11:12 05:18:06

Any idea of what I'm doing wrong or why the openssl dependency is not installed properly?

arall commented 4 years ago

It works if I fresh install clamav using brew, and then build the package. The issue might be related when building the package on a different installed version.

I will close the issue.