Skip to content

Instantly share code, notes, and snippets.

@yuga
Created November 17, 2012 10:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuga/4094702 to your computer and use it in GitHub Desktop.
Save yuga/4094702 to your computer and use it in GitHub Desktop.
How to fix the failure of building regex-pcre-builtin on Windows

How to fix the failure of building regex-pcre-builtin on Windows

Q. What is the issue?

A. Let's do the clean installation of pandoc on Windows. Cabal tell us that something went wrong

>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

regex-pcre-builtin-0.94.4.1.8.31 could not pass build, even cabal config.

Dependencies: pandoc -> highlighting-kate -> regex-pcre-builtin

How to fix

  1. Get the source tar ball of pcre-8.31 from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, and extract it into a directory.
  2. Get the source tar ball of regex-pcre-builtin-0.94.4.1.8.31 from hackage, and extract it into a directory.
  3. Remove all files in the directory of regex-pcre-builtin-0.94.4.1.8.31\pcre.
  4. According to pcre-8.31\NON-AUTOTOOLS-BUILD, copy the required files for building as follows:
  5. copy pcre-8.31\config.h.generic as regex-pcre-builtin-0.94.4.1.8.31\pcre\config.h
  6. copy pcre-8.31\pcre.h.generic as regex-pcre-builtin-0.94.4.1.8.31\pcre\prec.h
  7. copy the files so that regex-pcre-builtin-0.94.4.1.8.31 contains the foloowing files:
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. rewrite regex-pcre-builtin.cabal as follows:
$ 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. "cabal configure" and "cabal build" in the directory of regex-pcre-builtin-0.94.4.1.8.31 in order to confirm that your task has been successfully completed.
  2. "cabal clean" and move to the parent directory, then "tar czf regex-pcre-builtin-0.94.4.1.8.31".
  3. Place the tarball you created in C:\Users\YourName\AppData\Roaming\cabal\packages\hackage.haskell.org\regex-pcre-builtin\0.94.4.1.8.31.
  4. Retry the installation of pandoc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment