building c2hs on winows
I can't get c2hs to build on windows with ghc-6.4.2 $ runhaskell.exe Setup.hs configure Setup.hs:11:57: Couldn't match `LocalBuildInfo' against `Distribution.PackageDescription.PackageDescription' Expected type: Args -> InstallFlags -> Distribution.PackageDescription.PackageDescription -> LocalBuildInfo -> IO ExitCode Inferred type: Args -> InstallFlags -> LocalBuildInfo -> IO ExitCode In the `postInst' field of a record In the record update: defaultUserHooks {postInst = addWrapperAndLib} Any ideas? Thanks, Anatoly
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
$ runhaskell.exe Setup.hs configure
Setup.hs:11:57: Couldn't match `LocalBuildInfo' against `Distribution.PackageDescription.PackageDescription' Expected type: Args -> InstallFlags -> Distribution.PackageDescription.PackageDescription -> LocalBuildInfo -> IO ExitCode Inferred type: Args -> InstallFlags -> LocalBuildInfo -> IO ExitCode In the `postInst' field of a record In the record update: defaultUserHooks {postInst = addWrapperAndLib}
Any ideas? Update the Setup.hs file with one from the darcs repository of c2hs. Then it should build
Greetings Arjan
On 7/4/06, Arjan Oosting <arjanoosting@home.nl> wrote:
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
$ runhaskell.exe Setup.hs configure
Setup.hs:11:57: Couldn't match `LocalBuildInfo' against `Distribution.PackageDescription.PackageDescription' Expected type: Args -> InstallFlags -> Distribution.PackageDescription.PackageDescription -> LocalBuildInfo -> IO ExitCode Inferred type: Args -> InstallFlags -> LocalBuildInfo -> IO ExitCode In the `postInst' field of a record In the record update: defaultUserHooks {postInst = addWrapperAndLib}
Any ideas? Update the Setup.hs file with one from the darcs repository of c2hs. Then it should build
I get a little farther, but it still doesn't work: # runhaskell.exe Setup.hs configure Configuring c2hs-0.14.5... configure: Dependency base-any: using base-1.0 configure: Dependency haskell98-any: using haskell98-1.0 configure: Using install prefix: C:\Program Files configure: Binaries installed in: C:\Program Files\c2hs-0.14.5 configure: Libraries installed in: C:\Program Files\Haskell\c2hs-0.14.5\ghc-6.4.2 configure: Private binaries installed in: C:\Program Files\c2hs-0.14.5 configure: Data files installed in: C:\Program Files\c2hs-0.14.5 configure: Using compiler: c:\ghc\ghc-6.4.2\bin\ghc.exe configure: Compiler flavor: GHC configure: Compiler version: 6.4.2 configure: Using package tool: c:\ghc\ghc-6.4.2\bin\ghc-pkg.exe configure: Using ar found on system at: C:\util\bin\ar.exe configure: No haddock found configure: No pfesetup found configure: Using ranlib found on system at: C:\util\bin\ranlib.exe configure: Using runghc found on system at: c:\ghc\ghc-6.4.2\bin\runghc.exe configure: No runhugs found configure: No happy found configure: No alex found configure: Using hsc2hs: c:\ghc\ghc-6.4.2\bin\hsc2hs.exe configure: No c2hs found configure: No cpphs found configure: No greencard found Setup.hs: Cannot find: sh anatolyy@ANATOLYY ~/math/c2hs-0.14.5 # runhaskell.exe Setup.hs build Preprocessing executables for c2hs-0.14.5... Setup.hs: can't find source for C2HSConfig in ["base\\admin","base\\errors","base\\general","base\\graphs","base\\state","base\\syms","base\\syntax","c2hs\\c","c2hs\\chs","c2hs\\gen","c2hs\\state","c2hs\\toplevel"] Anatoly
On Wed, 2006-07-05 at 20:58 -0700, Anatoly Yakovenko wrote:
On 7/4/06, Arjan Oosting <arjanoosting@home.nl> wrote:
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
I get a little farther, but it still doesn't work:
Actually, c2hs's setup is doing something that only works on unix. In fact it doesn't even always work on unix. For the Gentoo ebuild we changed it because it doesn't work in the context of installing into a temp dir. A temporary hack is to change the Setup.hs to be just: import Distribution.Simple main = defaultMain it means that c2hs's --copy-library feature will not work but everything else should. We'll have to look into doing that in a more portable way. Duncan
On Thu, 2006-07-06 at 10:30 +0100, Duncan Coutts wrote:
On Wed, 2006-07-05 at 20:58 -0700, Anatoly Yakovenko wrote:
On 7/4/06, Arjan Oosting <arjanoosting@home.nl> wrote:
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
I get a little farther, but it still doesn't work:
Actually, c2hs's setup is doing something that only works on unix. In fact it doesn't even always work on unix. For the Gentoo ebuild we changed it because it doesn't work in the context of installing into a temp dir.
A temporary hack is to change the Setup.hs to be just:
import Distribution.Simple main = defaultMain
it means that c2hs's --copy-library feature will not work but everything else should. We'll have to look into doing that in a more portable way.
Actually it turns out the c2hs is doing a lot of things that are not portable to windows. It'll need some effort to fix. Any helpers? Duncan
Duncan Coutts:
On Thu, 2006-07-06 at 10:30 +0100, Duncan Coutts wrote:
On Wed, 2006-07-05 at 20:58 -0700, Anatoly Yakovenko wrote:
On 7/4/06, Arjan Oosting <arjanoosting@home.nl> wrote:
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
I get a little farther, but it still doesn't work:
Actually, c2hs's setup is doing something that only works on unix. In fact it doesn't even always work on unix. For the Gentoo ebuild we changed it because it doesn't work in the context of installing into a temp dir.
A temporary hack is to change the Setup.hs to be just:
import Distribution.Simple main = defaultMain
it means that c2hs's --copy-library feature will not work but everything else should. We'll have to look into doing that in a more portable way.
With the latest Cabal (as included in recent GHC), the postInst.sh (which is the problem) can be rewritten in Haskell and added to Setup.hs directly. That should remove this particular problem (but will of course mean that c2hs doesn't work anymore with earlier versions of Cabal, but that is probably secondary).
Actually it turns out the c2hs is doing a lot of things that are not portable to windows. It'll need some effort to fix. Any helpers?
What else apart from pathname separators? It'd be great if somebody could look into that. Manuel
On Thu, 2006-07-06 at 11:35 -0400, Manuel M T Chakravarty wrote:
Duncan Coutts:
On Thu, 2006-07-06 at 10:30 +0100, Duncan Coutts wrote:
On Wed, 2006-07-05 at 20:58 -0700, Anatoly Yakovenko wrote:
On 7/4/06, Arjan Oosting <arjanoosting@home.nl> wrote:
Op di, 04-07-2006 te 09:09 -0700, schreef Anatoly Yakovenko:
I can't get c2hs to build on windows with ghc-6.4.2
I get a little farther, but it still doesn't work:
Actually, c2hs's setup is doing something that only works on unix. In fact it doesn't even always work on unix. For the Gentoo ebuild we changed it because it doesn't work in the context of installing into a temp dir.
A temporary hack is to change the Setup.hs to be just:
import Distribution.Simple main = defaultMain
it means that c2hs's --copy-library feature will not work but everything else should. We'll have to look into doing that in a more portable way.
With the latest Cabal (as included in recent GHC), the postInst.sh (which is the problem) can be rewritten in Haskell and added to Setup.hs directly. That should remove this particular problem (but will of course mean that c2hs doesn't work anymore with earlier versions of Cabal, but that is probably secondary).
Actually it turns out the c2hs is doing a lot of things that are not portable to windows. It'll need some effort to fix. Any helpers?
What else apart from pathname separators? It'd be great if somebody could look into that.
The use of configure(.in) is the main problem. Most Windows users do not have mingw/cygwin. I've been looking through what c2hs uses configure for and what portable replacements there are: * for finding the os and arch in c2hs/toplevel/C2HSConfig.hs.in for the platform spec system. Perhaps this could be replaced with System.Info.{os,arch} ? * finding the temp dir. this is not actually used anywhere. * substituting the c2hs version into the Version.hs module. This can be replaced with Cabal's new Path_c2hs.hs feature. The postinst.sh could be eliminated entirely. All it's used for is finding the location where a data file was installed. This can now be found using Cabal's new Path_c2hs.hs feature. Cabal generates that module which provides a portable way of finding the location of data files. Also the field 'Data-Files:' can be added to the c2hs.cabal file to specify extra data files that need to be installed. So I think the only things left are finding the copyright notice and a couple other items that are kept centrally in the c2hs.cabal file. For the moment they could perhaps just be duplicated. I've got a suggestion for how to deal with that case better in future which I posted to the cabal-devel list: http://www.haskell.org//pipermail/cabal-devel/2006-July/000027.html The configure script is also used for the the makefile in the docs directory and the rpm spec file. I'm not sure how to deal with those, but perhaps they're not so important and we could live with those using a unix-specific mechanism (since they need rpm or latex anyway). Duncan
Duncan wrote,
Actually it turns out the c2hs is doing a lot of things that are not portable to windows. It'll need some effort to fix. Any helpers?
What else apart from pathname separators? It'd be great if somebody could look into that.
The use of configure(.in) is the main problem. Most Windows users do not have mingw/cygwin.
I've been looking through what c2hs uses configure for and what portable replacements there are:
* for finding the os and arch in c2hs/toplevel/C2HSConfig.hs.in for the platform spec system. Perhaps this could be replaced with System.Info.{os,arch} ?
If it is sufficiently accurate. The handling of bitfields (paddings) etc depends on the os/arch and we need to know which conventions to use. Another problem is that the current approach allows cross-compilation (in configure you can specify an os/arch, rather than query). We need to support cross-compilation somehow (eg, Tony Sloane needed it for generating bindings for the PalmPilot).
* finding the temp dir. this is not actually used anywhere.
Yes, that may be obsolete now.
* substituting the c2hs version into the Version.hs module. This can be replaced with Cabal's new Path_c2hs.hs feature.
My plan was to use VersionTool for c2hs anyway. That does the version thing and integrates nicely with darcs: http://www.cse.unsw.edu.au/~chak/haskell/VersionTool/
The postinst.sh could be eliminated entirely. All it's used for is finding the location where a data file was installed. This can now be found using Cabal's new Path_c2hs.hs feature. Cabal generates that module which provides a portable way of finding the location of data files. Also the field 'Data-Files:' can be added to the c2hs.cabal file to specify extra data files that need to be installed.
postInst.sh was only meant as a stop gap measure with older Cabal. It should definitely go.
So I think the only things left are finding the copyright notice and a couple other items that are kept centrally in the c2hs.cabal file. For the moment they could perhaps just be duplicated. I've got a suggestion for how to deal with that case better in future which I posted to the cabal-devel list: http://www.haskell.org//pipermail/cabal-devel/2006-July/000027.html
Ah! Interesting. Issac was wondering whether VersionTool should be integrated with Cabal. That's kind of what you propose. It would certainly be nice to have it integrated (esp, as Cabal parses the Cabal file anyways, as you note). I am not so sure about the darcs features of VersionTool (as in, not sure how people would feel about having them in Cabal), but maybe they can be optional in some way (eg, something that may be activated via some specification in Setup.hs). Manuel
participants (4)
-
Anatoly Yakovenko -
Arjan Oosting -
Duncan Coutts -
Manuel M T Chakravarty