0.96 broke builds on windows?
Closed this issue · 16 comments
I have a quite extensive test suite and I think the latest update for this library broke windows builds, the error message is:
regex-posix > configure
regex-posix > Configuring regex-posix-0.96.0.0...
regex-posix > build
regex-posix > Preprocessing library for regex-posix-0.96.0.0..
regex-posix > C:\Users\runneradmin\AppData\Local\Temp\stack-67450dfd8b89b02e\regex-posix-0.96.0.0\Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
regex-posix > compilation terminated.
regex-posix > compiling .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c failed (exit code 1)
regex-posix > command was: C:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\../mingw/bin\gcc.exe -c .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c -o .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.o -D__GLASGOW_HASKELL__=808 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\cbits -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\autogen -I.stack-work\dist\29cc6475\build\global-autogen -include .stack-work\dist\29cc6475\build\autogen\cabal_macros.h -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\bytestring-0.10.10.0\include -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\base-4.13.0.0\include -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib\integer-gmp-1.0.2.0\include -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2\lib/include -IC:\Users\runneradmin\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.2/lib/include/
But version 0.95 works fine and I saw that you removed some C files so I imagine that's the problem
here is the actual run if you want to see it
+1, but I get the following error:
ghc.exe: unable to load package `regex-posix-0.96.0.0'
ghc.exe: | C:\sr\snapshots\819b1ba9\lib\x86_64-windows-ghc-8.8.3\regex-posix-0.96.0.0-EI2FExbBi7eEhY8Y7SNqHy\HSregex-posix-0.96.0.0-EI2FExbBi7eEhY8Y7SNqHy.o: unknown symbol `regerror'
...
Process exited with code: ExitFailure 1
I have the same problem with version 0.96 (<0.96 works fine) under windows
nightly-2020-08-27:
[warn] regex-posix> error: Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
[warn] regex-posix> compilation terminated.
[warn] regex-posix>
lts-16.10:
[warn] regex-posix> C:\Users\schal\AppData\Local\Temp\stack-38cbd24891c11f7b\regex-posix-0.96.0.0\Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
[warn] regex-posix> compilation terminated.
[warn] regex-posix> compiling .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c failed (exit code 1)
It works fine for me... so do you guys have a repro?
C:\Users\devbox\source\repos\regex-posix [master ≡]> cabal build --allow-newer
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- regex-posix-0.96.0.0 (lib) (first run)
Configuring library for regex-posix-0.96.0.0..
Preprocessing library for regex-posix-0.96.0.0..
Building library for regex-posix-0.96.0.0..
[1 of 7] Compiling Paths_regex_posix ( C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\autogen\Paths_regex_posix.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Paths_regex_posix.o )
[2 of 7] Compiling Text.Regex.Posix.Wrap ( C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\Wrap.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\Wrap.o )
[3 of 7] Compiling Text.Regex.Posix.String ( Text\Regex\Posix\String.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\String.o )
[4 of 7] Compiling Text.Regex.Posix.Sequence ( Text\Regex\Posix\Sequence.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\Sequence.o )
[5 of 7] Compiling Text.Regex.Posix.ByteString ( Text\Regex\Posix\ByteString.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\ByteString.o )
[6 of 7] Compiling Text.Regex.Posix.ByteString.Lazy ( Text\Regex\Posix\ByteString\Lazy.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\ByteString\Lazy.o )
[7 of 7] Compiling Text.Regex.Posix ( Text\Regex\Posix.hs, C:\Users\devbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix.o )
C:\Users\devbox\source\repos\regex-posix [master ≡]> cabal repl --allow-newer
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- regex-posix-0.96.0.0 (lib) (ephemeral targets)
Preprocessing library for regex-posix-0.96.0.0..
GHCi, version 8.10.2: https://www.haskell.org/ghc/ :? for help
Ok, 7 modules loaded.
Prelude Text.Regex.Posix>
actually I do reproduce a linker failure..
*Text.Regex.Posix> compBlank
ghc.exe: ^^ Could not load 'hs_regex_regfree', dependency unresolved. See top entry above.
ByteCodeLink: can't find label
During interactive linking, GHCi couldn't find the following symbol:
hs_regex_regfree
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session. Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
https://www.haskell.org/ghc/reportabug
*Text.Regex.Posix> :q
Leaving GHCi.
hmm looks like in my case it's a missing flag
C:\Users\devbox\source\repos\regex-posix [master ≡]> cabal repl -f _regex-posix-clib
Resolving dependencies...
Build profile: -w ghc-8.10.2 -O1
In order, the following will be built (use -v for more details):
- regex-posix-0.96.0.0 (lib) (first run)
Preprocessing library for regex-posix-0.96.0.0..
GHCi, version 8.10.2: https://www.haskell.org/ghc/ :? for help
[1 of 7] Compiling Paths_regex_posix ( C:\Users\xbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\autogen\Paths_regex_posix.hs, interpreted )
[2 of 7] Compiling Text.Regex.Posix.Wrap ( C:\Users\xbox\source\repos\regex-posix\dist-newstyle\build\x86_64-windows\ghc-8.10.2\regex-posix-0.96.0.0\build\Text\Regex\Posix\Wrap.hs, interpreted )
[3 of 7] Compiling Text.Regex.Posix.String ( src\Text\Regex\Posix\String.hs, interpreted )
[4 of 7] Compiling Text.Regex.Posix.Sequence ( src\Text\Regex\Posix\Sequence.hs, interpreted )
[5 of 7] Compiling Text.Regex.Posix.ByteString ( src\Text\Regex\Posix\ByteString.hs, interpreted )
[6 of 7] Compiling Text.Regex.Posix.ByteString.Lazy ( src\Text\Regex\Posix\ByteString\Lazy.hs, interpreted )
[7 of 7] Compiling Text.Regex.Posix ( src\Text\Regex\Posix.hs, interpreted )
Ok, 7 modules loaded.
*Text.Regex.Posix> compBlank
CompOption 0
*Text.Regex.Posix>
I don't really use regex-posix so I don't build it directly, it's a transitive dependency of snap, but I guess that building it as a dependency shouldn't fail unconditionally.
Then again the only place I've seen it fail is on CI I first linked since I don't have a windows box at hand.
Same issue here:
regex-posix > Configuring regex-posix-0.96.0.0...
regex-posix > build
regex-posix > Preprocessing library for regex-posix-0.96.0.0..
regex-posix > compiling .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c failed (exit code 1)
regex-posix > rsp file was: ".stack-work\dist\29cc6475\build\Text\Regex\Posix\hsc8F5F.rsp"
regex-posix > command was: C:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib../mingw/bin\gcc.exe -c .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c -o .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.o -D__GLASGOW_HASKELL__=808 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include -I.stack-work\dist\29cc6475\build\cbits -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include -I.stack-work\dist\29cc6475\build\autogen -I.stack-work\dist\29cc6475\build\global-autogen -include .stack-work\dist\29cc6475\build\autogen\cabal_macros.h -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib\bytestring-0.10.10.1\include -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib\base-4.13.0.0\include -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib\integer-gmp-1.0.2.0\include -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\lib/include -IC:\Users\laarpjljvd\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4/lib/include/
regex-posix > error: Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
regex-posix > compilation terminated.
regex-posix >
@hvr mentioned to me that this may be solely a stack issue, after testing with cabal on Windows went just fine: https://cdn.discordapp.com/attachments/811635232229949460/813031168261619762/not_a_bug.png
He also mentioned that stack may not implement automatic flags properly.
The magic incantations to get stack to behave properly seem to be here: commercialhaskell/stack#5404 (comment)
Having to pass flags in standard situations is of course undesirable.
If someone finds a workaround with reasonable changes to regex-posix, please describe it here or in a PR.
P.S.: The automatic flag was introduced in 13c28e9. According to the specs [1,2] this flag should be automatically enabled on os(windows) during the search for a build plan, since the base<0 constraint prunes the configuration where the flag is off but we are under Windows.
[1] https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-flag-manual
[2] https://cabal.readthedocs.io/en/3.4/cabal-package.html#resolution-of-conditions-and-flags
According to the specs [1,2] this flag should be automatically enabled on
os(windows)during the search for a build plan, since thebase<0constraint prunes the configuration where the flag is off but we are under Windows.
Seems that stack is deliberately ignoring the base < 0 constraint, considering these output:
WARNING: Ignoring regex-posix's bounds on base (<0 && >=4.3 && <4.15); using base-4.13.0.0.
Reason: trusting snapshot over cabal file dependency information.
I am afraid this is a desired behaviour from the perspective of stack, for the constraints of some packages might have been proven too tight, and should be ignored. haskell/cabal#7293 should help if adopted.
+1, but I get the following error:
ghc.exe: unable to load package `regex-posix-0.96.0.0' ghc.exe: | C:\sr\snapshots\819b1ba9\lib\x86_64-windows-ghc-8.8.3\regex-posix-0.96.0.0-EI2FExbBi7eEhY8Y7SNqHy\HSregex-posix-0.96.0.0-EI2FExbBi7eEhY8Y7SNqHy.o: unknown symbol `regerror' ... Process exited with code: ExitFailure 1
Yeah, I got the same error ("Process exited with code: ExitFailure 1")
P.S.: The automatic flag was introduced in 13c28e9. According to the specs [1,2] this flag should be automatically enabled on
os(windows)during the search for a build plan, since thebase<0constraint prunes the configuration where the flag is off but we are under Windows.
I wonder though, why would a second line of
build-depends: regex-posix-clib == 2.7.*
not work instead of setting the unsatisfiable base<0 constraint, when all the pruning does is force the flag to be true (and thus the inclusion of the -clib dependency)?
I wonder though, why would a second line of
build-depends: regex-posix-clib == 2.7.*not work instead of setting the unsatisfiable
base<0constraint,
That's an idea worth trying!
Following @Adowrath's suggestion, I released 0.96.0.1 which should build with stack out-of-the-box even under Windows, without any extra-deps or flags. To make this work, I added regex-posix-clib-2.7 to stackage.
Why is the license of regex-posix-clib different from the rest?
regex-base BSD3
regex-compat BSD3
regex-posix BSD3
regex-posix-clib LGPL-2.1
regex-tdfa BSD3
Some companies I work with have issues with using LGPL licenses.
If possible please make it BSD3. Most companies I work with have no problems with that license.
Why is the license of regex-posix-clib different from the rest?
Because that's the incoming license of the C library it's using http://gnuwin32.sourceforge.net/packages/regex.htm.
You can't relicense away from GPL as long as that code is used. You can add an additional outbound license but only if you hold the copyright or all copyright holders agree which will be a tough road after all the copyright for the C part is held by the FSF,