Compiling regex-posix on Windows

Hi all, The only problem stalling the release of the Windows installer for the new Haskell Platform is the bug in regex-posix. It compiles fine (using the libregex.a library from MinGW), but fails at runtime with the following error: Prelude> import Text.Regex.Posix Prelude Text.Regex.Posix> "bar" =~ "(foo|bar)" ::Bool Loading package array-0.3.0.0 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package regex-base-0.93.1 ... linking ... done. Loading package regex-posix-0.94.1 ... linking ... <interactive>: E:\Program Fil es (x86)\Haskell\regex-posix-0.94.1\ghc-6.12.1\HSregex-posix-0.94.1.o: unknown s ymbol `_regerror' : unable to load package `regex-posix-0.94.1' Prelude Text.Regex.Posix> Unfortunately, Chris, the maintainer, doesn't have access to a Windows machine with GHC currently, and therefore can't help me. I'd appreciate any pointers on how to fix this. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

On 25/03/10 18:02, Mikhail Glushenkov wrote:
Hi all,
The only problem stalling the release of the Windows installer for the new Haskell Platform is the bug in regex-posix. It compiles fine (using the libregex.a library from MinGW), but fails at runtime with the following error:
Prelude> import Text.Regex.Posix Prelude Text.Regex.Posix> "bar" =~ "(foo|bar)" ::Bool Loading package array-0.3.0.0 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package regex-base-0.93.1 ... linking ... done. Loading package regex-posix-0.94.1 ... linking ...<interactive>: E:\Program Fil es (x86)\Haskell\regex-posix-0.94.1\ghc-6.12.1\HSregex-posix-0.94.1.o: unknown s ymbol `_regerror' : unable to load package `regex-posix-0.94.1' Prelude Text.Regex.Posix>
You can't load a .a library into GHCi, so you need to get the regex implementation from somewhere. Is there a DLL? If not, you'll have to arrange to put the code into a .o that GHCi can load. Cheers, Simon

Hi Simon,
On Thu, Mar 25, 2010 at 11:34 PM, Simon Marlow
You can't load a .a library into GHCi, so you need to get the regex implementation from somewhere. Is there a DLL? If not, you'll have to arrange to put the code into a .o that GHCi can load.
How does regex-posix work in 6.10? I do not see a DLL included (and neither regex.h or libregex.a for that matter). I was under impression that a suitable .o file should get produced when I do 'cabal install regex-posix'. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

On 25/03/2010 22:59, Mikhail Glushenkov wrote:
Hi Simon,
On Thu, Mar 25, 2010 at 11:34 PM, Simon Marlow
wrote: You can't load a .a library into GHCi, so you need to get the regex implementation from somewhere. Is there a DLL? If not, you'll have to arrange to put the code into a .o that GHCi can load.
How does regex-posix work in 6.10? I do not see a DLL included (and neither regex.h or libregex.a for that matter). I was under impression that a suitable .o file should get produced when I do 'cabal install regex-posix'.
regex-posix includes sources for the C regex library. However, the Cabal package for regex-posix on Hackage doesn't have these sources or the configure scripts, presumably because they weren't listed as extra-source-files in the .cabal file, so they are only in the darcs repository. The darcs repository is at http://code.haskell.org/regex-posix. I suggest grabbing that version and using it for the Windows platform build. (don't forget to autoconf!) Chris: can we get an updated regex-posix with the configure scripts and C sources on Hackage please? Cheers, Simon

Hi,
On Fri, Mar 26, 2010 at 10:25 AM, Simon Marlow
The darcs repository is at http://code.haskell.org/regex-posix. I suggest grabbing that version and using it for the Windows platform build. (don't forget to autoconf!)
No luck with that version either. First it complained about the absence of HsRegexPosixConfig.h, and then failed when compiling Wrap.hsc (see below). This can be cured by putting MinGW's regex.h and libregex.a into $GHC_DIR/mingw/{include, lib}, but then I get the aforementioned runtime error when trying to actually use Text.Regex.Posix functions. Preprocessing library regex-posix-0.94.0... Text\Regex\Posix\Wrap.hsc:105:19: regex.h: No such file or directory Text\Regex\Posix\Wrap.hsc: In function `main': Text\Regex\Posix\Wrap.hsc:379: error: `REG_NOTBOL' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:379: error: (Each undeclared identifier is reported on ly once Text\Regex\Posix\Wrap.hsc:379: error: for each function it appears in.) Text\Regex\Posix\Wrap.hsc:380: error: `REG_NOTEOL' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:384: error: `REG_EXTENDED' undeclared (first use in th is function) Text\Regex\Posix\Wrap.hsc:385: error: `REG_ICASE' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:386: error: `REG_NOSUB' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:387: error: `REG_NEWLINE' undeclared (first use in thi s function) Text\Regex\Posix\Wrap.hsc:393: error: `REG_NOMATCH' undeclared (first use in thi s function) Text\Regex\Posix\Wrap.hsc:394: error: `REG_BADBR' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:395: error: `REG_BADPAT' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:396: error: `REG_BADRPT' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:397: error: `REG_ECOLLATE' undeclared (first use in th is function) Text\Regex\Posix\Wrap.hsc:398: error: `REG_ECTYPE' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:399: error: `REG_EESCAPE' undeclared (first use in thi s function) Text\Regex\Posix\Wrap.hsc:400: error: `REG_ESUBREG' undeclared (first use in thi s function) Text\Regex\Posix\Wrap.hsc:401: error: `REG_EBRACK' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:402: error: `REG_EPAREN' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:403: error: `REG_EBRACE' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:404: error: `REG_ERANGE' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:405: error: `REG_ESPACE' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:442: error: `regex_t' undeclared (first use in this fu nction) Text\Regex\Posix\Wrap.hsc:476: error: syntax error before ')' token Text\Regex\Posix\Wrap.hsc:479: error: `regmatch_t' undeclared (first use in this function) Text\Regex\Posix\Wrap.hsc:505: error: syntax error before ')' token Text\Regex\Posix\Wrap.hsc:505: error: `regoff_t' undeclared (first use in this f unction) Text\Regex\Posix\Wrap.hsc:505: error: syntax error before "int" Text\Regex\Posix\Wrap.hsc:506: error: syntax error before ')' token Text\Regex\Posix\Wrap.hsc:506: error: syntax error before "int" Text\Regex\Posix\Wrap.hsc:520: error: syntax error before ')' token compiling dist\build\Text\Regex\Posix\Wrap_hsc_make.c failed command was: E:\ghc\ghc-6.12.1\mingw\bin\gcc.exe -c -D__GLASGOW_HASKELL__=612 -D HAVE_REGEX_H -DSPLIT_BASE=1 -IE:\ghc\ghc-6.12.1\bytestring-0.9.1.5\include -IE:\ ghc\ghc-6.12.1\base-4.2.0.0\include -IE:\ghc\ghc-6.12.1/include -IE:\ghc\ghc-6.1 2.1/include -IE:/ghc/ghc-6.12.1/lib/include/ dist\build\Text\Regex\Posix\Wrap_hs c_make.c -o dist\build\Text\Regex\Posix\Wrap_hsc_make.o -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

On 26/03/2010 12:13, Mikhail Glushenkov wrote:
Hi,
On Fri, Mar 26, 2010 at 10:25 AM, Simon Marlow
wrote: The darcs repository is at http://code.haskell.org/regex-posix. I suggest grabbing that version and using it for the Windows platform build. (don't forget to autoconf!)
No luck with that version either. First it complained about the absence of HsRegexPosixConfig.h, and then failed when compiling Wrap.hsc (see below). This can be cured by putting MinGW's regex.h and libregex.a into $GHC_DIR/mingw/{include, lib}, but then I get the aforementioned runtime error when trying to actually use Text.Regex.Posix functions.
You don't want to use libregex.a, because as I mentioned before it won't be loadable by GHCi.
Preprocessing library regex-posix-0.94.0... Text\Regex\Posix\Wrap.hsc:105:19: regex.h: No such file or directory
Looks like the configure script didn't run, or something of that kind. Perhaps you need to put build-type: Configure in regex-posix.cabal. Cheers, Simon

Hi,
On Fri, Mar 26, 2010 at 1:20 PM, Simon Marlow
Preprocessing library regex-posix-0.94.0... Text\Regex\Posix\Wrap.hsc:105:19: regex.h: No such file or directory
Looks like the configure script didn't run, or something of that kind. Perhaps you need to put
build-type: Configure
in regex-posix.cabal.
The configure script did run, and changing build-type from Custom to Configure doesn't help. Looking at zlib's .cabal file, it seems like the key to fixing this is modifying the c-sources field. -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

On 26/03/2010 12:37, Mikhail Glushenkov wrote:
Hi,
On Fri, Mar 26, 2010 at 1:20 PM, Simon Marlow
wrote: Preprocessing library regex-posix-0.94.0... Text\Regex\Posix\Wrap.hsc:105:19: regex.h: No such file or directory
Looks like the configure script didn't run, or something of that kind. Perhaps you need to put
build-type: Configure
in regex-posix.cabal.
The configure script did run, and changing build-type from Custom to Configure doesn't help. Looking at zlib's .cabal file, it seems like the key to fixing this is modifying the c-sources field.
There is supposed to be a regex-posix.buildinfo.in file that is modified by the configure script, and contains the necessary c-sources field. That file was present in regex-posix-0.72.0.3, but is apparently missing in the most recent darcs sources. Cheers, Simon

Hi,
On Fri, Mar 26, 2010 at 1:47 PM, Simon Marlow
There is supposed to be a regex-posix.buildinfo.in file that is modified by the configure script, and contains the necessary c-sources field. That file was present in regex-posix-0.72.0.3, but is apparently missing in the most recent darcs sources.
I was finally able to produce a working regex-posix today. Turns out one has to to comment out the line that defines -DHAVE_REGEX_H in the .cabal file. Thanks for help! -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments

I was too busy this weekend and I did not notice this thread until now. I don't run Windows so I never maintained that build support for the new regex-posix version. If someone has it working then I would love to take a darcs patch. In order to unblock the Platform release I will try and setup ghc development on a Virtualbox'd Windows 7, on top of "OS X". -- Chris On 26/03/2010 12:47, Simon Marlow wrote:
On 26/03/2010 12:37, Mikhail Glushenkov wrote:
Hi,
On Fri, Mar 26, 2010 at 1:20 PM, Simon Marlow
wrote: Preprocessing library regex-posix-0.94.0... Text\Regex\Posix\Wrap.hsc:105:19: regex.h: No such file or directory
Looks like the configure script didn't run, or something of that kind. Perhaps you need to put
build-type: Configure
in regex-posix.cabal.
The configure script did run, and changing build-type from Custom to Configure doesn't help. Looking at zlib's .cabal file, it seems like the key to fixing this is modifying the c-sources field.
There is supposed to be a regex-posix.buildinfo.in file that is modified by the configure script, and contains the necessary c-sources field. That file was present in regex-posix-0.72.0.3, but is apparently missing in the most recent darcs sources.
Cheers, Simon

Hi, I had a similar problem, ghc 6.12.1, windows 32bit, posix-regex-0.94.1 from hackage. I used libregex.a (and corresponding dll) from Mingw. My problem was that I could not link an application which imported Text.Regex.Posix. I was able to solve it by modifying a line ld-options: in package.conf.d/regex-posix-0.94.1blahblah to ld-options: -lregex (do not forget to ghc-pkg recache after that :) When I tried importing Text.Regex.Posix in ghci now, it works. I know adding a line to file in package.conf.d id not The Right Way, it can be probably fixed in the .cabal file, but I just wanted a quick fix. Does it work for you? Milan
Hi all,
The only problem stalling the release of the Windows installer for the new Haskell Platform is the bug in regex-posix. It compiles fine (using the libregex.a library from MinGW), but fails at runtime with the following error:
Prelude> import Text.Regex.Posix Prelude Text.Regex.Posix> "bar" =~ "(foo|bar)" ::Bool Loading package array-0.3.0.0 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package regex-base-0.93.1 ... linking ... done. Loading package regex-posix-0.94.1 ... linking ... <interactive>: E:\Program Fil es (x86)\Haskell\regex-posix-0.94.1\ghc-6.12.1\HSregex-posix-0.94.1.o: unknown s ymbol `_regerror' : unable to load package `regex-posix-0.94.1' Prelude Text.Regex.Posix>
Unfortunately, Chris, the maintainer, doesn't have access to a Windows machine with GHC currently, and therefore can't help me.
I'd appreciate any pointers on how to fix this.
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

Hi, disregard my previous post. I just imported the module. But I get a different error: Prelude> import Text.Regex.Posix Prelude Text.Regex.Posix> "bar" =~ "(foo|bar)" ::Bool Loading package array-0.3.0.0 ... linking ... done. Loading package syb-0.1.0.2 ... linking ... done. Loading package base-3.0.3.2 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package regex-base-0.93.1 ... linking ... done. Loading package regex-posix-0.94.1 ... <interactive>: regex: The specified module could not be found. can't load .so/.DLL for: regex (addDLL: could not load DLL) Sorry for confusion, Milan
Hi,
I had a similar problem, ghc 6.12.1, windows 32bit, posix-regex-0.94.1 from hackage. I used libregex.a (and corresponding dll) from Mingw.
My problem was that I could not link an application which imported Text.Regex.Posix.
I was able to solve it by modifying a line ld-options: in package.conf.d/regex-posix-0.94.1blahblah to ld-options: -lregex (do not forget to ghc-pkg recache after that :)
When I tried importing Text.Regex.Posix in ghci now, it works.
I know adding a line to file in package.conf.d id not The Right Way, it can be probably fixed in the .cabal file, but I just wanted a quick fix.
Does it work for you?
Milan
Hi all,
The only problem stalling the release of the Windows installer for the new Haskell Platform is the bug in regex-posix. It compiles fine (using the libregex.a library from MinGW), but fails at runtime with the following error:
Prelude> import Text.Regex.Posix Prelude Text.Regex.Posix> "bar" =~ "(foo|bar)" ::Bool Loading package array-0.3.0.0 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package regex-base-0.93.1 ... linking ... done. Loading package regex-posix-0.94.1 ... linking ... <interactive>: E:\Program Fil es (x86)\Haskell\regex-posix-0.94.1\ghc-6.12.1\HSregex-posix-0.94.1.o: unknown s ymbol `_regerror' : unable to load package `regex-posix-0.94.1' Prelude Text.Regex.Posix>
Unfortunately, Chris, the maintainer, doesn't have access to a Windows machine with GHC currently, and therefore can't help me.
I'd appreciate any pointers on how to fix this.
-- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
participants (4)
-
Chris Kuklewicz
-
Mikhail Glushenkov
-
Milan Straka
-
Simon Marlow