Skip to content

Instantly share code, notes, and snippets.

@yuga
Created November 16, 2012 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuga/4087259 to your computer and use it in GitHub Desktop.
Save yuga/4087259 to your computer and use it in GitHub Desktop.
Windowsでregex-pcre-builtinのビルドに失敗するときの対処法

Windowsでregex-pcre-builtinのビルドに失敗するときの対処法

Windowsにpandocをインストールするとかするとはまります。

依存関係: pandoc -> highlighting-kate -> regex-pcre-builtin

regex-pcre-builtin-0.94.4.1.8.31 用の手順です。

エラー事象

>cabal install regex-pcre-builtin
Resolving dependencies...
Downloading regex-pcre-builtin-0.94.4.1.8.31...
Configuring regex-pcre-builtin-0.94.4.1.8.31...
cabal: Missing dependency on a foreign library:
* Missing C library: pcre
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
regex-pcre-builtin-0.94.4.1.8.31 failed during the configure step. The
exception was:
ExitFailure 1

対処法

  1. ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ から pcre-8.31 のソースを取得し、適当な作業ディレクトリに展開する。
  2. C:\Users\ユーザー名\AppData\Roaming\cabal\packages\hackage.haskell.org\regex-pcre-builtin\0.94.4.1.8.31\ ディレクトリの regex-pcre-builtin-0.94.4.1.8.31.tar.gz ファイルを適当な作業ディレクトリに展開する。
  3. regex-pcre-builtin-0.94.4.1.8.31\pcre ディレクトリの中身を削除する。
  4. pcre-8.31/NON-AUTOTOOLS-BUILD の内容に従う形で、pcre-8.31からビルドに必要なファイルをregex-pcre-builtin-0.94.1.8.31 ディレクトリへコピーする。
  5. config.h.generic を pcre/config.h としてコピー
  6. pcre.h.generic を pcre/prec.h としてコピー
  7. つづけて regex-pcre-builtin-0.94.1.8.31\pcre ディレクトリ内が以下のようになるようファイルをコピーする。
pcre/pcreposix.c
    pcre/pcreposix.h
    pcre/pcre_byte_order.c
    pcre/pcre_chartables.c
    pcre/pcre_compile.c
    pcre/pcre_config.c
    pcre/pcre_dfa_exec.c
    pcre/pcre_exec.c
    pcre/pcre_fullinfo.c
    pcre/pcre_get.c
    pcre/pcre_globals.c
    pcre/pcre_internal.h
    pcre/pcre_jit_compile.c
    pcre/pcre_maketables.c
    pcre/pcre_newline.c
    pcre/pcre_ord2utf8.c
    pcre/pcre_refcount.c
    pcre/pcre_string_utils.c
    pcre/pcre_study.c
    pcre/pcre_tables.c
    pcre/pcre_ucd.c
    pcre/pcre_valid_utf8.c
    pcre/pcre_version.c
    pcre/pcre_xclass.c
    pcre/sljit/sljitConfig.h
    pcre/sljit/sljitConfigInternal.h
    pcre/sljit/sljitExecAllocator.c
    pcre/sljit/sljitLir.c
    pcre/sljit/sljitLir.h
    pcre/sljit/sljitNativeARM_Thumb2.c
    pcre/sljit/sljitNativeARM_v5.c
    pcre/sljit/sljitNativeMIPS_32.c
    pcre/sljit/sljitNativeMIPS_common.c
    pcre/sljit/sljitNativePPC_32.c
    pcre/sljit/sljitNativePPC_64.c
    pcre/sljit/sljitNativePPC_common.c
    pcre/sljit/sljitNativeX86_32.c
    pcre/sljit/sljitNativeX86_64.c
    pcre/sljit/sljitNativeX86_common.c
    pcre/sljit/sljitUtils.c
    pcre/ucp.h
  1. regex-pcre-builtin.cabal ファイルで以下の修正を行う。
