
Hello, I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems. I get the following error: c2hs.exe: Error in C header file. /usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h Any ideas/tips? Thanks, Rich

I was able to get around this error by defining __attribute__ away in my .hsc file, but now I am getting the following error: c2hs.exe: Error in C header file. /usr/include/cygwin/signal.h:56: (column 4) [FATAL]
Syntax error! The symbol `;' does not fit here.
The portion of signal.h it does like is: struct _sigcommune { __uint32_t _si_code; void *_si_read_handle; void *_si_write_handle; void *_si_process_handle; union { int _si_fd; void *_si_pipe_fhandler; char *_si_str; }; <---- this is what it is complaining about }; It appears that the c2hs Parser does not like this form? Regards, Rich
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.

On Thu, Apr 13, 2006 at 12:14:03PM -0500, Rich Fought wrote:
c2hs.exe: Error in C header file.
/usr/include/cygwin/signal.h:56: (column 4) [FATAL]
Syntax error! The symbol `;' does not fit here.
The portion of signal.h it does like is:
struct _sigcommune { __uint32_t _si_code; void *_si_read_handle; void *_si_write_handle; void *_si_process_handle; union { int _si_fd; void *_si_pipe_fhandler; char *_si_str; }; <---- this is what it is complaining about };
It appears that the c2hs Parser does not like this form?
I've had this problem too. The problem also exists with unnamed structs. Unnamed structs and unions are not ANSI C, but GCC and other compilers accept them. I can't find any reference to them being valid C99 either. It'd be handy if c2hs understood them, though. :-) http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Unnamed-Fields.html#Unnamed-Fiel... wjt

Rich Fought:
Hello,
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h
Any ideas/tips?
Which version? Manuel

On Wed, 2006-04-12 at 16:40 -0500, Rich Fought wrote:
Hello,
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h
Any ideas/tips?
Re-run your c2hs command and add this flag "--keep". Then send in the .i file that this command produces. By looking at this .i file it should be possible for a c2hs expert to identify the problem. (The file may well be quite large so it'd be helpful to compress it.) Duncan

Duncan Coutts:
On Wed, 2006-04-12 at 16:40 -0500, Rich Fought wrote:
Hello,
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h
Any ideas/tips?
Re-run your c2hs command and add this flag "--keep". Then send in the .i file that this command produces.
By looking at this .i file it should be possible for a c2hs expert to identify the problem.
(The file may well be quite large so it'd be helpful to compress it.)
As Duncan wrote it would be very helpful if you could provide that information. Then, we can reproduce the problem much more easily. Cheers, Manuel

Sorry, went on holiday and dropped the ball ... Attached are two bz2 files, the first one (GnuTLS.i.bz2) captures the __attribute__ error. The second (GnuTLS2.i.bz2) captures the signal.h error that follows after getting around the attribute error as described previously in this thread. If there is anything else I can provide please let me know. Also, c2hs generally does not play nice in Cygwin. The post-install script does not run correctly, and must be run by hand. Even then, there are problems with paths (/ vs \) so the script must be edited by hand for it to run correctly. When installing other packages (such as hsgnutls) using Cabal, Cabal looks for c2hs.exe installed on the system, not the script in /usr/local/bin. So you have to add c2hs.exe to the path to get configured, but then the build fails because it is missing the flags in the script. So you have to call c2hs by hand. I only had 3 files to process, but for many files this could quicky become a pain. Hope this helps! Regards, Rich
-----Original Message----- From: Manuel M T Chakravarty [mailto:chak@cse.unsw.edu.au] Sent: Friday, April 28, 2006 7:26 PM To: Duncan Coutts Cc: Rich Fought; c2hs@haskell.org Subject: Re: [C2hs] c2hs on CygWin
Duncan Coutts:
On Wed, 2006-04-12 at 16:40 -0500, Rich Fought wrote:
Hello,
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h
Any ideas/tips?
Re-run your c2hs command and add this flag "--keep". Then send in the .i file that this command produces.
By looking at this .i file it should be possible for a c2hs expert to identify the problem.
(The file may well be quite large so it'd be helpful to compress it.)
As Duncan wrote it would be very helpful if you could provide that information. Then, we can reproduce the problem much more easily.
Cheers, Manuel

Rich Fought:
Attached are two bz2 files, the first one (GnuTLS.i.bz2) captures the __attribute__ error. The second (GnuTLS2.i.bz2) captures the signal.h error that follows after getting around the attribute error as described previously in this thread. If there is anything else I can provide please let me know.
Thanks for those.
Also, c2hs generally does not play nice in Cygwin. The post-install script does not run correctly, and must be run by hand. Even then, there are problems with paths (/ vs \) so the script must be edited by hand for it to run correctly.
To be honest, I am not sure how to write shell scripts with portable file name conventions. Do you know what the Right Thing is? Or Duncan? Incidentally, the latest version of Cabal, shipped with GHC 6.4.2 seems to no longer require the post-install script (ie, it should now be possible to add the functionality to Setup.hs) - script was always a kludge to get around a shortcoming in Cabal's API. Maybe the easiest thing to do is to just to get rid of that script now (but that will mean you need at least GHC 6.4.2).
When installing other packages (such as hsgnutls) using Cabal, Cabal looks for c2hs.exe installed on the system, not the script in /usr/local/bin. So you have to add c2hs.exe to the path to get configured, but then the build fails because it is missing the flags in the script. So you have to call c2hs by hand. I only had 3 files to process, but for many files this could quicky become a pain.
This would be a bug in Cabal, wouldn't it? If so, I 'd be happy to contact Issac about fixing this - just want to make sure I am on the right track. Sorry for being so tentative. I am keen to get c2hs work smoothly for windows users, but I lack the expertise to do so without some assistance. Manuel
-----Original Message----- From: Manuel M T Chakravarty [mailto:chak@cse.unsw.edu.au] Sent: Friday, April 28, 2006 7:26 PM To: Duncan Coutts Cc: Rich Fought; c2hs@haskell.org Subject: Re: [C2hs] c2hs on CygWin
Duncan Coutts:
On Wed, 2006-04-12 at 16:40 -0500, Rich Fought wrote:
Hello,
I'm trying to use c2hs on Cygwin to build hsgnutls and am running into some problems.
I get the following error:
c2hs.exe: Error in C header file.
/usr/include/sys/reent.h:182: (column 12) [FATAL]
> Syntax error! The symbol '__attribute__' does not fit here.
I see nothing like this in reent.h
Any ideas/tips?
Re-run your c2hs command and add this flag "--keep". Then send in the .i file that this command produces.
By looking at this .i file it should be possible for a c2hs expert to identify the problem.
(The file may well be quite large so it'd be helpful to compress it.)
As Duncan wrote it would be very helpful if you could provide that information. Then, we can reproduce the problem much more easily.
Cheers, Manuel

On Mon, 2006-05-01 at 20:10 -0400, Manuel M T Chakravarty wrote:
Rich Fought:
Attached are two bz2 files, the first one (GnuTLS.i.bz2) captures the __attribute__ error. The second (GnuTLS2.i.bz2) captures the signal.h error that follows after getting around the attribute error as described previously in this thread. If there is anything else I can provide please let me know.
Thanks for those.
Also, c2hs generally does not play nice in Cygwin. The post-install script does not run correctly, and must be run by hand. Even then, there are problems with paths (/ vs \) so the script must be edited by hand for it to run correctly.
To be honest, I am not sure how to write shell scripts with portable file name conventions. Do you know what the Right Thing is? Or Duncan?
I don't like the script either. For the gentoo ebuild we had to remove the script and do the things it did in the ebuild. This is because it was trying to write into the live file system rather than into the installation directory.
Incidentally, the latest version of Cabal, shipped with GHC 6.4.2 seems to no longer require the post-install script (ie, it should now be possible to add the functionality to Setup.hs) - script was always a kludge to get around a shortcoming in Cabal's API. Maybe the easiest thing to do is to just to get rid of that script now (but that will mean you need at least GHC 6.4.2).
If the script can be eliminated then that's even better.
When installing other packages (such as hsgnutls) using Cabal, Cabal looks for c2hs.exe installed on the system, not the script in /usr/local/bin. So you have to add c2hs.exe to the path to get configured, but then the build fails because it is missing the flags in the script. So you have to call c2hs by hand. I only had 3 files to process, but for many files this could quicky become a pain.
This would be a bug in Cabal, wouldn't it? If so, I 'd be happy to contact Issac about fixing this - just want to make sure I am on the right track.
I'm not sure it is a bug. Cabal is not a cygwin program so knows nothing about "/usr/local/bin". But perhaps Cabal should make a more educated guess for where c2hs might live on a windows install (eg where Cabal would install it!).
Sorry for being so tentative. I am keen to get c2hs work smoothly for windows users, but I lack the expertise to do so without some assistance.
I know a bit about windows deployment. I do the win32 builds & installer for gtk2hs. Duncan
participants (4)
-
Duncan Coutts
-
Manuel M T Chakravarty
-
Rich Fought
-
Will Thompson