Closed MarcCoquand closed 1 year ago
Have you added extra-include-dirs
as well?
Yes, I added the following to to cabal.project.local:
package HsOpenSSL
extra-lib-dirs:
- /opt/homebrew/Cellar/openssl@3/3.1.1/lib
extra-include-dirs:
- /opt/homebrew/Cellar/openssl@3/3.1.1/lib
I also tried adding the same thing to the main cabal file.
But no luck.
Maybe related to the present issue, note that the prefix /usr/local/
is only correct for x86_64
macOS.
https://github.com/haskell-cryptography/HsOpenSSL/blob/22bafa0682e7b415aba257ac6f9b4236c7fd1c5e/HsOpenSSL.cabal#L90-L92
In general, this prefix is computed by brew --prefix
.
I heard that on M1 is something else.
@MarcCoquand wrote:
extra-include-dirs:
- /opt/homebrew/Cellar/openssl@3/3.1.1/lib
This does not look right, should probably end in include
.
@andreasabel Ah yes, I'm on M1 so I'll have to try to figure out the one for that then.
So what I tried was:
~
𝝺 brew --prefix openssl
/opt/homebrew/opt/openssl@3
𝝺 cd /opt/homebrew/opt/openssl@3
𝝺 ls
AUTHORS.md CHANGES.md INSTALL_RECEIPT.json LICENSE.txt NEWS.md README.md bin include lib share
And then in my cabal.project.local
file
ignore-project: False
package HsOpenSSL
extra-lib-dirs:
- /opt/homebrew/opt/openssl@3/include
extra-include-dirs:
- /opt/homebrew/opt/openssl@3/lib
However, I ended up with the same error.
edit: Here is the full verbose output
𝝺 cabal build --verbose
this build was affected by the following (project) config files:
- /Users/me/myproject/cabal.project.local
Build profile: -w ghc-9.6.1 -O1
In order, the following will be built:
- HsOpenSSL-0.11.7.5 (lib:HsOpenSSL) (requires build)
- myproject-0.1.0.0 (exe:fediwiki-is) (configuration changed)
creating /Users/me/myproject/dist-newstyle/build
creating /Users/me/myproject/dist-newstyle/tmp
Extracting
/Users/me/.cabal/packages/hackage.haskell.org/HsOpenSSL/0.11.7.5/HsOpenSSL-0.11.7.5.tar.gz
to /Users/me/myproject/dist-newstyle/tmp/src-36711...
Updating HsOpenSSL.cabal with the latest revision from the index.
creating
/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist
Starting HsOpenSSL-0.11.7.5 (all, legacy fallback)
creating
/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup
copy
/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/Setup.hs
to
/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup.hs
Running: /Users/me/.ghcup/bin/ghc --make -fbuilding-cabal-package -odir /Users/me/myproject/dist-newstyle
/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup -hidir /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11
.7.5/dist/setup -i -i/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5 -optP-include -optP/Users/
me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup_macros.h -hide-all-packages -no-user-
package-db -package-db /Users/me/.cabal/store/ghc-9.6.1/package.db -package-id Cabal-3.10.1.0 -package-id base-4.1
8.0.0 /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup.hs -o /Users/me
/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup -threaded
/Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup
configure --verbose=2 --builddir=dist --ghc
--prefix=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3
--bindir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/bin
--libdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/lib
--libsubdir= --dynlibdir=/Users/me/.cabal/store/ghc-9.6.1/lib
--libexecdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/libexec
--libexecsubdir=
--datadir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share
--datasubdir=
--docdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share/doc
--htmldir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share/doc/html
--haddockdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share/doc/html
--sysconfdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/etc
--enable-library-vanilla --disable-library-profiling --enable-shared
--disable-static --disable-executable-dynamic --disable-executable-static
--disable-profiling --profiling-detail=default
--library-profiling-detail=default --enable-optimization --disable-debug-info
--disable-build-info --disable-library-for-ghci --disable-split-sections
--disable-split-objs --disable-executable-stripping
--disable-library-stripping --package-db=clear --package-db=global
--package-db=/Users/me/.cabal/store/ghc-9.6.1/package.db
--flags=-fast-bignum --flags=-homebrew-openssl --flags=-macports-openssl
--flags=-use-pkg-config --ipid=HsOpnSSL-0.11.7.5-badd73f3
--extra-prog-path=/Users/me/.cabal/bin
--dependency=base=base-4.18.0.0 --dependency=bytestring=bytestring-0.11.4.0
--dependency=network=ntwrk-3.1.4.0-87c18d16 --dependency=time=time-1.12.2
--disable-tests --disable-coverage --exact-configuration --disable-benchmarks
--with-ghc=/Users/me/.ghcup/bin/ghc
--with-ghc-pkg=/Users/me/.ghcup/ghc/9.6.1/bin/ghc-pkg-9.6.1
--ghc-option=-hide-all-packages
Redirecting build log to {handle:
/Users/me/.cabal/logs/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3.log}
Running: /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup configure '--verbose=
2' '--builddir=dist' --ghc '--prefix=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3' '--bindir=/Users
/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/bin' '--libdir=/Users/me/.cabal/store/ghc-9.6.1/HsO
pnSSL-0.11.7.5-badd73f3/lib' '--libsubdir=' '--dynlibdir=/Users/me/.cabal/store/ghc-9.6.1/lib' '--libexecdir=/User
s/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/libexec' '--libexecsubdir=' '--datadir=/Users/me/.
cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share' '--datasubdir=' '--docdir=/Users/me/.cabal/store/ghc-9.6.1
/HsOpnSSL-0.11.7.5-badd73f3/share/doc' '--htmldir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/shar
e/doc/html' '--haddockdir=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share/doc/html' '--sysconfdi
r=/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/etc' --enable-library-vanilla --disable-library-prof
iling --enable-shared --disable-static --disable-executable-dynamic --disable-executable-static --disable-profiling '--prof
iling-detail=default' '--library-profiling-detail=default' --enable-optimization --disable-debug-info --disable-build-info
--disable-library-for-ghci --disable-split-sections --disable-split-objs --disable-executable-stripping --disable-library-s
tripping '--package-db=clear' '--package-db=global' '--package-db=/Users/me/.cabal/store/ghc-9.6.1/package.db' '--
flags=-fast-bignum' '--flags=-homebrew-openssl' '--flags=-macports-openssl' '--flags=-use-pkg-config' '--ipid=HsOpnSSL-0.11
.7.5-badd73f3' '--extra-prog-path=/Users/me/.cabal/bin' '--dependency=base=base-4.18.0.0' '--dependency=bytestring
=bytestring-0.11.4.0' '--dependency=network=ntwrk-3.1.4.0-87c18d16' '--dependency=time=time-1.12.2' --disable-tests --disab
le-coverage --exact-configuration --disable-benchmarks '--with-ghc=/Users/me/.ghcup/bin/ghc' '--with-ghc-pkg=/User
s/me/.ghcup/ghc/9.6.1/bin/ghc-pkg-9.6.1' '--ghc-option=-hide-all-packages'
Failed to build HsOpnSSL-0.11.7.5-badd73f3. The failure occurred during the
configure step.
Build log (
/Users/me/.cabal/logs/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3.log ):
[1 of 2] Compiling Main ( /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setu
p/setup.hs, /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/Main.o )
[2 of 2] Linking /Users/me/myproject/dist-newstyle/tmp/src-36711/HsOpenSSL-0.11.7.5/dist/setup/setup
Using Parsec parser
Configuring HsOpenSSL-0.11.7.5...
Flags chosen: fast-bignum=False, homebrew-openssl=False,
macports-openssl=False, use-pkg-config=False
Dependency base ==4.18.0.0: using base-4.18.0.0
Dependency bytestring ==0.11.4.0: using bytestring-0.11.4.0
Dependency network ==3.1.4.0: using network-3.1.4.0
Dependency time ==1.12.2: using time-1.12.2
Source component graph: component lib
Configured component graph:
component HsOpnSSL-0.11.7.5-badd73f3
include base-4.18.0.0
include bytestring-0.11.4.0
include ntwrk-3.1.4.0-87c18d16
include time-1.12.2
Linked component graph:
unit HsOpnSSL-0.11.7.5-badd73f3
include base-4.18.0.0
include bytestring-0.11.4.0
include ntwrk-3.1.4.0-87c18d16
include time-1.12.2
OpenSSL=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL,OpenSSL.BN=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.BN,OpenSSL.Cipher=HsOpnSSL
-0.11.7.5-badd73f3:OpenSSL.Cipher,OpenSSL.DER=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.DER,OpenSSL.DH=HsOpnSSL-0.11.7.5-badd73f3:
OpenSSL.DH,OpenSSL.DSA=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.DSA,OpenSSL.EVP.Base64=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.EVP.Bas
e64,OpenSSL.EVP.Cipher=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.EVP.Cipher,OpenSSL.EVP.Digest=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.
EVP.Digest,OpenSSL.EVP.Internal=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.EVP.Internal,OpenSSL.EVP.Open=HsOpnSSL-0.11.7.5-badd73f3
:OpenSSL.EVP.Open,OpenSSL.EVP.PKey=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.EVP.PKey,OpenSSL.EVP.Seal=HsOpnSSL-0.11.7.5-badd73f3:
OpenSSL.EVP.Seal,OpenSSL.EVP.Sign=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.EVP.Sign,OpenSSL.EVP.Verify=HsOpnSSL-0.11.7.5-badd73f3
:OpenSSL.EVP.Verify,OpenSSL.PEM=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.PEM,OpenSSL.PKCS7=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.PKC
S7,OpenSSL.RSA=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.RSA,OpenSSL.Random=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.Random,OpenSSL.Sess
ion=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.Session,OpenSSL.X509=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.X509,OpenSSL.X509.Request=Hs
OpnSSL-0.11.7.5-badd73f3:OpenSSL.X509.Request,OpenSSL.X509.Revocation=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.X509.Revocation,Op
enSSL.X509.Store=HsOpnSSL-0.11.7.5-badd73f3:OpenSSL.X509.Store
Ready component graph:
definite HsOpnSSL-0.11.7.5-badd73f3
depends base-4.18.0.0
depends bytestring-0.11.4.0
depends ntwrk-3.1.4.0-87c18d16
depends time-1.12.2
Using Cabal-3.10.1.0 compiled by ghc-9.6
Using compiler: ghc-9.6.1
Using install prefix:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3
Executables installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/bin
Libraries installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/lib
Dynamic Libraries installed in: /Users/me/.cabal/store/ghc-9.6.1/lib
Private executables installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/libexec
Data files installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share
Documentation installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/share/doc
Configuration files installed in:
/Users/me/.cabal/store/ghc-9.6.1/HsOpnSSL-0.11.7.5-badd73f3/etc
No alex found
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 13.1.6 found on system at: /usr/bin/gcc
Using ghc version 9.6.1 given by user at: /Users/me/.ghcup/bin/ghc
Using ghc-pkg version 9.6.1 given by user at:
/Users/me/.ghcup/ghc/9.6.1/bin/ghc-pkg-9.6.1
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.28.0 found on system at:
/Users/me/.ghcup/ghc/9.6.1/bin/haddock-ghc-9.6.1
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/Users/me/.ghcup/ghc/9.6.1/bin/hpc-ghc-9.6.1
Using hsc2hs version 0.68.9 found on system at:
/Users/me/.ghcup/ghc/9.6.1/bin/hsc2hs-ghc-9.6.1
No hscolour found
No jhc found
Using ld found on system at: /usr/bin/ld
Using pkg-config version 0.29.2 found on system at:
/opt/homebrew/bin/pkg-config
Using runghc version 9.6.1 found on system at:
/Users/me/.ghcup/ghc/9.6.1/bin/runghc-9.6.1
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
Error: setup: Can't find OpenSSL library.
Install it via 'brew install openssl' or 'port install openssl'.
If you already have OpenSSL installed, specify the location
of the installed library in cabal.project:
package HsOpenSSL
extra-include-dirs: ...
extra-lib-dirs: ...
or use
cabal configure --extra-include-dirs=... --extra-lib-dirs=...
CallStack (from HasCallStack):
withMetadata, called at src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.1.0-inplace:Distribution.Simple.Utils
Error: cabal: Failed to build HsOpnSSL-0.11.7.5-badd73f3. The failure occurred
during the configure step.
Failed to build myproject-0.1.0.0 because it depends on myproject-0.1.0.0
which itself failed to build.
Macbook pro 2021 model with an M1 pro running Os x 12.3
Rather than adding extra directories, have you tried to add openssl
to the PKG_CONFIG_PATH
(I have to do this for e.g. the ICU library). E.g. if pkg-config --list-all
does not list the openssl library, you need to add it to the PKG_CONFIG_PATH.
I can see that openssl is not in pkg-config --list
all, so I tried
𝝺 export PKG_CONFIG_PATH=/opt/homebrew/opt/openssl@3/lib/pkgconfig # Also tried with /lib or just simply the root
𝝺 echo $PKG_CONFIG_PATH
/opt/homebrew/opt/openssl@3/lib/pkgconfig
𝝺 cabal build
And none of them worked.
Notably, even if I set PKG_CONFIG_PATH, I could still not find it listed in pkg-config --list
. Not sure if there's a correct way to set it.
Looks correct. E.g., I have: (I am on x86_64)
$ echo $PKG_CONFIG_PATH
/usr/local/opt/icu4c/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig
Hmm okay, and the extra libs are correct (and cabal.project.yaml is the correct location?)?
ignore-project: False
package HsOpenSSL
extra-lib-dirs:
- /opt/homebrew/opt/openssl@3/lib
extra-include-dirs:
- /opt/homebrew/opt/openssl@3/include
If you pass -f use-pkg-config
to cabal
you should not need to set extra dirs (but then pkg-config
should know about the openssl package).
Hmm okay, and the extra libs are correct (and cabal.project.yaml is the correct location?)?
The .yaml
is a typo here?
ignore-project: False
This line does not do anything, you can delete it.
package HsOpenSSL extra-lib-dirs: - /opt/homebrew/opt/openssl@3/lib extra-include-dirs: - /opt/homebrew/opt/openssl@3/include
If you mean to pass options to a certain package FOO only, you need to indent the block following package FOO
.
Ah yes, sorry the file name was cabal.project.local
. I added the -f use-pkg-config but that yielded the same error.
However, indenting extra-libs-dirs
and extra-include-dirs
gave me this error
Configuring HsOpenSSL-0.11.7.5...
Warning: 'extra-lib-dirs: -' specifies a directory which does not exist.
Warning: 'extra-lib-dirs: -' specifies a directory which does not exist.
Warning: 'extra-lib-dirs: -' specifies a directory which does not exist.
Warning: 'extra-lib-dirs: -' specifies a directory which does not exist.
Warning: 'extra-lib-dirs: -' specifies a directory which does not exist.
Warning: 'include-dirs: -' specifies a directory which does not exist.
Warning: 'include-dirs: -' specifies a directory which does not exist.
Warning: 'include-dirs: -' specifies a directory which does not exist.
Warning: 'include-dirs: -' specifies a directory which does not exist.
Warning: 'include-dirs: -' specifies a directory which does not exist.
Preprocessing library for HsOpenSSL-0.11.7.5..
compiling dist/build/OpenSSL/BN_hsc_make.c failed (exit code 1)
rsp file was: "dist/build/OpenSSL/hsc2hscall55347-0.rsp"
command was: /usr/bin/gcc -c dist/build/OpenSSL/BN_hsc_make.c -o dist/build/OpenSSL/BN_hsc_make.o --target=arm64-apple-dar
win --target=arm64-apple-darwin -Wl,-no_fixup_chains -D__GLASGOW_HASKELL__=906 -Ddarwin_BUILD_OS=1 -Daarch64_BUILD_ARCH=1
-Ddarwin_HOST_OS=1 -Daarch64_HOST_ARCH=1 -Icbits -I- -I/opt/homebrew/opt/openssl@3/include -Idist/build/cbits -Idist/build
/- -I/opt/homebrew/opt/openssl@3/include -D PTHREAD -DCALLCONV=ccall -Idist/build/autogen -Idist/build/global-autogen -inc
lude dist/build/autogen/cabal_macros.h -I/Users/me/.cabal/store/ghc-9.6.1/ntwrk-3.1.4.0-87c18d16/lib//include -I/
Users/me/.ghcup/ghc/9.6.1/lib/ghc-9.6.1/lib/../lib/aarch64-osx-ghc-9.6.1/directory-1.3.8.1/include -I/Users/me/.ghcup/ghc/9.6.1/lib/ghc-9.6.1/lib/../lib/aarch64-osx-ghc-9.6.1/unix-2.8.1.0/include -I/Users/me/.ghcup/gh
c/9.6.1/lib/ghc-9.6.1/lib/../lib/aarch64-osx-ghc-9.6.1/time-1.12.2/include -I/Users/me/.ghcup/ghc/9.6.1/lib/ghc-9
.6.1/lib/../lib/aarch64-osx-ghc-9.6.1/bytestring-0.11.4.0/include -I/Users/me/.ghcup/ghc/9.6.1/lib/ghc-9.6.1/lib/
../lib/aarch64-osx-ghc-9.6.1/base-4.18.0.0/include -I/Users/me/.ghcup/ghc/9.6.1/lib/ghc-9.6.1/lib/../lib/aarch64-
osx-ghc-9.6.1/ghc-bignum-1.3/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi -I/Users/marcco
quand/.ghcup/ghc/9.6.1/lib/ghc-9.6.1/lib/../lib/aarch64-osx-ghc-9.6.1/rts-1.0.2/include -I/Users/me/.ghcup/ghc/9.
6.1/include/
error: clang: warning: -Wl,-no_fixup_chains: 'linker' input unused [-Wunused-command-line-argument]
clang: error: '-I-' not supported, please use -iquote instead
Not sure what I can do for it to detect the directory, because I can cd to that directory without any problem. This is what the config looks like now
package HsOpenSSL
extra-lib-dirs:
- /opt/homebrew/opt/openssl@3/lib
extra-include-dirs:
- /opt/homebrew/opt/openssl@3/include
No dashes please. This is not YAML. Cabal has its own custrom format. (Somewhat unfortunately, imo.)
Ahh yes, the warnings were obvious in hindsight! Thank you so much, now it finally works. :D
Hi! I'm running into the following issue:
I've installed openssl with
brew install openssl
and then usedbrew info openssl
to find that the location of it is/opt/homebrew/Cellar/openssl@3/3.1.1/lib
. I added the following to my local cabalBut I'm still having the same issue and can't figure out what is missing.