$ diff regex-pcre-builtin.cabal regex-pcre-builtin-0.94.4.1.8.31/regex-pcre-builtin.cabal
19c19,61
<     pcre/config.h pcre/pcre.h pcre/pcre_byte_order.c pcre/pcre_compile.c pcre/pcre_config.c pcre/pcre_dfa_exec.c pcre/pcre_exec.c pcre/pcre_fullinfo.c pcre/pcre_get.c pcre/pcre_globals.c pcre/pcre_internal.h pcre/pcre_jit_compile.c pcre/pcre_jit_test.c pcre/pcre_maketables.c pcre/pcre_newline.c pcre/pcre_ord2utf8.c pcre/pcre_printint.c pcre/pcre_refcount.c pcre/pcre_scanner.h pcre/pcre_string_utils.c pcre/pcre_study.c pcre/pcre_tables.c pcre/pcre_ucd.c pcre/pcre_valid_utf8.c pcre/pcre_version.c pcre/pcre_xclass.c pcre/pcrecpp.h pcre/pcrecpp_internal.h pcre/pcreposix.h pcre/ucp.h
---
>     pcre/config.h
>     pcre/pcre.h
>     pcre/pcreposix.c
>     pcre/pcreposix.h
>     pcre/pcre_byte_order.c
>     pcre/pcre_chartables.c
>     pcre/pcre_compile.c
>     pcre/pcre_config.c
>     pcre/pcre_dfa_exec.c
>     pcre/pcre_exec.c
>     pcre/pcre_fullinfo.c
>     pcre/pcre_get.c
>     pcre/pcre_globals.c
>     pcre/pcre_internal.h
>     pcre/pcre_jit_compile.c
>     pcre/pcre_maketables.c
>     pcre/pcre_newline.c
>     pcre/pcre_ord2utf8.c
>     pcre/pcre_refcount.c
>     pcre/pcre_string_utils.c
>     pcre/pcre_study.c
>     pcre/pcre_tables.c
>     pcre/pcre_ucd.c
>     pcre/pcre_valid_utf8.c
>     pcre/pcre_version.c
>     pcre/pcre_xclass.c
>     pcre/sljit/sljitConfig.h
>     pcre/sljit/sljitConfigInternal.h
>     pcre/sljit/sljitExecAllocator.c
>     pcre/sljit/sljitLir.c
>     pcre/sljit/sljitLir.h
>     pcre/sljit/sljitNativeARM_Thumb2.c
>     pcre/sljit/sljitNativeARM_v5.c
>     pcre/sljit/sljitNativeMIPS_32.c
>     pcre/sljit/sljitNativeMIPS_common.c
>     pcre/sljit/sljitNativePPC_32.c
>     pcre/sljit/sljitNativePPC_64.c
>     pcre/sljit/sljitNativePPC_common.c
>     pcre/sljit/sljitNativeX86_32.c
>     pcre/sljit/sljitNativeX86_64.c
>     pcre/sljit/sljitNativeX86_common.c
>     pcre/sljit/sljitUtils.c
>     pcre/ucp.h
69c111
<   Extra-Libraries:        pcre
---
>   --Extra-Libraries:        pcre
75c117,138
<       pcre/pcre_byte_order.c pcre/pcre_compile.c pcre/pcre_config.c pcre/pcre_dfa_exec.c pcre/pcre_exec.c pcre/pcre_fullinfo.c pcre/pcre_get.c pcre/pcre_globals.c pcre/pcre_jit_compile.c pcre/pcre_jit_test.c pcre/pcre_maketables.c pcre/pcre_newline.c pcre/pcre_ord2utf8.c pcre/pcre_printint.c pcre/pcre_refcount.c pcre/pcre_string_utils.c pcre/pcre_study.c pcre/pcre_tables.c pcre/pcre_ucd.c pcre/pcre_valid_utf8.c pcre/pcre_version.c pcre/pcre_xclass.c
---
>     pcre/pcreposix.c
>     pcre/pcre_byte_order.c
>     pcre/pcre_chartables.c
>     pcre/pcre_compile.c
>     pcre/pcre_config.c
>     pcre/pcre_dfa_exec.c
>     pcre/pcre_exec.c
>     pcre/pcre_fullinfo.c
>     pcre/pcre_get.c
>     pcre/pcre_globals.c
>     pcre/pcre_jit_compile.c
>     pcre/pcre_maketables.c
>     pcre/pcre_newline.c
>     pcre/pcre_ord2utf8.c
>     pcre/pcre_refcount.c
>     pcre/pcre_string_utils.c
>     pcre/pcre_study.c
>     pcre/pcre_tables.c
>     pcre/pcre_ucd.c
>     pcre/pcre_valid_utf8.c
>     pcre/pcre_version.c
>     pcre/pcre_xclass.c
  1. regex-pcre-builtin-0.94.4.1.8.31 ディレクトリで cabal configure; cabal build してコンパイルに問題ないことを確認する。
  2. regex-pcre-builtin-0.94.4.1.8.31 ディレクトリで cabal clean してから親ディレクトリへ移動し tar czf regex-pcre-builtin-0.94.4.1.8.31.tar.gz regex-pcre-builtin-0.94.4.1.8.31 する。
  3. 出来たファイルを、C:\Users\ユーザー名\AppData\Roaming\cabal\packages\hackage.haskell.org\regex-pcre-builtin\0.94.4.1.8.31\ 内へコピーする。
  4. 失敗したインストールを再実行する(例: cabal install pandoc など)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment