[C2hs] Problems with c2hs, including `__attribute__' symbol in _mingw.h

Vivian McPhail vivian.mcphail at paradise.net.nz
Wed Oct 11 23:20:59 EDT 2006


Hi, FYI.

I tried putting the arguments in extra quotes, as suggested, however, many
header files include _mingw.h which seems to redefine __attribute__.

My solution (very ugly) was to hack the _mingw.h file to permanently
redefine:

#define __attribute__(x)

So I need to remember to fix this before I compile anything.

Apart from that c2hs seems to be working, now I just need to learn how to
use it properly.

Thanks,

Vivian

> -----Original Message-----
> From: Manuel M T Chakravarty [mailto:chak at cse.unsw.edu.au] 
> Sent: Thursday, 12 October 2006 9:37 a.m.
> To: Vivian McPhail
> Cc: c2hs at haskell.org
> Subject: RE: [C2hs] Problems with c2hs, including 
> `__attribute__' symbol in _mingw.h
> 
> Vivian McPhail:
> > This is the second run, with the appropriate defs to get 
> rid of the problem.
> > Clearly the args to --cppopts are getting screwed up.  I also tried 
> > with "-I..." but got the same error.
> > 
> > 
> > $ c2hs --cppopts='-I/c/Apps/MATLAB704/extern/include -D__asm__(A)= 
> > -D__attribute__(A)=' --include=C:/Apps/MATLAB704/extern/include 
> > matrix.h MxMatrix.chs
> > MxMatrix.h:1:20: matrix.h: No such file or directory
> > c2hs.exe: Error during preprocessing custom header file
> 
> I think, you need to put the argument to -D in extra quotes, like so
> 
>   --cppopts='-I/c/Apps/MATLAB704/extern/include 
> -D"__asm__(A)= " -D"__attribute__(A)= "'
> 
> Manuel
> 
> > 
> > > -----Original Message-----
> > > From: Manuel M T Chakravarty [mailto:chak at cse.unsw.edu.au]
> > > Sent: Wednesday, 11 October 2006 9:32 a.m.
> > > To: Vivian McPhail
> > > Cc: c2hs at haskell.org
> > > Subject: Re: [C2hs] Problems with c2hs, including `__attribute__' 
> > > symbol in _mingw.h
> > > 
> > > Hi Vivian,
> > > 
> > > > running GHC 6.5.20060831, mingw
> > > >  
> > > > 1) darcs repo error:
> > > > Patch 107 can't be applied.  Some problem with case-sensitivity.
> > > > Issue234 of darcs is a bugs report on case-sensitivity, and
> > > Heffalump
> > > > on #darcs is examining this problem.
> > > >  
> > > > Heffalump has created a repo that fixes this problem:
> > > > http://urchin.earth.li/darcs/ganesh/c2hs
> > > 
> > > Does that also happen if you get the repo with --partial? 
>  If yes, 
> > > maybe we can get around it by adding another, more recent, 
> > > checkpoint.
> > >  
> > > > 2) ./Setup.hs install error:
> > > >  
> > > > $ ./Setup.hs install
> > > > Installing: C:\Apps\MSYS\1.0\local\Haskell\c2hs-0.14.6
> > > > \ghc-6.5.20060831 & C:\Apps\MSYS\1.0\local\Haskell\bin
> > > c2hs-0.14.6...
> > > > '.' is not recognized as an internal or external 
> command, operable 
> > > > program or batch file.
> > > > 
> > > > Some problem with backslashes and windows.
> > > >  
> > > > I got around this problem by installing by hand.
> > > 
> > > Yes, I am sorry, this is a known problem on windows, 
> which is on the 
> > > list of things to be fixed.
> > > 
> > > > 3) syntax error
> > > >  
> > > > $ c2hs --cppopts=-I/c/Apps/MATLAB704/extern/include
> > > > --include=c:/Apps/MATLAB704/extern/include matrix.h MxMatrix.chs
> > > > c2hs.exe: Generic fatal error.
> > > >  
> > > > 
> > > C:/Apps/MSYS/1.0/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../.
> > > ./include/float.h:125: (column 8) [FATAL]
> > > >   >>> Syntax error!
> > > >   The symbol `__attribute__' does not fit here.
> > > 
> > > __attribute__ is a not very well documented extension of gcc. 
> > >  c2hs can handle many cases of __attribute__, but 
> unfortunately some 
> > > don't work yet.  However, there is a work around.  Please see the 
> > > following message from the list archive:
> > > 
> > >   http://www.haskell.org/pipermail/c2hs/2006-May/000577.html
> > > 
> > > Manuel
> > > 
> > > 
> > > 
> > > --
> > > No virus found in this incoming message.
> > > Checked by AVG Free Edition.
> > > Version: 7.1.407 / Virus Database: 268.13.1/466 - Release
> > > Date: 7/10/2006
> > >  
> > > 
> > 
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.407 / Virus Database: 268.13.1/466 - Release 
> Date: 7/10/2006
>  
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.13.1/466 - Release Date: 7/10/2006
 



More information about the C2hs mailing list