HsOpenSSL icon indicating copy to clipboard operation
HsOpenSSL copied to clipboard

Mac OS X 10.11 (El Capitan) drops support for openssl shim

Open lukehoersten opened this issue 10 years ago • 17 comments

openssl libs and includes are not included in OS X 10.11. I'm not sure if this is permanent or just an effect of the beta release but we should keep our eye on it so when 10.11 is released, HsOpenSSL will work smoothly.

lukehoersten avatar Jun 22 '15 19:06 lukehoersten

I installed openssl through homebrew, passed the --extra-include-dirs=/usr/local/opt/openssl/include argument to cabal install and specifyed extra-lib-dirs: /usr/local/opt/openssl/lib in my cabal file.

Did anyone find a better way to solve this problem?

timbodeit avatar Oct 19 '15 23:10 timbodeit

Even after specifying the lib/include dirs for openssl (same as @timbodeit above), I'm getting errors I didn't get before. Specifically this code used to be fine:


generateKeys = withOpenSSL $ do
    rsa <- generateRSAKey 4096 17 Nothing

    prvPem <- writePKCS8PrivateKey rsa Nothing
    pubPem <- writePublicKey rsa

    x <- newX509
    setPublicKey x rsa

    cert <- writeX509 x
    writeFile "test.x509" cert

    c <- readFile "test.x509"
    xcert <- readX509 c

    return $ PrvPubKey prvPem pubPem

But it now fails with this error (when reading the x509 cert):

(error:0D0C40D8:asn1 encoding routines:c2i_ASN1_OBJECT:invalid object encoding)

A new version of openssl which is no longer compatible with HsOpenSSL... or something I'm doing wrong...?

jasonrbriggs avatar Nov 14 '15 18:11 jasonrbriggs

OS 10.11 is out now. Is there a plan to release something that will address this?

GeorgeCo avatar Nov 16 '15 13:11 GeorgeCo

as far as I see, OS X 10.11 includes openssl...

MacGritsch avatar Nov 19 '15 09:11 MacGritsch

Can you do an install of HsOpenSSL on 10.11? When I try I get

cabal install -j5 hsopenssl Resolving dependencies... Configuring HsOpenSSL-0.11.1.1... Building HsOpenSSL-0.11.1.1... Failed to install HsOpenSSL-0.11.1.1 Build log ( /Users/gcolpitts/.cabal/logs/HsOpenSSL-0.11.1.1.log ): Configuring HsOpenSSL-0.11.1.1... Building HsOpenSSL-0.11.1.1... Preprocessing library HsOpenSSL-0.11.1.1... In file included from BN.hsc:45: cbits/HsOpenSSL.h:3:10: fatal error: 'openssl/asn1.h' file not found #include <openssl/asn1.h> ^ 1 error generated. compiling dist/build/OpenSSL/BN_hsc_make.c failed (exit code 1) command was: /usr/bin/gcc -c dist/build/OpenSSL/BN_hsc_make.c -o dist/build/OpenSSL/BN_hsc_make.o -m64 -fno-stack-protector -D__GLASGOW_HASKELL__=710 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -D PTHREAD -DCALLCONV=ccall -Idist/build/autogen -include dist/build/autogen/cabal_macros.h -I/Users/gcolpitts/Library/Haskell/ghc-7.10.2.20151105-x86_64/lib/network-2.6.2.1/include -I/usr/local/lib/ghc-7.10.2.20151105/unix_KZL8h98IqDM57kQSPo1mKx/include -I/usr/local/lib/ghc-7.10.2.20151105/time_FTheb6LSxyX1UABIbBXRfn/include -I/usr/local/lib/ghc-7.10.2.20151105/bytes_6VWy06pWzJq9evDvK2d4w6/include -I/usr/local/lib/ghc-7.10.2.20151105/base_HQfYBxpPvuw8OunzQu6JGM/include -I/usr/local/lib/ghc-7.10.2.20151105/integ_2aU3IZNMF9a7mQ0OzsZ0dS/include -I/usr/local/lib/ghc-7.10.2.20151105/include -I/usr/local/lib/ghc-7.10.2.20151105/include/ cabal: Error: some packages failed to install: HsOpenSSL-0.11.1.1 failed during the building phase. The exception was: ExitFailure 1

GeorgeCo avatar Nov 20 '15 13:11 GeorgeCo

I can now install with Tim's suggestion above, i.e. cabal install hsopenssl --extra-include-dirs=/usr/local/opt/openssl/include not sure if it will work at runtime Tim mentions extra-lib-dirs: /usr/local/opt/openssl/lib in my cabal file. I guess I should add that line to ~/.ghc_/pkg.conf.s/HsOpen_ to make sure it will work at runtime?

GeorgeCo avatar Nov 20 '15 14:11 GeorgeCo

I also needed to add --extra-include-dirs=/usr/local/opt/openssl/include to my cabal install line when building on El Capitan. It would be nice if there was something we could do to HsOpenSSL so this isn't needed.

mightybyte avatar Jan 11 '16 22:01 mightybyte

I had to do

cabal install
--extra-include-dirs=/usr/local/opt/openssl/include
--extra-lib-dirs=/usr/local/opt/openssl/lib
--reinstall HsOpenSSL

Without extra-lib-dirs I got linker errors.

idontgetoutmuch avatar Jan 21 '16 10:01 idontgetoutmuch

^ That worked for me as well, after homebrew install openssl.

wyager avatar Jan 31 '16 00:01 wyager

In a minor variation, putting these lines in my stack.yaml file worked for me:

extra-include-dirs:
- /usr/local/opt/openssl/include
extra-lib-dirs:
- /usr/local/opt/openssl/lib

pmer avatar Mar 31 '16 12:03 pmer

You can also put what @pmer suggests in ~/.stack/config.yaml which means it will be applied to all projects. Disadvantages are that you will need to recompile all extra-deps and local packages in all your projects and that it will clutter up log messages.

I sent an e-mail to the stack mailing list regarding this: https://groups.google.com/forum/#!topic/haskell-stack/nhEuBh2pWVQ

bergmark avatar Aug 25 '16 11:08 bergmark

Hi, new HsOpenSSL maintainer is here! I've added a fix (https://github.com/vshabanov/HsOpenSSL/commit/06f1fb874d5cff3a07cc308a853b7e6a0222c7ac) and released a new HsOpenSSL version on Hackage. Could you check whether it works for you?

vshabanov avatar Oct 04 '16 22:10 vshabanov

Hi

I see no change, I still have to add the extra args that idontgetoutmuch mentioned:

bash-3.2$ cabal install hsopenssl cabal install hsopenssl Resolving dependencies... Configuring HsOpenSSL-0.11.1.1... Failed to install HsOpenSSL-0.11.1.1 Build log ( /Users/gcolpitts/.cabal/logs/HsOpenSSL-0.11.1.1.log ): cabal: Entering directory '/var/folders/9b/rh4y2gy92hgdb6ktv4df1jv00000gn/T/cabal-tmp-78340/HsOpenSSL-0.11.1.1' Configuring HsOpenSSL-0.11.1.1... cabal: Missing dependencies on foreign libraries:

  • Missing C libraries: crypto, ssl This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Leaving directory '/var/folders/9b/rh4y2gy92hgdb6ktv4df1jv00000gn/T/cabal-tmp-78340/HsOpenSSL-0.11.1.1' cabal: Error: some packages failed to install: HsOpenSSL-0.11.1.1 failed during the configure step. The exception was: ExitFailure 1 bash-3.2$ cabal install hsopenssl --extra-include-dirs=/usr/local/opt/openssl/include cabal install hsopenssl --extra-include-dirs=/usr/local/opt/openssl/include Resolving dependencies... Configuring HsOpenSSL-0.11.1.1... Failed to install HsOpenSSL-0.11.1.1 Build log ( /Users/gcolpitts/.cabal/logs/HsOpenSSL-0.11.1.1.log ): cabal: Entering directory '/var/folders/9b/rh4y2gy92hgdb6ktv4df1jv00000gn/T/cabal-tmp-78737/HsOpenSSL-0.11.1.1' Configuring HsOpenSSL-0.11.1.1... cabal: Missing dependencies on foreign libraries:
  • Missing C libraries: crypto, ssl This problem can usually be solved by installing the system packages that provide these libraries (you may need the "-dev" versions). If the libraries are already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are. cabal: Leaving directory '/var/folders/9b/rh4y2gy92hgdb6ktv4df1jv00000gn/T/cabal-tmp-78737/HsOpenSSL-0.11.1.1' cabal: Error: some packages failed to install: HsOpenSSL-0.11.1.1 failed during the configure step. The exception was: ExitFailure 1 bash-3.2$ cabal install --extra-include-dirs=/usr/local/opt/openssl/include --extra-lib-dirs=/usr/local/opt/openssl/lib --reinstall HsOpenSSL cabal install --extra-include-dirs=/usr/local/opt/openssl/include --extra-lib-dirs=/usr/local/opt/openssl/lib --reinstall HsOpenSSL Resolving dependencies... Configuring HsOpenSSL-0.11.1.1... Building HsOpenSSL-0.11.1.1... Installed HsOpenSSL-0.11.1.1 Updating documentation index /Users/gcolpitts/Library/Haskell/share/doc/x86_64-osx-ghc-8.0.1/index.html bash-3.2$

On Tue, Oct 4, 2016 at 7:30 PM Vladimir Shabanov [email protected] wrote:

Hi, new HsOpenSSL maintainer is here! I've added a fix (vshabanov@06f1fb8 https://github.com/vshabanov/HsOpenSSL/commit/06f1fb874d5cff3a07cc308a853b7e6a0222c7ac) and released a new HsOpenSSL version on Hackage. Could you check whether it works for you?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/phonohawk/HsOpenSSL/issues/41#issuecomment-251532680, or mute the thread https://github.com/notifications/unsubscribe-auth/AGCE-_3uCqu2nVZ-AEOC1TYRv4U73pO9ks5qwtOVgaJpZM4FJPtR .

GeorgeCo avatar Oct 05 '16 11:10 GeorgeCo

Please run cabal update first. You're building old version of HsOpenSSL.

vshabanov avatar Oct 06 '16 01:10 vshabanov

I've added more complex fix https://github.com/vshabanov/HsOpenSSL/commit/b95cea20ef7ee162fd7e5370e09b9120efa3686d which automatically detects Homebrew or MacPorts versions of OpenSSL.

Previous approach caused ld: warning 'directory not found', wasn't informative when OpenSSL is not installed and could potentially prevent linking with OpenSSL from another source.

vshabanov avatar Oct 06 '16 01:10 vshabanov

It builds fine for me! Any particular tests you'd like us to run?

wyager avatar Oct 06 '16 05:10 wyager

Great work! Sorry I forgot to run cabal update the first time.

All the latest versions I've tried work:

$ cabal install hsopenssl Resolving dependencies... Downloading HsOpenSSL-0.11.2.2... Configuring HsOpenSSL-0.11.2.2... Building HsOpenSSL-0.11.2.2... Installed HsOpenSSL-0.11.2.2 Updating documentation index /Users/gcolpitts/Library/Haskell/share/doc/x86_64-osx-ghc-8.0.1/index.html bash-3.2$ cabal update Downloading the latest package list from hackage.haskell.org bash-3.2$ cabal install hsopenssl Resolving dependencies... Downloading HsOpenSSL-0.11.2.4... Configuring HsOpenSSL-0.11.2.4... Building HsOpenSSL-0.11.2.4... Installed HsOpenSSL-0.11.2.4 Updating documentation index /Users/gcolpitts/Library/Haskell/share/doc/x86_64-osx-ghc-8.0.1/index.html

On Wed, Oct 5, 2016 at 10:29 PM Vladimir Shabanov [email protected] wrote:

I've added more complex fix vshabanov@b95cea2 https://github.com/vshabanov/HsOpenSSL/commit/b95cea20ef7ee162fd7e5370e09b9120efa3686d which automatically detects Homebrew or MacPorts versions of OpenSSL.

Previous approach caused ld: warning 'directory not found', wasn't informative when OpenSSL is not installed and could potentially prevent linking with OpenSSL from another source.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/phonohawk/HsOpenSSL/issues/41#issuecomment-251845194, or mute the thread https://github.com/notifications/unsubscribe-auth/AGCE-183TmAJ4p25xTwBJXiZeftG3ngDks5qxE8FgaJpZM4FJPtR .

GeorgeCo avatar Oct 09 '16 21:10 GeorgeCo