Re: [Haskell-cafe] c2hs and cabal
On Tue, 2007-12-11 at 19:14 +0100, Stefan Kersten wrote: > > On 02.12.2007, at 22:34, Eric Sessoms wrote: > >> Just add > >> > >> Build-Tools: c2hs > >> > >> And cabal will take it from there. > > thanks eric, that's really pleasingly simple > (it appears that the Build-Tools: line isn't even needed). Though note that in future Cabal is going to get stricter about stating dependencies on build tools, just like it is very strict about dependencies on libraries. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] c2hs and cabal
On 02.12.2007, at 22:34, Eric Sessoms wrote: Just add Build-Tools: c2hs And cabal will take it from there. thanks eric, that's really pleasingly simple (it appears that the Build-Tools: line isn't even needed). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] c2hs and cabal
Just add Build-Tools: c2hs And cabal will take it from there. Stefan Kersten wrote: hi, i'm looking for a way to integrate c2hs (single .chs file) in a cabal build setup; can anybody give me some hints? thanks, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] c2hs and cabal
hi, i'm looking for a way to integrate c2hs (single .chs file) in a cabal build setup; can anybody give me some hints? thanks, ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [solved] Re: [Haskell-cafe] c2hs and cabal?
On Wed, Nov 29, 2006 at 01:12:50PM +, Duncan Coutts wrote: > http://www.haskell.org/cabal/release/latest/doc/users-guide/x30.html#buildinfo > > Section 2.1.4, though I do notice that the link to the full list of > extensions is broken. This version works (and looks better too): http://www.haskell.org/ghc/docs/latest/html/Cabal/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [solved] Re: [Haskell-cafe] c2hs and cabal?
On Wed, 2006-11-29 at 11:26 +, Magnus Therning wrote: > >Or the simpler way is to include in your .cabal file: > > > >extensions: ForeignFunctionInterface > > > >That then applies to every module in the lib and has the advantage of > >being portable between compilers. > > Ah, good point. > > Now, where could I have turned to find this out myself? I can't find it > in the Cabal User's Guide[1]. > > /M > > [1]: http://www.haskell.org/cabal/release/latest/doc/users-guide/ http://www.haskell.org/cabal/release/latest/doc/users-guide/x30.html#buildinfo Section 2.1.4, though I do notice that the link to the full list of extensions is broken. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [solved] Re: [Haskell-cafe] c2hs and cabal?
On Wed, Nov 29, 2006 at 03:38:24 +, Duncan Coutts wrote: >On Tue, 2006-11-28 at 17:24 +, Magnus Therning wrote: >> On Tue, Nov 28, 2006 at 12:00:50 +, Magnus Therning wrote: >> [..] >> >Can't really see anything obviously bogus about the following: >> > >> > % cat Foo.chs >> > module Foo where >> > >> > #include "foo.h" >> > >> > fooOne i = {# call foo1 #} i >> >> I solved my problem, but thought I'd send a mail to the list for anyone >> who's struggling as much as me (if that's even possible). >> >> The problem was that GHC requires a commandline argument telling it to >> deal with FFI. Including the following in Foo.chs resulted in >> successful compilation: >> >> {-# OPTIONS_GHC -fffi #-} > >Or the simpler way is to include in your .cabal file: > >extensions: ForeignFunctionInterface > >That then applies to every module in the lib and has the advantage of >being portable between compilers. Ah, good point. Now, where could I have turned to find this out myself? I can't find it in the Cabal User's Guide[1]. /M [1]: http://www.haskell.org/cabal/release/latest/doc/users-guide/ -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. I have steadily endeavored to keep my mind free, so as to give up any hypothesis, however much beloved -- and I cannot resist forming one on every subject -- as soon as facts are shown to be opposed to it. -- Charles Darwin (1809-1882) pgpZPlH4BCEZ5.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [solved] Re: [Haskell-cafe] c2hs and cabal?
On Tue, 2006-11-28 at 17:24 +, Magnus Therning wrote: > On Tue, Nov 28, 2006 at 12:00:50 +, Magnus Therning wrote: > [..] > >Can't really see anything obviously bogus about the following: > > > > % cat Foo.chs > > module Foo where > > > > #include "foo.h" > > > > fooOne i = {# call foo1 #} i > > I solved my problem, but thought I'd send a mail to the list for anyone > who's struggling as much as me (if that's even possible). > > The problem was that GHC requires a commandline argument telling it to > deal with FFI. Including the following in Foo.chs resulted in > successful compilation: > > {-# OPTIONS_GHC -fffi #-} Or the simpler way is to include in your .cabal file: extensions: ForeignFunctionInterface That then applies to every module in the lib and has the advantage of being portable between compilers. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[solved] Re: [Haskell-cafe] c2hs and cabal?
On Tue, Nov 28, 2006 at 12:00:50 +, Magnus Therning wrote: [..] >Can't really see anything obviously bogus about the following: > > % cat Foo.chs > module Foo where > > #include "foo.h" > > fooOne i = {# call foo1 #} i I solved my problem, but thought I'd send a mail to the list for anyone who's struggling as much as me (if that's even possible). The problem was that GHC requires a commandline argument telling it to deal with FFI. Including the following in Foo.chs resulted in successful compilation: {-# OPTIONS_GHC -fffi #-} /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. Good powers of observation are frequently called "cynicism" by those that don't have them. pgpHAr9r8IvEG.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] c2hs and cabal?
On Tue, Nov 28, 2006 at 11:11:30 +, Duncan Coutts wrote: >On Tue, 2006-11-28 at 10:56 +, Magnus Therning wrote: >> On Tue, Nov 28, 2006 at 00:33:42 +, Duncan Coutts wrote: >> >On Mon, 2006-11-27 at 22:26 +, Magnus Therning wrote: >> >> Can I use cabal to build packages that incorporates C libraries and FFI >> >> Haskell created using c2hs? >> > >> >Yes you can. Cabal understands a bit about .chs files. I think all you >> >need to do is specify the module in the exposed-modules or >> >other-modules and Cabal will find the .chs file and try to build a .hs >> >file from it. > >> I'm still having some problems though :-( I thought I'd start with a >> minimal, rather silly, test to see if I can get Cabal to do what I want. >> I've stuck what I have at >> http://www.therning.org/magnus_files/cnh.tar.gz >> >> It fails to build for me with the following error: >> >> Preprocessing executables for cnh-0.1... >> Building cnh-0.1... >> [1 of 2] Compiling Foo ( src/Foo.hs, >> dist/build/cnh/cnh-tmp/Foo.o ) >> src/Foo.chs:6:8: parse error on input `import' >> >> I tried using '-v5' but it didn't really offer anymore insight for a >> novice like me :( > >Check the generated Foo.hs file to see if it looks obviously bogus. Can't really see anything obviously bogus about the following: % cat Foo.chs module Foo where #include "foo.h" fooOne i = {# call foo1 #} i % cat Foo.hs -- GENERATED by C->Haskell Compiler, version 0.14.5 Travelling Lightly, 12 Dec 2005 (Haskell) -- Edit the ORIGNAL .chs file instead! {-# LINE 1 "src/Foo.chs" #-}module Foo where fooOne i = foo1 i foreign import ccall safe "src/Foo.h foo1" foo1 :: (CInt -> (IO CInt)) Or am I missing something? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. "There are of course many problems connected with life, of which some of the most popular are `Why are people born?' `Why do they die?' `Why do they spend so much of the intervening time wearing digital watches?'" -- The Book. pgpC42exa1VZU.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] c2hs and cabal?
On Tue, Nov 28, 2006 at 00:33:42 +, Duncan Coutts wrote: >On Mon, 2006-11-27 at 22:26 +, Magnus Therning wrote: >> Can I use cabal to build packages that incorporates C libraries and FFI >> Haskell created using c2hs? > >Yes you can. Cabal understands a bit about .chs files. I think all you >need to do is specify the module in the exposed-modules or >other-modules and Cabal will find the .chs file and try to build a .hs >file from it. Thanks, that's really good. >However at the moment your .chs files cannot import each other because >Cabal doesn't to any dependency analysis. That means you can't use >c2hs's {# import #} hooks. > >An initial patch was posted to the cabal-devel mailing list to do this >properly but it hasn't been integrated yet. I'll keep that in mind. I'm still having some problems though :-( I thought I'd start with a minimal, rather silly, test to see if I can get Cabal to do what I want. I've stuck what I have at http://www.therning.org/magnus_files/cnh.tar.gz It fails to build for me with the following error: Preprocessing executables for cnh-0.1... Building cnh-0.1... [1 of 2] Compiling Foo ( src/Foo.hs, dist/build/cnh/cnh-tmp/Foo.o ) src/Foo.chs:6:8: parse error on input `import' I tried using '-v5' but it didn't really offer anymore insight for a novice like me :( /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. Increasingly, people seem to misinterpret complexity as sophistication, which is baffling--the incomprehensible should cause suspicion rather than admiration. -- Niklaus Wirth pgp7XdSzW4enf.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] c2hs and cabal?
On Mon, 2006-11-27 at 22:26 +, Magnus Therning wrote: > Can I use cabal to build packages that incorporates C libraries and FFI > Haskell created using c2hs? Yes you can. Cabal understands a bit about .chs files. I think all you need to do is specify the module in the exposed-modules or other-modules and Cabal will find the .chs file and try to build a .hs file from it. However at the moment your .chs files cannot import each other because Cabal doesn't to any dependency analysis. That means you can't use c2hs's {# import #} hooks. An initial patch was posted to the cabal-devel mailing list to do this properly but it hasn't been integrated yet. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] c2hs and cabal?
Can I use cabal to build packages that incorporates C libraries and FFI Haskell created using c2hs? Any pointers on how to do that? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. If voting could really change things it would be illegal. pgpUiWIwTEn4J.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe