3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Stackでhttp-streamsのインストールに失敗したときの回避方法

Posted at

問題

Network.Http.Client を使おうとして http-streams をインストールしようとしたらビルド時にエラーが発生して失敗しました。

$ stack build http-streams

// 省略

attoparsec-0.13.0.2: build
network-2.6.3.1: copy/register
parsec-3.1.11: copy/register
HsOpenSSL-0.11.1.1: download
HsOpenSSL-0.11.1.1: configure
network-uri-2.6.1.0: download
HsOpenSSL-0.11.1.1: build
network-uri-2.6.1.0: configure
network-uri-2.6.1.0: build
network-uri-2.6.1.0: copy/register
unordered-containers-0.2.7.1: copy/register
attoparsec-0.13.0.2: copy/register
Progress: 15/22
--  While building package HsOpenSSL-0.11.1.1 using:
      /Users/kodama/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.0.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/kodama/.stack/global-project/.stack-work/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:
    /private/var/folders/6_/mh85h_1n421dl7xwh385zk3h0000gn/T/stack49801/HsOpenSSL-0.11.1.1/cbits/HsOpenSSL.h:3:10: fatal error: 'openssl/asn1.h' file not found
    #include <openssl/asn1.h>
             ^
    1 error generated.
    compiling .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/OpenSSL/BN_hsc_make.c failed (exit code 1)
    command was: /usr/bin/gcc -c .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/OpenSSL/BN_hsc_make.c -o .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/OpenSSL/BN_hsc_make.o -m64 -fno-stack-protector -m64 -fno-stack-protector -D__GLASGOW_HASKELL__=800 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -D PTHREAD -DCALLCONV=ccall -I.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/autogen -include .stack-work/dist/x86_64-osx/Cabal-1.24.0.0/build/autogen/cabal_macros.h -I/Users/kodama/.stack/snapshots/x86_64-osx/lts-7.0/8.0.1/lib/x86_64-osx-ghc-8.0.1/network-2.6.3.1-G4Up1CPKbp7DeFsnywOnGG/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/unix-2.7.2.0/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/time-1.6.0.1/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/bytestring-0.10.8.1/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/base-4.9.0.0/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/integer-gmp-1.0.0.1/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/include -I/Users/kodama/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/include/

ヘッダが見つからない、というエラーのようです。

環境

  • OS X 10.11.6
  • GHCi version 8.0.1

開発環境はHaskell Day 2016のチュートリアルで整えました。

解決方法

明示的にヘッダの場所を指定することで解決します。

Before

~/.stack/config.yml
# This file contains default non-project-specific settings for 'stack', used
# in all projects.  For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
{}

After

~/.stack/config.yml
# This file contains default non-project-specific settings for 'stack', used
# in all projects.  For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
extra-include-dirs:
- /usr/local/opt/openssl/include
extra-lib-dirs:
- /usr/local/opt/openssl/lib

設定を保存したらもう一度 stack build http-streams を実行してみてください。
さきほど失敗した部分から再開するのでそれほど長い時間はかからないはずです。

参考リンク

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?