Ian Ross | 19 Apr 13:34 2014
Picon

Version 0.17.2 and Regression Suite

Dear All,

I've just released version 0.17.2 of C2HS to Hackage.  This fixes a number of regressions that were introduced in the last couple of releases.  In particular, the cuda and hsndfile packages should now build correctly.

To follow up on my recent request for packages for a regression suite for C2HS, I've now implemented this, so that on every commit Travis builds C2HS then tries to install a set of "typical" packages (see below).  This should hopefully help to reduce the chances of these kinds of regressions in future.  The regression suite is driven off a little YAML configuration file and can perform various setup steps before building the regression packages (mostly installing packages using apt-get, although the setup for CUDA is a little more complicated).

Note that the regression suite only installs these test packages -- it doesn't run their tests -- and so far, this is for Linux packages only.  Someone asked me about a MacOS package, and I presume that it ought to be possible to set up a multi-platform regression suite, but I have no MacOS machine to test these things on myself and I don't know how to force Travis to use a MacOS host for Haskell builds.  I'd be happy to hear any ideas, and I'd also be happy to hear of any other candidate packages for regression testing.

Cheers,

Ian.


Current regression suite packages: CV, gnome-keyring, hnetcdf, hpuz, hsndfile, hsqml, igraph, cuda, cufft, OpenCL

--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
<div><div dir="ltr">Dear All,<div><br></div>
<div>I've just released version 0.17.2 of C2HS to Hackage. &nbsp;This fixes a number of regressions that were introduced in the last couple of releases. &nbsp;In particular, the cuda and hsndfile packages should now build correctly.</div>
<div><br></div>
<div>To follow up on my recent request for packages for a regression suite for C2HS, I've now implemented this, so that on every commit Travis builds C2HS then tries to install a set of "typical" packages (see below). &nbsp;This should hopefully help to reduce the chances of these kinds of regressions in future. &nbsp;The regression suite is driven off a little YAML configuration file and can perform various setup steps before building the regression packages (mostly installing packages using apt-get, although the setup for CUDA is a little more complicated).</div>
<div><br></div>
<div>Note that the regression suite only installs these test packages -- it doesn't run their tests -- and so far, this is for Linux packages only. &nbsp;Someone asked me about a MacOS package, and I presume that it ought to be possible to set up a multi-platform regression suite, but I have no MacOS machine to test these things on myself and I don't know how to force Travis to use a MacOS host for Haskell builds. &nbsp;I'd be happy to hear any ideas, and I'd also be happy to hear of any other candidate packages for regression testing.</div>
<div><br></div>
<div>Cheers,</div>
<div><br></div>
<div>Ian.</div>
<div><br></div>
<div><br></div>
<div>Current regression suite packages:&nbsp;CV, gnome-keyring, hnetcdf, hpuz, hsndfile, hsqml, igraph, cuda, cufft, OpenCL<br clear="all"><div><br></div>-- <br>Ian Ross &nbsp; Tel: +43(0)6804451378 &nbsp; <a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a> &nbsp; <a href="http://www.skybluetrades.net" target="_blank">www.skybluetrades.net</a>
</div>
</div></div>
Ian Ross | 1 Apr 12:39 2014
Picon

Request to C2HS users

Dear All,

I'm trying to make a list of packages that depend on C2HS, in order to make a regression suite to test new releases.  I slightly broke things in the last release and only found out about it when people started reporting regressions when trying to build packages that use C2HS.  The number of moving parts involved make it difficult to write a test suite with full coverage, so the best approach seems to be to make a list of packages and make sure that these all build before doing a release.

I've not been able to figure out a way to do reverse dependency searches on Hackage for build tools, hence the email.

If you have a package that uses C2HS that you'd like added to the regression suite, let me know.

Cheers,

Ian.

--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
<div><div dir="ltr">Dear All,<div><br></div>
<div>I'm trying to make a list of packages that depend on C2HS, in order to make a regression suite to test new releases. &nbsp;I slightly broke things in the last release and only found out about it when people started reporting regressions when trying to build packages that use C2HS. &nbsp;The number of moving parts involved make it difficult to write a test suite with full coverage, so the best approach seems to be to make a list of packages and make sure that these all build before doing a release.</div>
<div><br></div>
<div>I've not been able to figure out a way to do reverse dependency searches on Hackage for build tools, hence the email.</div>
<div><br></div>
<div>If you have a package that uses C2HS that you'd like added to the regression suite, let me know.</div>
<div><br></div>
<div>Cheers,</div>
<div><br></div>
<div>Ian.</div>
<div>
<div><br></div>-- <br>Ian Ross &nbsp; Tel: +43(0)6804451378 &nbsp; <a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a> &nbsp; <a href="http://www.skybluetrades.net" target="_blank">www.skybluetrades.net</a>
</div>
</div></div>
Ian Ross | 19 Feb 22:01 2014
Picon

Building C2HS on Win64

Dear all,

There's an issue open on C2HS (https://github.com/haskell/c2hs/issues/55) about building on Win64 that I think may be defunct, but I don't have a Windows machine to test it on.

Is there anyone with 5 minutes and a Windows machine who can try a build of GitHub HEAD?  It looks like the problem is related to Cabal running Cygwin's version of strip instead of Mingw's.

If anyone has the time to look at this, I'd appreciate it!

Thanks a lot,

Ian.

--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
<div><div dir="ltr">Dear all,<div><br></div>
<div>There's an issue open on C2HS (<a href="https://github.com/haskell/c2hs/issues/55">https://github.com/haskell/c2hs/issues/55</a>) about building on Win64 that I think may be defunct, but I don't have a Windows machine to test it on.</div>
<div><br></div>
<div>Is there anyone with 5 minutes and a Windows machine who can try a build of GitHub HEAD? &nbsp;It looks like the problem is related to Cabal running Cygwin's version of strip instead of Mingw's.</div>
<div><br></div>
<div>If anyone has the time to look at this, I'd appreciate it!</div>
<div><br></div>
<div>Thanks a lot,</div>
<div><br></div>
<div>Ian.<br clear="all"><div><br></div>-- <br>Ian Ross &nbsp; Tel: +43(0)6804451378 &nbsp; <a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a> &nbsp; <a href="http://www.skybluetrades.net" target="_blank">www.skybluetrades.net</a>
</div>
</div></div>
Thomas Strobel | 8 Jul 14:08 2013
Picon
Picon

c2hs extracts "Ptr ()" instead of pointer hook name

Dear All,

I'm trying to write a FFI for the Enlightenment Foundation Libraries,
but my small example of a binding fails to compile, and I wanted to ask
if someone would have some advice for me how to make c2hs extract the
correct bindings.

Many thanks in advance!

  Thomas

My program's code is:

{-# LANGUAGE ForeignFunctionInterface #-}

import Foreign.Ptr
#include <Ecore_Evas.h>

{#pointer *Ecore_Evas as EcoreEvas newtype#}
{#pointer *Evas as Evas newtype#}

{#fun ecore_evas_get {id `EcoreEvas'} -> `Evas' id#}

The signature of the C function is:
https://build.enlightenment.org/job/nightly_efl_gcc_x86_64/lastSuccessfulBuild/artifact/doc/html/group__Ecore__Evas__Group.html#ga21b6108d757f0aea6c4126d59cfb8826

The trace of c2hs is:

-C "-I/usr/local/include/ecore-1" -C "-I/usr/local/include/ecore-evas-1"
-C "-I/usr/local/include/evas-1" -C "-I/usr/local/include/efl-1" -C
"-I/usr/local/include/eina-1" -C "-I/usr/local/include/eina-1/eina" -C
"-I/usr/local/include/eo-1" 
** Pointer hook:
found C declaration for `Ecore_Evas'
extractCompType: checking for alias
extracted ptr type is `()'
associated with Haskell entity `EcoreEvas'
having type ()
** Pointer hook:
found C declaration for `Eo'
extractCompType: checking for alias
extracted ptr type is `()'
associated with Haskell entity `Evas'
having type ()
** Fun hook for `get':
Entering `extractSimpleType' (for a result)...
extractCompType: explicit pointer type
extractCompType: checking for alias
extractCompType: found an alias called `Evas'
extractCompType: checking for alias
extractCompType: found an alias called `Eo'
extractCompType: checking for alias
Entering `extractSimpleType' (not for a result)...
extractCompType: explicit pointer type
Imported function type: ((EcoreEvas) -> (IO (Ptr ())))
Entering `extractSimpleType' (for a result)...
extractCompType: explicit pointer type
extractCompType: checking for alias
extractCompType: found an alias called `Evas'
extractCompType: checking for alias
extractCompType: found an alias called `Eo'
extractCompType: checking for alias
Entering `extractSimpleType' (not for a result)...
extractCompType: explicit pointer type
Marshalling specification including defaults: 
  id `EcoreEvas' void-
  void- `Evas' id
  The marshalling is pure.

The compilation of the generated .hs-file fails with:

[1 of 1] Compiling Evas             ( Evas.hs, Evas.o )

Evas.chs:22:11:
    Couldn't match expected type `Evas' with actual type `Ptr ()'
    In the first argument of `return', namely `(res')'
    In the expression: return (res')
    In the expression: let res' = id res in return (res')

Philipp Balzarek | 2 May 22:09 2013

add addrof directive (was: ptrto)

{#addrof <path> #} retrieves the address of a field of a c
structure, following <path>. It behaves much like get or set, but
instead of marshalling the target it returns a pointer to it.
This is useful e.g. when the associated Haskell type doesn't
have a Storable instance, for example SockAddr.

See also: http://www.haskell.org/pipermail/c2hs/2013-March/001113.html
Attachment (addrof.patch): text/x-patch, 10 KiB
{#addrof <path> #} retrieves the address of a field of a c
structure, following <path>. It behaves much like get or set, but
instead of marshalling the target it returns a pointer to it.
This is useful e.g. when the associated Haskell type doesn't
have a Storable instance, for example SockAddr.

See also: http://www.haskell.org/pipermail/c2hs/2013-March/001113.html
c2hs | 10 Apr 20:21 2013

[c2hs] #55: `strip: unable to rename 'c2hs.exe'; reason: File exists`

#55: `strip: unable to rename 'c2hs.exe'; reason: File exists`
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  defect                                         
   Status:  new     |    Priority:  normal                                         
Milestone:          |   Component:  general                                        
  Version:  0.16.2  |    Keywords:  strip rename file configure setup mingw windows
--------------------+-------------------------------------------------------
 I'm currently trying to build c2hs (v 0.16.4) from the cabal source
 package from HackageDB on a Win64 system.

 == TERMINAL LOG ==

 PS .> cabal install
 Resolving dependencies...
 Configuring c2hs-0.16.4...
 Preprocessing executables for c2hs-0.16.4...
 Building c2hs-0.16.4...
 Linking dist\build\c2hs\c2hs.exe ...
 Installing executable(s) in C:\Users\##\AppData\Roaming\cabal\bin
 C:\prog-x86\MinGW\bin\strip.exe: unable to rename
 'C:\Users\##\AppData\Roaming\cabal\bin\c2hs.exe'; r
 eason: File exists
 cabal.exe: Error: some packages failed to install:
 c2hs-0.16.4 failed during the final install step. The exception was:
 ExitFailure 1

 == SETUP CONFIG - CONCERNING STRIP ==
 ("strip", ConfiguredProgram {programId = "strip", programVersion =
 Nothing, programDefaultArgs = [], programOverrideArgs = [],
 programLocation = FoundOnSystem {locationPath =
 "C:\\prog-x86\\MinGW\\bin\\strip.exe"}})

 I hope I included enough information to make it possible to solve this
 bug. Comment if you need anything.

 Thanks.

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/55>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell

General Failure | 30 Mar 15:59 2013

darcs patch: add ptrto directive

1 patch for repository http://code.haskell.org/c2hs:

Sun Mar 24 16:21:29 CET 2013  p.balzarek <at> googlemail.com
  * add ptrto directive

{#ptrto <path> #} creates a pointer into a c structure, following
<path>. It behaves much like get or set, but instead of marshalling the
target it returns a pointer to it.
This is useful e.g. when the associated Haskell type doesn't
have a Storable instance, for example SockAddr.

Attachment (ptrto.patch): application/octet-stream, 12 KiB
<div><p>1 patch for repository <a href="http://code.haskell.org/c2hs">http://code.haskell.org/c2hs</a>:<br><br>Sun Mar 24 16:21:29 CET 2013&nbsp; <a href="mailto:p.balzarek <at> googlemail.com">p.balzarek <at> googlemail.com</a><br>&nbsp; * add ptrto directive<br><br>{#ptrto &lt;path&gt; #} creates a pointer into a c structure, following<br>&lt;path&gt;. It behaves much like get or set, but instead of marshalling the<br>target it returns a pointer to it. <br>This is useful e.g. when the associated Haskell type doesn't<br>
have a Storable instance, for example SockAddr.<br></p></div>
c2hs | 9 Feb 04:41 2013

Re: [c2hs] #7: compile gtk2hs failed under locale zh_CN.utf8

#7: compile gtk2hs failed under locale zh_CN.utf8
---------------------+------------------------------------------------------
 Reporter:  duncan   |       Owner:        
     Type:  defect   |      Status:  new   
 Priority:  normal   |   Milestone:        
Component:  general  |     Version:  0.15.1
 Keywords:           |  
---------------------+------------------------------------------------------

Comment(by duncan):

 The latest darcs version may fix this. It uses the latest language-c which
 when built with alex 3 may handle the unicode correctly. Worth someone
 trying and confirming.

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/7#comment:2>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell

c2hs | 18 Oct 00:59 2012

[c2hs] #54: Allow referring to 'struct foo' identifiers from {#sizeof} {#get} and friends

#54: Allow referring to 'struct foo' identifiers from {#sizeof} {#get} and
friends
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  defect 
   Status:  new     |    Priority:  normal 
Milestone:          |   Component:  general
  Version:  0.16.0  |    Keywords:         
--------------------+-------------------------------------------------------
 C maintains separate namespaces for 'struct foo' and 'typedef ... foo',
 and at present c2hs only references the latter namespace.  This is
 annoying if a library author didn't add typedefs to allow eliding the
 'struct' keyword from type definitions; we have to re-typedef everything
 we want to use from c2hs. It would be convenient if we could write {#get
 struct foo->bar #} or similar.  Note that pointer appears to look in both
 namespaces, so I don't know what's going on there. -- ezyang

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/54>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell

c2hs | 9 Oct 14:33 2012

[c2hs] #53: Cabal Install failed with ghc 7.6.1

#53: Cabal Install failed with ghc 7.6.1
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  defect 
   Status:  new     |    Priority:  normal 
Milestone:          |   Component:  general
  Version:  0.16.2  |    Keywords:         
--------------------+-------------------------------------------------------
 Fail to install using ghc 7.6.1.
 Two changes are needed, but I don't know if backward compatible.

 Émeric

 diff -r c2hs-0.16.3_bu/src/C2HS/Config.hs c2hs-0.16.3/src/C2HS/Config.hs
 40c40
 < import Foreign.C (CInt)
 ---
 > import Foreign.C (CInt(..))
 diff -r c2hs-0.16.3_bu/src/Control/StateTrans.hs
 c2hs-0.16.3/src/Control/StateTrans.hs
 75a76
 > import System.IO.Error(catchIOError)
 299c300
 <             `catch` (\err -> let
 ---
 >             `catchIOError` (\err -> let

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/53>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell

_______________________________________________
C2hs mailing list
C2hs <at> haskell.org
http://www.haskell.org/mailman/listinfo/c2hs
c2hs | 8 Oct 05:55 2012

[c2hs] #52: Parenthesize types in bindings, to allow function types without parentheses

#52: Parenthesize types in bindings, to allow function types without parentheses
--------------------+-------------------------------------------------------
 Reporter:  guest   |        Type:  defect 
   Status:  new     |    Priority:  normal 
Milestone:          |   Component:  general
  Version:  0.16.0  |    Keywords:         
--------------------+-------------------------------------------------------
 c2hs allows arbitrary types in function bindings.  However, a function
 type such as {{{T1 -> T2}}} will cause the generated code to parse
 incorrectly; since c2hs does not parenthesize each argument type, the
 argument and return types of the function type will parse as multiple
 arguments of the binding type, rather than as a single argument of
 function type.  The binding can work around this by explicitly
 parenthesizing the function type, but since c2hs already requires quoting
 the entire type, the need for parentheses does not become apparent without
 reading the generated code (or encountering a compile error).

 Add parentheses around the types in bindings, so that unparenthesized
 function types as arguments will parse correctly.

 {{{
 diff -rN -u old-c2hs/src/C2HS/Gen/Bind.hs new-c2hs/src/C2HS/Gen/Bind.hs
 --- old-c2hs/src/C2HS/Gen/Bind.hs       2012-10-07 20:49:16.773294894
 -0700
 +++ new-c2hs/src/C2HS/Gen/Bind.hs       2012-10-07 20:49:16.789294705
 -0700
  <at>  <at>  -913,8 +913,8  <at>  <at> 
          ctxt   = case octxt of
                     Nothing      -> ""
                     Just ctxtStr -> ctxtStr ++ " => "
 -        argTys = [ty | CHSParm im ty _ _  _ <- parms'      , notVoid im]
 -        resTys = [ty | CHSParm _  ty _ om _ <- parm':parms', notVoid om]
 +        argTys = ["(" ++ ty ++ ")" | CHSParm im ty _ _  _ <- parms'
 , notVoid im]
 +        resTys = ["(" ++ ty ++ ")" | CHSParm _  ty _ om _ <-
 parm':parms', notVoid om]
          resTup = let
                     (lp, rp) = if isPure && length resTys == 1
                                then ("", "")
 }}}

--

-- 
Ticket URL: <http://hackage.haskell.org/trac/c2hs/ticket/52>
c2hs <http://www.cse.unsw.edu.au/~chak/haskell/c2hs/>
C->Haskell, An Interface Generator for Haskell


Gmane