Michael Jones | 6 Aug 23:51 2014

How to marshall variable length out array

I have an almost working marshaling of a C function and need help. The problem is the resulting hs does not
pass the length to allocaArray and peekArray. What I want to happen is to use data_in_length to control the
size of data created and peeked from. I am providing a hand adjusted hs to show what I want it to do, and asking
if anyone knows how to write the hook to generate the small change.

Note that the C is a wrapper around another library, so I can adjust the C signature if there is an easier
signature structure to hook.

Also note that data_in means data in from an I2C device. From the function point of view, it is really data
being returned to the caller, where the caller specifies the amount of data requested.

The C:

int32_t ww_i2c_read_ext (
    int32_t          aardvark,
    uint16_t         slave_addr,
    I2cFlags         flags,
    uint8_t         *data_in,
    uint16_t         data_in_length,
    uint16_t        *num_read

The hook that is almost correct:

{#fun unsafe ww_i2c_read as i2cRead
   {`Int', fromIntegral `CUShort', fromI2cFlags `I2cFlags', allocaArray- `[CUChar]' peekArray*,
fromIntegral `CUShort'} -> `Int’#}

The incorrect result:

i2cRead :: Int -> CUShort -> I2cFlags -> CUShort -> IO (Int, [CUChar])
(Continue reading)

Ian Ross | 19 May 17:24 2014
Picon

Re: Request to C2HS users

No, nothing as clever as that.  I took the strictly low-rent route of only testing that the regression suite packages successfully build.  I don't run the package test suites, so I don't need to run any CUDA code.  What I'd been finding was that most of the problems I'd been seeing with C2HS were things that would be picked up just by trying to build the packages -- out of all the problems I've seen recently, all of them were either related to problems parsing C headers or the CHS files themselves, or to generating invalid Haskell code.  I've yet to see a single problem where C2HS generates Haskell code that compiles but doesn't work.  Also, I didn't even know that such a thing as a CUDA emulator existed!  Now that I do, maybe I'll experiment a bit when I have time and see if I can run the regression suite package test cases as well...


On 19 May 2014 17:15, Ryan Newton <rrnewton <at> gmail.com> wrote:
Oh, did you use a CUDA emulator on Travis?  (What is the best one these days?)



On Sat, May 17, 2014 at 12:55 AM, Ian Ross <ian <at> skybluetrades.net> wrote:
Thanks Ryan,

I got the cuda package (and cufft and OpenCL) building on Travis without too much trouble, after a bit of experimentation on an EC2 instance with the same Linux build as Travis uses.  It was easier than I thought it would be, and the CUDA installation process seems to be getting easier over time, so supporting this sort of thing for newer versions of CUDA should be easy.

Cheers,

Ian.



On 16 May 2014 07:59, Ryan Newton <rrnewton <at> gmail.com> wrote:
Hi all,

Sorry for long-delayed response.

Yes, some of our jobs do happen to install accelerate-cuda (like this one, and this one).  We don't have a dedicated set of tests for accelerate-cuda itself.  (But we should soon.  I hope to test all backend ends uniformly.)

We have a pretty heterogeneous config in terms of cuda installs.  Most of our tests run on a set of machines that still have CUDA 4.2, but my own work-station and laptop have 5.5.

Cheers,
  -Ryan



On Tue, Apr 15, 2014 at 12:22 AM, Manuel M T Chakravarty <chak <at> cse.unsw.edu.au> wrote:
Hi Ian,

We haven’t build the cuda package in a CI environment, but Ryan Newton has Accelerate in on a CI server.

Ryan, are you building with the CUDA backend?

Ian, I’m not sure what you mean by CUDA version 6. I believe the latest CUDA release from NVIDIA is 5.5.

Cheers,
Manuel

Hi Manuel (and/or Trevor!),

Have you had any luck in building CUDA on Travis or any other CI environment?  I've not managed to build it on my desktop machine, but that's mostly due to not having an NVIDIA card and to being on Arch Linux, where the current CUDA install is version 6 instead of 5...  This C2HS regression suite idea has already turned out to be useful, catching a couple of silly little bugs I'd introduced, and I'd really like to include as many packages as possible, and to have it run as a CI test.

I'll have a try on Travis myself, but it would be useful to know if you've already figured out what's needed.

Thanks,

Ian.



On 2 April 2014 06:43, Manuel M T Chakravarty <chak <at> cse.unsw.edu.au> wrote:
Good plan! Please include 


Manuel


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.
_______________________________________________
C2hs mailing list
C2hs <at> haskell.org
http://www.haskell.org/mailman/listinfo/c2hs




--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
_______________________________________________
C2hs mailing list
C2hs <at> haskell.org
http://www.haskell.org/mailman/listinfo/c2hs





--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net




--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
<div>
<div dir="ltr">No, nothing as clever as that. &nbsp;I took the strictly low-rent route of only testing that the regression suite packages successfully build. &nbsp;I don't run the package test suites, so I don't need to run any CUDA code. &nbsp;What I'd been finding was that most of the problems I'd been seeing with C2HS were things that would be picked up just by trying to build the packages -- out of all the problems I've seen recently, all of them were either related to problems parsing C headers or the CHS files themselves, or to generating invalid Haskell code. &nbsp;I've yet to see a single problem where C2HS generates Haskell code that compiles but doesn't work. &nbsp;Also, I didn't even know that such a thing as a CUDA emulator existed! &nbsp;Now that I do, maybe I'll experiment a bit when I have time and see if I can run the regression suite package test cases as well...</div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On 19 May 2014 17:15, Ryan Newton <span dir="ltr">&lt;<a href="mailto:rrnewton <at> gmail.com" target="_blank">rrnewton <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div dir="ltr">Oh, did you use a CUDA emulator on Travis? &nbsp;(What is the best one these days?)<div><br></div>
</div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Sat, May 17, 2014 at 12:55 AM, Ian Ross <span dir="ltr">&lt;<a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div dir="ltr">Thanks Ryan,<div><br></div>
<div>I got the cuda package (and cufft and OpenCL) building on Travis without too much trouble, after a bit of experimentation on an EC2 instance with the same Linux build as Travis uses. &nbsp;It was easier than I thought it would be, and the CUDA installation process seems to be getting easier over time, so supporting this sort of thing for newer versions of CUDA should be easy.</div>

<div><br></div>
<div>Cheers,</div>
<div><br></div>
<div>Ian.</div>
<div><br></div>
</div>
<div><div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On 16 May 2014 07:59, Ryan Newton <span dir="ltr">&lt;<a href="mailto:rrnewton <at> gmail.com" target="_blank">rrnewton <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div dir="ltr">Hi all,<div><br></div>
<div>Sorry for long-delayed response.</div>
<div><br></div>
<div>Yes, some of our jobs do happen to install accelerate-cuda (<a href="http://tester-lin.soic.indiana.edu:8080/job/accelerate-multidev/229/" target="_blank">like this one</a>, and <a href="http://tester-lin.soic.indiana.edu:8080/job/HackageReleased_meta-par-accelerate_CUDA/501/JENKINS_GHC=7.6.3,label=linux-cuda/console" target="_blank">this one</a>). &nbsp;We don't have a dedicated set of tests for accelerate-cuda itself. &nbsp;(But we should soon. &nbsp;I hope to test all backend ends uniformly.)</div>

<div><br></div>
<div>We have a pretty heterogeneous config in terms of cuda installs. &nbsp;Most of our tests run on a set of machines that still have CUDA 4.2, but my own work-station and laptop have 5.5.</div>
<div><br></div>

<div>
Cheers,</div>
<div>&nbsp; -Ryan</div>
<div><br></div>
</div>
<div><div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 12:22 AM, Manuel M T Chakravarty <span dir="ltr">&lt;<a href="mailto:chak <at> cse.unsw.edu.au" target="_blank">chak <at> cse.unsw.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote"><div>
<div>Hi Ian,</div>
<div><br></div>
<div>We haven&rsquo;t build the cuda package in a CI environment, but Ryan Newton has Accelerate in on a CI server.</div>

<div><br></div>
<div>Ryan, are you building with the CUDA backend?</div>
<div><br></div>
<div>Ian, I&rsquo;m not sure what you mean by CUDA version 6. I believe the latest CUDA release from NVIDIA is 5.5.</div>
<div><br></div>
<div>

Cheers,</div>
<div>Manuel</div>
<br><div>
<div>Ian Ross &lt;<a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a>&gt;:</div>
<blockquote type="cite">
<div dir="ltr">Hi Manuel (and/or Trevor!),<div><br></div>
<div>Have you had any luck in building CUDA on Travis or any other CI environment? &nbsp;I've not managed to build it on my desktop machine, but that's mostly due to not having an NVIDIA card and to being on Arch Linux, where the current CUDA install is version 6 instead of 5... &nbsp;This C2HS regression suite idea has already turned out to be useful, catching a couple of silly little bugs I'd introduced, and I'd really like to include as many packages as possible, and to have it run as a CI test.</div>

<div><br></div>
<div>I'll have a try on Travis myself, but it would be useful to know if you've already figured out what's needed.</div>
<div><br></div>
<div>Thanks,</div>
<div><br></div>
<div>Ian.</div>
<div><br></div>

</div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On 2 April 2014 06:43, Manuel M T Chakravarty <span dir="ltr">&lt;<a href="mailto:chak <at> cse.unsw.edu.au" target="_blank">chak <at> cse.unsw.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote"><div>Good plan! Please include&nbsp;<div><br></div>
<div>&nbsp;&nbsp;<a href="http://hackage.haskell.org/package/cuda" target="_blank">http://hackage.haskell.org/package/cuda</a>
</div>

<div><br></div>
<div>Manuel</div>
<div><br></div>
<div>Ian Ross &lt;<a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a>&gt;:</div>
<div>
<div>
<br><blockquote type="cite">
<div><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>
<span><div>
<div><br></div>-- <br>Ian Ross &nbsp; Tel: <a href="tel:%2B43%280%296804451378" value="+436804451378" target="_blank">+43(0)6804451378</a> &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></span>
</div></div></div>
<span><div>
_______________________________________________<br>C2hs mailing list<br><a href="mailto:C2hs <at> haskell.org" target="_blank">C2hs <at> haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/c2hs" target="_blank">http://www.haskell.org/mailman/listinfo/c2hs</a><br>
</div></span>
</blockquote>
</div>
<span><br></span>
</div>
</div></blockquote>
</div>
<span><br><br clear="all"><div><br></div>-- <br>Ian Ross &nbsp; Tel: <a href="tel:%2B43%280%296804451378" value="+436804451378" target="_blank">+43(0)6804451378</a> &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>
</span>
</div>
<span>
_______________________________________________<br>C2hs mailing list<br><a href="mailto:C2hs <at> haskell.org" target="_blank">C2hs <at> haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/c2hs" target="_blank">http://www.haskell.org/mailman/listinfo/c2hs</a><br></span>
</blockquote>
</div>
<br>
</div></blockquote>
</div>
<br>
</div>
</div></div>
</blockquote>
</div>
<br><br clear="all"><div><br></div>-- <br>Ian Ross &nbsp; Tel: <a href="tel:%2B43%280%296804451378" value="+436804451378" target="_blank">+43(0)6804451378</a> &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>
</blockquote>
</div>
<br>
</div>
</div></div>
</blockquote>
</div>
<br><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>
Ian Ross | 17 May 06:55 2014
Picon

Re: Request to C2HS users

Thanks Ryan,

I got the cuda package (and cufft and OpenCL) building on Travis without too much trouble, after a bit of experimentation on an EC2 instance with the same Linux build as Travis uses.  It was easier than I thought it would be, and the CUDA installation process seems to be getting easier over time, so supporting this sort of thing for newer versions of CUDA should be easy.

Cheers,

Ian.



On 16 May 2014 07:59, Ryan Newton <rrnewton <at> gmail.com> wrote:
Hi all,

Sorry for long-delayed response.

Yes, some of our jobs do happen to install accelerate-cuda (like this one, and this one).  We don't have a dedicated set of tests for accelerate-cuda itself.  (But we should soon.  I hope to test all backend ends uniformly.)

We have a pretty heterogeneous config in terms of cuda installs.  Most of our tests run on a set of machines that still have CUDA 4.2, but my own work-station and laptop have 5.5.

Cheers,
  -Ryan



On Tue, Apr 15, 2014 at 12:22 AM, Manuel M T Chakravarty <chak <at> cse.unsw.edu.au> wrote:
Hi Ian,

We haven’t build the cuda package in a CI environment, but Ryan Newton has Accelerate in on a CI server.

Ryan, are you building with the CUDA backend?

Ian, I’m not sure what you mean by CUDA version 6. I believe the latest CUDA release from NVIDIA is 5.5.

Cheers,
Manuel

Hi Manuel (and/or Trevor!),

Have you had any luck in building CUDA on Travis or any other CI environment?  I've not managed to build it on my desktop machine, but that's mostly due to not having an NVIDIA card and to being on Arch Linux, where the current CUDA install is version 6 instead of 5...  This C2HS regression suite idea has already turned out to be useful, catching a couple of silly little bugs I'd introduced, and I'd really like to include as many packages as possible, and to have it run as a CI test.

I'll have a try on Travis myself, but it would be useful to know if you've already figured out what's needed.

Thanks,

Ian.



On 2 April 2014 06:43, Manuel M T Chakravarty <chak <at> cse.unsw.edu.au> wrote:
Good plan! Please include 


Manuel


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.
_______________________________________________
C2hs mailing list
C2hs <at> haskell.org
http://www.haskell.org/mailman/listinfo/c2hs




--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
_______________________________________________
C2hs mailing list
C2hs <at> haskell.org
http://www.haskell.org/mailman/listinfo/c2hs





--
Ian Ross   Tel: +43(0)6804451378   ian <at> skybluetrades.net   www.skybluetrades.net
<div>
<div dir="ltr">Thanks Ryan,<div><br></div>
<div>I got the cuda package (and cufft and OpenCL) building on Travis without too much trouble, after a bit of experimentation on an EC2 instance with the same Linux build as Travis uses. &nbsp;It was easier than I thought it would be, and the CUDA installation process seems to be getting easier over time, so supporting this sort of thing for newer versions of CUDA should be easy.</div>
<div><br></div>
<div>Cheers,</div>
<div><br></div>
<div>Ian.</div>
<div><br></div>
</div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On 16 May 2014 07:59, Ryan Newton <span dir="ltr">&lt;<a href="mailto:rrnewton <at> gmail.com" target="_blank">rrnewton <at> gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div dir="ltr">Hi all,<div><br></div>
<div>Sorry for long-delayed response.</div>
<div><br></div>
<div>Yes, some of our jobs do happen to install accelerate-cuda (<a href="http://tester-lin.soic.indiana.edu:8080/job/accelerate-multidev/229/" target="_blank">like this one</a>, and <a href="http://tester-lin.soic.indiana.edu:8080/job/HackageReleased_meta-par-accelerate_CUDA/501/JENKINS_GHC=7.6.3,label=linux-cuda/console" target="_blank">this one</a>). &nbsp;We don't have a dedicated set of tests for accelerate-cuda itself. &nbsp;(But we should soon. &nbsp;I hope to test all backend ends uniformly.)</div>

<div><br></div>
<div>We have a pretty heterogeneous config in terms of cuda installs. &nbsp;Most of our tests run on a set of machines that still have CUDA 4.2, but my own work-station and laptop have 5.5.</div>
<div><br></div>

<div>
Cheers,</div>
<div>&nbsp; -Ryan</div>
<div><br></div>
</div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 12:22 AM, Manuel M T Chakravarty <span dir="ltr">&lt;<a href="mailto:chak <at> cse.unsw.edu.au" target="_blank">chak <at> cse.unsw.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote"><div>
<div>Hi Ian,</div>
<div><br></div>
<div>We haven&rsquo;t build the cuda package in a CI environment, but Ryan Newton has Accelerate in on a CI server.</div>

<div><br></div>
<div>Ryan, are you building with the CUDA backend?</div>
<div><br></div>
<div>Ian, I&rsquo;m not sure what you mean by CUDA version 6. I believe the latest CUDA release from NVIDIA is 5.5.</div>
<div><br></div>
<div>

Cheers,</div>
<div>Manuel</div>
<br><div>
<div>Ian Ross &lt;<a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a>&gt;:</div>
<blockquote type="cite">
<div dir="ltr">Hi Manuel (and/or Trevor!),<div><br></div>
<div>Have you had any luck in building CUDA on Travis or any other CI environment? &nbsp;I've not managed to build it on my desktop machine, but that's mostly due to not having an NVIDIA card and to being on Arch Linux, where the current CUDA install is version 6 instead of 5... &nbsp;This C2HS regression suite idea has already turned out to be useful, catching a couple of silly little bugs I'd introduced, and I'd really like to include as many packages as possible, and to have it run as a CI test.</div>

<div><br></div>
<div>I'll have a try on Travis myself, but it would be useful to know if you've already figured out what's needed.</div>
<div><br></div>
<div>Thanks,</div>
<div><br></div>
<div>Ian.</div>
<div><br></div>

</div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On 2 April 2014 06:43, Manuel M T Chakravarty <span dir="ltr">&lt;<a href="mailto:chak <at> cse.unsw.edu.au" target="_blank">chak <at> cse.unsw.edu.au</a>&gt;</span> wrote:<br><blockquote class="gmail_quote"><div>Good plan! Please include&nbsp;<div><br></div>
<div>&nbsp;&nbsp;<a href="http://hackage.haskell.org/package/cuda" target="_blank">http://hackage.haskell.org/package/cuda</a>
</div>

<div><br></div>
<div>Manuel</div>
<div><br></div>
<div>Ian Ross &lt;<a href="mailto:ian <at> skybluetrades.net" target="_blank">ian <at> skybluetrades.net</a>&gt;:</div>
<div>
<div>
<br><blockquote type="cite">
<div><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>
<span><div>
<div><br></div>-- <br>Ian Ross &nbsp; Tel: <a href="tel:%2B43%280%296804451378" value="+436804451378" target="_blank">+43(0)6804451378</a> &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></span>
</div></div></div>
<span><div>
_______________________________________________<br>C2hs mailing list<br><a href="mailto:C2hs <at> haskell.org" target="_blank">C2hs <at> haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/c2hs" target="_blank">http://www.haskell.org/mailman/listinfo/c2hs</a><br>
</div></span>
</blockquote>
</div>
<span><br></span>
</div>
</div></blockquote>
</div>
<span><br><br clear="all"><div><br></div>-- <br>Ian Ross &nbsp; Tel: <a href="tel:%2B43%280%296804451378" value="+436804451378" target="_blank">+43(0)6804451378</a> &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>
</span>
</div>
<span>
_______________________________________________<br>C2hs mailing list<br><a href="mailto:C2hs <at> haskell.org" target="_blank">C2hs <at> haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/c2hs" target="_blank">http://www.haskell.org/mailman/listinfo/c2hs</a><br></span>
</blockquote>
</div>
<br>
</div></blockquote>
</div>
<br>
</div>
</div></div>
</blockquote>
</div>
<br><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>
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


Gmane