pcre-light install fails with undefined reference to _impure_ptr

Not seen this one before. I'm trying to install pcre-light with WinXP 64, Cygwin 1.7.1, Cabal 0.8.0, and ghc 6.12.1. Trying to reinstall "base" with cabal fails as well with an internal error (see below), but I'm assuming that's quasi-intentional/unsupported feature or something. Any ideas? My ultimate goal is to install ghc-core to help track down some performance problems I'm having. Thanks, Patrick. patc@rose ~/rp4/loansim $ cabal install pcre-light --extra-lib-dirs=C:\\cygwin\\lib --extra-include-dirs=C:\\cygwin\\usr\\include --reinstall Resolving dependencies... Configuring pcre-light-0.3.1... Preprocessing library pcre-light-0.3.1... In file included from C:/cygwin/usr/include/pcre.h:90, from Text\Regex\PCRE\Light\Base.hsc:103: C:/cygwin/usr/include/stdlib.h:104: warning: `warning' attribute directive ignored C:/cygwin/usr/include/stdlib.h:109: warning: `warning' attribute directive ignored dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x47): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x7b): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x93): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0xc7): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0xf3): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x127): more undefined references to `_impure_ptr' follow collect2: ld returned 1 exit status linking dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o failed command was: C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe -LC:\cygwin\lib -lpcre -LC:\ghc\ghc-6.12.1\bytestring-0.9.1.5 -LC:\ghc\ghc-6.12.1\base-3.0.3.2 -LC:\ghc\ghc-6.12.1\syb-0.1.0.2 -LC:\ghc\ghc-6.12.1\base-4.2.0.0 -lwsock32 -luser32 -lshell32 -LC:\ghc\ghc-6.12.1\integer-gmp-0.2.0.0 -LC:\ghc\ghc-6.12.1\ghc-prim-0.2.0.0 -LC:\ghc\ghc-6.12.1 -LC:\ghc\ghc-6.12.1/gcc-lib -lm -lwsock32 -LC:\ghc\ghc-6.12.1 dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o -o dist\build\Text\Regex\PCRE\Light\Base_hsc_make.exe cabal.exe: Error: some packages failed to install: pcre-light-0.3.1 failed during the building phase. The exception was: exit: ExitFailure 1 patc@rose ~/rp4/loansim $ cabal --version cabal-install version 0.8.0 using version 1.8.0.2 of the Cabal library patc@rose ~/rp4/loansim $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1 patc@rose ~/rp4/loansim $ cabal install base --reinstall -p Resolving dependencies... cabal.exe: internal error: impossible patc@rose ~/rp4/loansim $

Hi Patrick
I think the problem is because PCRE uses c++, and doing a quick web
search shows that _impure_ptr link errors are a recurrent problem for
the PCRE binding with GHC. Funnily enough 6.10.3 worked fine - I
posted to the list a month or two ago with instructions how to do it,
but 6.12.1 fails for me in the same was as it fails for you.
I'll try next with MinGW to see if that works...
Best wishes
Stpehen
2009/12/27 Patrick Caldon
Not seen this one before.
I'm trying to install pcre-light with WinXP 64, Cygwin 1.7.1, Cabal 0.8.0, and ghc 6.12.1. Trying to reinstall "base" with cabal fails as well with an internal error (see below), but I'm assuming that's quasi-intentional/unsupported feature or something.
Any ideas? My ultimate goal is to install ghc-core to help track down some performance problems I'm having.
Thanks, Patrick.
patc@rose ~/rp4/loansim $ cabal install pcre-light --extra-lib-dirs=C:\\cygwin\\lib --extra-include-dirs=C:\\cygwin\\usr\\include --reinstall Resolving dependencies... Configuring pcre-light-0.3.1... Preprocessing library pcre-light-0.3.1... In file included from C:/cygwin/usr/include/pcre.h:90, from Text\Regex\PCRE\Light\Base.hsc:103: C:/cygwin/usr/include/stdlib.h:104: warning: `warning' attribute directive ignored C:/cygwin/usr/include/stdlib.h:109: warning: `warning' attribute directive ignored dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x47): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x7b): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x93): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0xc7): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0xf3): undefined reference to `_impure_ptr' dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o:Base_hsc_make.c:(.text+0x127): more undefined references to `_impure_ptr' follow collect2: ld returned 1 exit status linking dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o failed command was: C:\ghc\ghc-6.12.1\mingw\bin\gcc.exe -LC:\cygwin\lib -lpcre -LC:\ghc\ghc-6.12.1\bytestring-0.9.1.5 -LC:\ghc\ghc-6.12.1\base-3.0.3.2 -LC:\ghc\ghc-6.12.1\syb-0.1.0.2 -LC:\ghc\ghc-6.12.1\base-4.2.0.0 -lwsock32 -luser32 -lshell32 -LC:\ghc\ghc-6.12.1\integer-gmp-0.2.0.0 -LC:\ghc\ghc-6.12.1\ghc-prim-0.2.0.0 -LC:\ghc\ghc-6.12.1 -LC:\ghc\ghc-6.12.1/gcc-lib -lm -lwsock32 -LC:\ghc\ghc-6.12.1 dist\build\Text\Regex\PCRE\Light\Base_hsc_make.o -o dist\build\Text\Regex\PCRE\Light\Base_hsc_make.exe cabal.exe: Error: some packages failed to install: pcre-light-0.3.1 failed during the building phase. The exception was: exit: ExitFailure 1
patc@rose ~/rp4/loansim $ cabal --version cabal-install version 0.8.0 using version 1.8.0.2 of the Cabal library
patc@rose ~/rp4/loansim $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.1
patc@rose ~/rp4/loansim $ cabal install base --reinstall -p Resolving dependencies... cabal.exe: internal error: impossible
patc@rose ~/rp4/loansim $
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

2009/12/27 Stephen Tetley
I'll try next with MinGW to see if that works...
Aye, it builds fine under MinGW. I built and installed PCRE (c & c++ library) from the source (./configure, make, make install), though I think there is a package available on the msys / MinGW repository. Then I installed pcre-light via runhaskell Setup ... rather than cabal install. The source build of the C library puts the headers in C:\msys\1.0\local\include and the libs in C:\msys\1.0\local\lib so the runhaskell commands were (remembering that runhaskell on Windows takes directory names with double win-slash): $ runhaskell Setup.lhs configure --extra-lib-dirs=C:\\msys\\1.0\\local\\lib --extra-include-dirs=C:\\msys\\1.0\\local\\include $ runhaskell Setup.lhs build $ runhaskell Setup.lhs install Best wishes Stephen

Stephen Tetley wrote:
2009/12/27 Stephen Tetley
: I'll try next with MinGW to see if that works...
Aye, it builds fine under MinGW.
Thanks for your help, I'll get a MinGW setup together. Cheers, Patrick.

For the record... The regex-posix package also failed to build for me with GHC 6.12.1 on Windows with Cygwin due to >> undefined reference to `_impure_ptr' << errors. Again this builds fine with MinGW once you have the GNU regex library installed (its not installed as a default MSys package). With a runhaskell Setup.hs ... install you need to set the extra-include-dirs to pick up regex.h and the extra-lib-dir to pick up libregex.a

Hi, Am Sonntag, den 27.12.2009, 09:50 +0000 schrieb Stephen Tetley:
I'll try next with MinGW to see if that works...
Aye, it builds fine under MinGW.
I built and installed PCRE (c & c++ library) from the source (./configure, make, make install), though I think there is a package available on the msys / MinGW repository.
I got it to work using the package from the msys repository, but I had to remove "-viaC" from the cabal file. Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org
participants (3)
-
Joachim Breitner
-
Patrick Caldon
-
Stephen Tetley