Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failure on macOS #34

Open
MaxGabriel opened this issue Jan 13, 2018 · 5 comments
Open

Install failure on macOS #34

MaxGabriel opened this issue Jan 13, 2018 · 5 comments

Comments

@MaxGabriel
Copy link

MaxGabriel commented Jan 13, 2018

Hi, I'm having trouble installing HsOpenSSL. I'm getting the following error:

maximiliantagher@Maximilians-MBP ~/D/M/h/mercury-web-backend> stack install HsOpenSSL
HsOpenSSL-0.11.4.11: configure

--  While building custom Setup.hs for package HsOpenSSL-0.11.4.11 using:
      /private/var/folders/v7/5k06hq7d3wbb4cvk8smv6kl00000gn/T/stack19302/HsOpenSSL-0.11.4.11/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 configure --with-ghc=/Users/maximiliantagher/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc --with-ghc-pkg=/Users/maximiliantagher/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/pkgdb --libdir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/lib --bindir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/bin --datadir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/share --libexecdir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/libexec --sysconfdir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/etc --docdir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/doc/HsOpenSSL-0.11.4.11 --htmldir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/doc/HsOpenSSL-0.11.4.11 --haddockdir=/Users/maximiliantagher/.stack/snapshots/x86_64-osx/lts-9.14/8.0.2/doc/HsOpenSSL-0.11.4.11 --dependency=Cabal=Cabal-1.24.2.0 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=network=network-2.6.3.2-IsLM4TXcLoRI0fmmBYVyQz --dependency=time=time-1.6.0.1 -f-fast-bignum
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/maximiliantagher/Documents/Mercury/hs/mercury-web-backend/.stack-work/logs/HsOpenSSL-0.11.4.11.log

    [1 of 2] Compiling Main             ( /private/var/folders/v7/5k06hq7d3wbb4cvk8smv6kl00000gn/T/stack19302/HsOpenSSL-0.11.4.11/Setup.hs, /private/var/folders/v7/5k06hq7d3wbb4cvk8smv6kl00000gn/T/stack19302/HsOpenSSL-0.11.4.11/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /Users/maximiliantagher/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/v7/5k06hq7d3wbb4cvk8smv6kl00000gn/T/stack19302/HsOpenSSL-0.11.4.11/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /private/var/folders/v7/5k06hq7d3wbb4cvk8smv6kl00000gn/T/stack19302/HsOpenSSL-0.11.4.11/.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/setup/setup ...
    Configuring HsOpenSSL-0.11.4.11...
    setup: Can't find OpenSSL library,
    install it via 'brew install openssl' or 'port install openssl'
    or use --extra-include-dirs= and --extra-lib-dirs=
    to specify location of installed OpenSSL library.

However, I have run brew install openssl, and I can confirm that the /usr/local/opt/openssl/ and /usr/local/opt/openssl/lib directories are present.

Adding these lines to my stack.yaml file fixes it:

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

However, I was under the impression that this shouldn't be necessary, because of this commit: b95cea2

OS Version: macOS High Sierra 10.13.2 (17C205) (Latest as of today)
Stack: Version 1.6.0.20171202, Git revision 50090e67c16980bba31349f386d5b018cbcaec31 (5421 commits) x86_64 hpack-0.20.0
LTS Haskell: 9.14
Compiler: 8.0.2 (Unchanged from LTS)
OpenSSL: 1.0.2n (Latest as today)

I had a coworker try it as well, and he had the same issue (Same project as mine, and also on macOS High Sierra)

Tell me if there's anything I can do to help debug this issue!

@vshabanov
Copy link
Collaborator

Hard to say. I have no experience with Stack.

Does it work if you set homebrew-openssl flag instead of settings extra-*-dirs?

And could you run installation with verbose flag and attach logs so I could see what happens during configuration stage.

@MaxGabriel
Copy link
Author

Does it work if you set homebrew-openssl flag instead of settings extra-*-dirs?

Yes, I added these flags:

flags:
  HsOpenSSL:
    homebrew-openssl: true

and it installs correctly.

And could you run installation with verbose flag and attach logs so I could see what happens during configuration stage.

This is the output with --verbose --cabal-verbose. Before the package is actually configured you'll see "Exception ignored when attempting to load" the HsOpenSSL package—I'm pretty certain this is just because I had to uninstall HsOpenSSL (stack exec -- ghc-pkg unregister --force "HsOpenSSL) to reproduce what breaks installing it. After those lines it proceeds to configure it as normal, where it fails on finding the OpenSSL library.

I also ran the command with just --cabal-verbose which may be more relevant; here's that output.

(Note: these gists are when I'm installing with neither the manually added flag or the extra-*-dirs changes).

@MaxGabriel
Copy link
Author

maximiliantagher@Maximilians-MacBook-Pro ~> cabal install HsOpenSSL
Resolving dependencies...
Configuring network-2.6.3.2...
Building network-2.6.3.2...
Installed network-2.6.3.2
Downloading HsOpenSSL-0.11.4.11...
Configuring HsOpenSSL-0.11.4.11...
Building HsOpenSSL-0.11.4.11...
Installed HsOpenSSL-0.11.4.11

A cabal install of the same version of HsOpenSSL seems to work.

After that worked I unregistered the package and ran it again with --verbose flags in case that's helpful;

https://gist.github.com/MaxGabriel/7889879980cd6525038ceeea80c76f87

That log prints: Redirecting build log to {handle: /Users/maximiliantagher/.cabal/logs/ghc-8.2.1/HsOpenSSL-0.11.4.11-E0eYID5H9bI2rtP2Zsi72t.log}, so I included that too:

https://gist.github.com/MaxGabriel/2a7116641ef32653618136473a699636

@streamerd
Copy link

streamerd commented Jun 3, 2018

When doing $stack build with dependency on openssl, I've got the same issue on OSX Sierra,
Darwin Kernel 16.7.0 RELEASE_X86_64;

@MaxGabriel 's solution worked for me as well.

I was using MacPorts installed openssl / openssl @1.0.2o_1 (active),
hence did change in the configuration file by updating flags:
######## stack.yaml ###########


flags: 
  HsOpenSSL: 
          macports-openssl : true

##########################

make sure to care about indentation.

@bapcyk
Copy link

bapcyk commented Feb 3, 2023

Hard to say. I have no experience with Stack.

Does it work if you set homebrew-openssl flag instead of settings extra-*-dirs?

And could you run installation with verbose flag and attach logs so I could see what happens during configuration stage.

Btw, IMO it makes sense to add some kind of switching between 2 architectures: x86_64 and arm64 for M1, M2 if it can be done with some if platform(...). Or to change flags like homebrew-x86_64-openssl and homebrew-arm64-openssl or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants