darcs

Issue 326 compiling from source

Title compiling from source
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, edwint, fx, kowey, maeder, thorkilnaur, tommy
Assigned To
Topics

Created on 2006-10-31.16:40:15 by maeder, last changed 2009-08-27.13:49:30 by admin.

Files
File name Uploaded Type Edit Remove
patch fx, 2006-11-20.17:23:04 text/plain
term.h maeder, 2006-10-31.16:40:09 text/x-chdr
Messages
msg1160 (view) Author: maeder Date: 2006-10-31.16:40:09
Hi,

I've tried to compile darcs-1.0.9rc1 from sources.

./configure

indicated the following problem:

checking term.h usability... no
checking term.h presence... yes
configure: WARNING: term.h: present but cannot be compiled
configure: WARNING: term.h:     check for missing prerequisite headers?
configure: WARNING: term.h: see the Autoconf documentation
configure: WARNING: term.h:     section "Present But Cannot Be Compiled"
configure: WARNING: term.h: proceeding with the preprocessor's result
configure: WARNING: term.h: in the future, the compiler will take precedence
configure: WARNING:     ## ----------------------------- ##
configure: WARNING:     ## Report this to bugs@darcs.net ##
configure: WARNING:     ## ----------------------------- ##
checking for term.h... yes

After gmake I got the errors below. I'm working under PC-Solaris (SunOS
 5.10 Generic_118855-19 i86pc i386 i86pc) with gcc_4.0.3 und ghc-6.6.
I've attached the term.h file.

Cheers Christian

ghc  -cpp  -package QuickCheck -package mtl -package parsec -package
html -package unix -O -funbox-strict-fields  -Wall -Werror -I.
-DHAVE_CURSES -DHAVE_CURL -c External.hs

In file included from /tmp/ghc7655_0/ghc7655_0.hc:6:0:

/usr/include/term.h:1034:0:  error: syntax error before 'bool'

/usr/include/term.h:1060:0:  error: syntax error before 'SGTTY'

/usr/include/term.h:1081:0:  error: syntax error before 'sgr_mode'

/usr/include/term.h:1082:0:  error: syntax error before 'sgr_faked'

/usr/include/term.h:1092:0:
     error: syntax error before 'funckeystarter'

/usr/include/term.h:1094:0:
     error: syntax error before '_fl_rawmode'

/usr/include/term.h:1101:0:
     error: syntax error before '_input_queue'

/usr/include/term.h:1108:0:  error: syntax error before '*' token

/usr/include/term.h:1111:0:
     error: syntax error before 'bit_vector'

/usr/include/term.h:1115:0:
     error: syntax error before 'check_turn_off'

/usr/include/term.h:1116:0:
     error: syntax error before 'non_faked_mode'

/usr/include/term.h:1117:0:  error: syntax error before '_cur_pair'

/usr/include/term.h:1118:0:  error: syntax error before '*' token

/usr/include/term.h:1120:0:  error: syntax error before '}' token

/usr/include/term.h:1207:0:  error: syntax error before 'int'

/usr/include/term.h:1207:0:
     error: 'vidputs' declared as function returning a function

/usr/include/term.h:1207:0:  error: syntax error before ')' token
gmake: *** [External.o] Error 1
Attachments
msg1203 (view) Author: kowey Date: 2006-11-11.12:24:16
Hi,

Could you please try compiling the latest darcs-unstable?
I would like to see if Dave's term.h patch resolves the issue
for you.

Thanks,
msg1235 (view) Author: maeder Date: 2006-11-16.16:04:48
Eric Kow schrieb:
> Could you please try compiling the latest darcs-unstable?
> I would like to see if Dave's term.h patch resolves the issue
> for you.

I got darcs via another machine today (which took a while):

darcs get --verbose http://abridgegame.org/repos/darcs

./configure (after autoconf) did not complain. config.log contains:

{{{
configure:6280: checking for term.h
configure:6302: gcc -c  -O2 -I/usr/local/include  conftest.c >&5
configure:6308: $? = 0
configure:6315: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:6318: $? = 0
configure:6325: test -s conftest.o
configure:6328: $? = 0
configure:6340: result: yes
configure:6343: checking for library containing tgetent
configure:6384: gcc -o conftest  -O2 -I/usr/local/include
-L/usr/local/lib -lc
url -lz -lssl -lcrypto -lsocket -lnsl -lz conftest.c  >&5
Undefined                       first referenced
 symbol                             in file
tgetent                             /var/tmp//ccuO02Fl.o
ld: fatal: Symbol referencing errors. No output written to conftest
collect2: ld returned 1 exit status
}}}

and
{{{ac_cv_header_term_h=yes}}}

Then compilation with ghc-6.6 (via gmake) failed as shown in
http://bugs.darcs.net/issue326

Cheers Christian

P.S. I simply replied to this message. Do I need to register via your
issue tracker or is there a guest login?
msg1247 (view) Author: kowey Date: 2006-11-18.17:03:57
On Thu, Nov 16, 2006 at 17:03:47 +0100, Christian Maeder wrote:
> ./configure (after autoconf) did not complain. config.log contains:

> configure:6384: gcc -o conftest  -O2 -I/usr/local/include
> -L/usr/local/lib -lc
> url -lz -lssl -lcrypto -lsocket -lnsl -lz conftest.c  >&5
> Undefined                       first referenced
>  symbol                             in file
> tgetent                             /var/tmp//ccuO02Fl.o

Hmm... this is darcs stable that you got, so I wonder if you managed to
get Dave's term.h patch with it.  Could you try this with the newly
released 1.0.9rc2?  It should be available as a tarball.  If not, Dave,
do you have any ideas?

> P.S. I simply replied to this message. Do I need to register via your
> issue tracker or is there a guest login?

Just replying to the mail is fine.  On the other hand, registering lets
you mark yourself nosy for other bugs and assign them to yourself to
indicate that you want to work on fixing them :-)
msg1251 (view) Author: maeder Date: 2006-11-20.13:41:17
Eric Y. Kow schrieb:
> On Thu, Nov 16, 2006 at 17:03:47 +0100, Christian Maeder wrote:
>> ./configure (after autoconf) did not complain. config.log contains:
> 
>> configure:6384: gcc -o conftest  -O2 -I/usr/local/include
>> -L/usr/local/lib -lc
>> url -lz -lssl -lcrypto -lsocket -lnsl -lz conftest.c  >&5
>> Undefined                       first referenced
>>  symbol                             in file
>> tgetent                             /var/tmp//ccuO02Fl.o
> 
> Hmm... this is darcs stable that you got, so I wonder if you managed to
> get Dave's term.h patch with it.  Could you try this with the newly
> released 1.0.9rc2?  It should be available as a tarball.  If not, Dave,
> do you have any ideas?

I've tried darcs-1.0.9rc2, but it showed the same results as the HEAD
(or whatever I get via darcs).

C.
msg1252 (view) Author: fx Date: 2006-11-20.14:16:01
"Eric Y. Kow" <eric.kow@gmail.com> writes:

> Hmm... this is darcs stable that you got, so I wonder if you managed to
> get Dave's term.h patch with it.  Could you try this with the newly
> released 1.0.9rc2?  It should be available as a tarball.  If not, Dave,
> do you have any ideas?

I now have ghc installed on Solaris 10 SPARC and find that the build
fails.  I'd missed the condition on the INCLUDE pragma about it being
at the op of the source.  Moving it up causes a different declaration
error which must be influenced by something ghc does with the
generated C code.  I'll investigate when I have a chance; it may have
to wait until tomorrow.  Sorry I was doing this without being able to
test initially.
msg1255 (view) Author: fx Date: 2006-11-20.17:23:11
I got a chance to look at this again.

It looks to me as though there is a problem with the C headers
generated for the ghc libraries somehow (see the comments), but I
don't have time to investigate that.  This patch isn't very clean, but
is tested on Solaris 10 and GNU/Linux.  I moved term.h out of the
ccall, partly because I noticed that would include "term.h" rather
than <term.h>, though it probably doesn't matter practically.

For what it's worth, if the head of the generated C is changed to look
like this, it works:

/* GHC_PACKAGES haskell98-1.0 util-1.0 posix-1.0 unix-1.0 readline-1.0 lang-1.0 mtl-1.0 QuickCheck-1.0 parsec-1.0 base-1.0 rts-1.0
*/
#include <curses.h>
#include <term.h>
#include "Stg.h"
#include "HsBase.h"
#include "HsLang.h"
#include "HsReadline.h"
#include "HsUnix.h"
#include "HsPosix.h"
#include "HsUtil.h"

The original, with curses.h and term.h at the end of that block,
failed due to SGTTY being undefined (I think).
Attachments
msg1270 (view) Author: kowey Date: 2006-11-25.17:43:40
Sorry I missed this patch on the 2006-11-25 cycle, Dave

On Mon, Nov 20, 2006 at 17:22:47 +0000, Dave Love wrote:
> It looks to me as though there is a problem with the C headers
> generated for the ghc libraries somehow (see the comments), but I
> don't have time to investigate that.  This patch isn't very clean, but
> is tested on Solaris 10 and GNU/Linux.  I moved term.h out of the
> ccall, partly because I noticed that would include "term.h" rather
> than <term.h>, though it probably doesn't matter practically.

Again, I'm not terribly qualified to review the patch.

Could somebody familiar with Windows check that darcs still compiles
works for them with this patch?  Works on my Mac anyway, and Dave says
it's ok for Solaris 10 and GNU/Linux.

Christian, does this patch resolve things for you?

Anyway, if nobody complains or submits a cleaner patch, it's going in
next week.
msg1272 (view) Author: edwint Date: 2006-11-27.10:32:20
Eric Y. Kow wrote:
> Could somebody familiar with Windows check that darcs still compiles
> works for them with this patch? 

It works for me, on Windows.

Edwin
msg1275 (view) Author: maeder Date: 2006-11-27.16:38:56
-------- Original-Nachricht --------
Betreff: Re: [issue326] compiling from source
Datum: Mon, 27 Nov 2006 14:00:18 +0100
Von: Christian Maeder <maeder@tzi.de>
An: Dave Love <fx@gnu.org>
Referenzen: <20061111122345.GG24726@dewdrop.local>
<455C8BE3.8030905@tzi.de>	<20061118170341.GC253@dewdrop.local>
<ms4psuvxqw.fsf@marvin.smb.man.ac.uk> <4561EE71.4020407@tzi.de>
<rzqwt5ol7xa.fsf@loveshack.ukfsn.org> <45642997.7050801@tzi.de>
<msirh6cvqf.fsf@marvin.smb.man.ac.uk> <45659D8C.7010109@tzi.de>
<rzq3b87l6dp.fsf@loveshack.ukfsn.org>

Dave Love schrieb:
> Can you please check that the patch-able diff
> below works on your system.  It's against 1.0.9rc2.

Yep, patch worked and compilation succeeded.

Sorry for the confusion, Christian

> ------------------------------------------------------------------------
> 
> --- old-darcs/configure.ac	2006-11-25 18:30:59.000000000 +0000
> +++ new-darcs/configure.ac	2006-11-25 18:30:59.000000000 +0000
> @@ -393,6 +393,7 @@
>        [AC_SEARCH_LIBS(tgetent, [curses ncurses], [HAVE_CURSES=True])], ,
>        [#include <curses.h>
>        ])
> +  AC_CHECK_HEADERS([termio.h])	dnl see External.hs
>    if test "$HAVE_CURSES" != "True"; then
>      AC_MSG_WARN([Cannot find term.h, disabling color.])
>    fi
> 
> --- old-darcs/External.hs	2006-11-25 18:30:59.000000000 +0000
> +++ new-darcs/External.hs	2006-11-25 18:30:59.000000000 +0000
> @@ -1,4 +1,15 @@
>  {-# OPTIONS -fffi #-}
> +#ifdef HAVE_CURSES
> +-- Grim hack for Solaris 10 (at least).  Without it, SGTTY isn't declared.
> +-- Something in the ghc C headers which get included before term.h in the
> +-- generated C is clobbering it.  (If you edit that C and put the curses.h
> +-- and term.h first, the error goes away.)
> +#ifdef HAVE_TERMIO_H
> +{-# INCLUDE <termio.h> #-}
> +#endif
> +{-# INCLUDE <curses.h> #-}
> +{-# INCLUDE <term.h> #-}
> +#endif
>  module External (
>      copyFileOrUrl, copyFilesOrUrls,
>      cloneTree, cloneTreeExcept, clonePartialsTree, clonePaths,
> @@ -590,10 +601,9 @@
>  getTermNColors :: IO CInt
>  
>  #ifdef HAVE_CURSES
> -{-# INCLUDE <curses.h> #-}
>  
> -foreign import ccall "term.h tgetnum" c_tgetnum :: CString -> IO CInt
> -foreign import ccall "term.h tgetent" c_tgetent :: Ptr CChar -> CString -> IO CInt
> +foreign import ccall "tgetnum" c_tgetnum :: CString -> IO CInt
> +foreign import ccall "tgetent" c_tgetent :: Ptr CChar -> CString -> IO CInt
>  
>  termioBufSize :: Int
>  termioBufSize = 4096
>
msg1293 (view) Author: kowey Date: 2006-11-29.13:46:31
Many thanks, Dave, Christian (did I forget anyone?)
I have put this patch into the unstable repository.
msg1780 (view) Author: tommy Date: 2007-06-29.19:50:31
fixed in 1.0.9
History
Date User Action Args
2006-10-31 16:40:15maedercreate
2006-11-11 12:24:20koweysetstatus: unread -> unknown
nosy: droundy, tommy, kowey, maeder
messages: + msg1203
2006-11-16 16:05:06maedersetnosy: droundy, tommy, kowey, maeder
messages: + msg1235
2006-11-18 17:04:05koweysetnosy: droundy, tommy, kowey, maeder
messages: + msg1247
2006-11-20 13:41:27maedersetnosy: droundy, tommy, kowey, maeder
messages: + msg1251
2006-11-20 14:16:09fxsetnosy: + fx
messages: + msg1252
2006-11-20 17:23:12fxsetfiles: + patch
nosy: droundy, tommy, kowey, fx, maeder
messages: + msg1255
2006-11-25 17:43:51koweysetnosy: droundy, tommy, kowey, fx, maeder
messages: + msg1270
2006-11-27 10:32:28edwintsetnosy: + edwint
messages: + msg1272
2006-11-27 16:39:04maedersetnosy: droundy, tommy, kowey, fx, edwint, maeder
messages: + msg1275
title: compiling from source -> compiling from source]
2006-11-29 13:46:43koweysetnosy: droundy, tommy, kowey, fx, edwint, maeder
messages: + msg1293
title: compiling from source] -> compiling from source
2006-12-05 21:55:22droundysetnosy: droundy, tommy, kowey, fx, edwint, maeder
2006-12-09 18:09:56koweysetstatus: unknown -> resolved-in-unstable
nosy: droundy, tommy, kowey, fx, edwint, maeder
2007-06-29 19:50:31tommysetstatus: resolved-in-unstable -> resolved
nosy: + beschmi
messages: + msg1780
2009-08-06 17:38:59adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, zooko, dagit, mornfall, simon, thorkilnaur, - droundy, fx, edwint, maeder
2009-08-06 20:35:46adminsetnosy: - beschmi
2009-08-10 21:58:00adminsetnosy: + edwint, fx, maeder, - markstos, darcs-devel, zooko, jast, dagit, Serware, mornfall
2009-08-25 17:52:39adminsetnosy: + darcs-devel, - simon
2009-08-27 13:49:30adminsetnosy: tommy, kowey, fx, darcs-devel, edwint, maeder, thorkilnaur, dmitry.kurochkin