sysinstall compilation issue
Unga
unga888 at yahoo.com
Wed Aug 13 04:46:18 UTC 2008
--- On Tue, 8/12/08, Unga <unga888 at yahoo.com> wrote:
> From: Unga <unga888 at yahoo.com>
> Subject: Re: sysinstall compilation issue
> To: freebsd-stable at FreeBSD.ORG
> Cc: olli at lurza.secnetix.de
> Date: Tuesday, August 12, 2008, 3:28 PM
> --- On Fri, 8/8/08, Oliver Fromme
> <olli at lurza.secnetix.de> wrote:
>
> > From: Oliver Fromme <olli at lurza.secnetix.de>
> > Subject: Re: sysinstall compilation issue
> > To: freebsd-stable at FreeBSD.ORG, unga888 at yahoo.com
> > Date: Friday, August 8, 2008, 9:36 PM
> > Unga <unga888 at yahoo.com> wrote:
> > > This is i386 RELENG_7.
> > >
> > > Following section of the
> > /usr/src/usr.sbin/sysinstall/Makefile does not
> generate C
> > code properly:
> > >
> > > makedevs.c: Makefile rtermcap
> > > echo '#include
> <sys/types.h>'
> > > makedevs.c
> > > ${RTERMCAP} ansi | \
> > > file2c 'const char
> termcap_ansi[]
> > = {' ',0};' \
> > > > > makedevs.c
> > >
> > > At compile time, above expands to:
> > >
> >
> TERMCAP=/usr/src/usr.sbin/sysinstall/../../share/termcap/termcap.src
> > ./rtermcap ansi | file2c 'const char
> termcap_ansi[] =
> > {' ',0};' >> makedevs.c
> > >
> > > Which generates C code as follows:
> > > const char termcap_ansi[] = {
> > >
> > > ,0};
> > >
> > > That is, it generates 3 lines, which results a
> > compilation error.
> > >
> > > I presume, intended generated code should be:
> > > const char termcap_ansi[] = {' ',0};
> > >
> > > Am I right?
> >
> > No, it should generate an array containung a dump of
> > the "ansi" termcap entry. Please see the
> > file2c(1)
> > manpage.
> >
> > > What is wrong at my end?
> > >
> > > Note, I linked the rtermcap with ncursesw
> libraries,
> > can that be the cause? Any ideas?
> >
> > Yes, that's the cause. Why did you do that?
> >
> > FreeBSD's ncurses port contains a patch so the
> > tgetent()
> > function (which is used by rtermcap) returns the
> actual
> > termcap entry in the buffer. The original ncurses
> code
> > (which is terminfo based) doesn't do that.
> >
> > When you linked rtermcap with the wrong library, you
> > restored the original behaviour of tgetent(), so the
> > output of rtermcap was empty, so file2c produced
> invalid
> > source.
> >
>
> Sorry for my late reply on this. I was not well during
> weekend, an eye ache due to over work :(
>
> Here is the situation at my end, no matter whether I link
> with ncurses widec libs or non-widec libs, its still return
> the same code as above I mentioned.
>
> Possible causes can be:
> 1. The way I compile and install ncurses is not correct.
> 2. OR some essential files required are missing
> 3. OR there can be an other option
>
> I used truss as follows:
> TERMCAP=/usr/src/usr.sbin/sysinstall/../../share/termcap/termcap.src
> truss -o truss.log -f ./rtermcap ansi | file2c 'const
> char termcap_ansi[] = {' ',0};' >>
> makedevs.c
>
> The last few lines of truss.log shows:
> 9310:
> stat("/usr/share/misc/terminfo.db",{mode=-rw-r--r--
> ,inode=22613331,size=
> 3170304,blksize=4096}) = 0 (0x0)
> 9310:
> open("/usr/share/misc/terminfo.db",O_RDONLY,0644)
> = 4 (0x4)
> 9310: fcntl(4,F_SETFD,FD_CLOEXEC) = 0 (0x0)
> 9310:
> read(4,"\0\^F\^Ua\0\0\0\^B\0\0\^D\M-R\0"...,260)
> = 260 (0x104)
> 9310:
> __sysctl(0xbfbfd574,0x2,0xbfbfd570,0xbfbfd57c,0x0,0x0) = 0
> (0x0)
> 9310: lseek(4,0x132000,SEEK_SET) = 1253376
> (0x132000)
> 9310:
> read(4,"\^^\0\M-|\^O\M-T\^O\M-K\^O\M-*"...,4096)
> = 4096 (0x1000)
> 9310: lseek(4,0x26b000,SEEK_SET) = 2535424
> (0x26b000)
> 9310:
> read(4,"\n\0\M-Y\^O\^O\n\0\n\r\^D\^E\^D"...,4096)
> = 4096 (0x1000)
> 9310: close(4) = 0 (0x0)
> 9310: ioctl(2,TIOCGETA,0xbfbfdba4) = 0 (0x0)
> 9310: ioctl(2,TIOCGETA,0x81020d8) = 0 (0x0)
> 9310: ioctl(2,TIOCGETA,0xbfbfdb64) = 0 (0x0)
> 9310: ioctl(2,TIOCGWINSZ,0xbfbfdbc4) = 0 (0x0)
> 9310: fstat(1,{mode=p---------
> ,inode=0,size=0,blksize=4096}) = 0 (0x0)
> 9310: process exit, rval = 0
>
> Note, above log has no entry to open
> /usr/src/usr.sbin/sysinstall/../../share/termcap/termcap.src.
>
> So what can be the issue, ncurses has not been patched
> correctly or some essential files missing? If you guys think
> that ncurses has not been patched correctly, then I'll
> open another thread to discuss that.
>
There is another update. I have tested it with ncurses and ncurses-devel ports. It seems they don't work as the ncurses in the base system.
The test is as follows:
cc -o rtermcap /usr/src/usr.sbin/sysinstall/rtermcap.c /usr/ports/devel/ncurses/work/ncurses-5.6/build.nowidec/lib/libncurses.so.5.6 /usr/ports/devel/ncurses/work/ncurses-5.6/build.nowidec/lib/libtinfo.so.5.6
export LD_LIBRARY_PATH=/usr/ports/devel/ncurses/work/ncurses-5.6/build.nowidec/lib
cp -v mypath/terminfo.db /usr/local/share/misc/
TERMCAP=/usr/src/usr.sbin/sysinstall/../../share/termcap/termcap.src ./rtermcap ansi | file2c 'const char termcap_ansi[] = {' ',0};' >> makedevs.c
cat makedevs.c
const char termcap_ansi[] = {
,0};
Please note above mypath/terminfo.db is from my build.
Another observation is ncurses in the base system does not look for terminfo.db, where as ncurses and ncurses-devel ports look for terminfo.db.
So the question is, do ncurses and ncurses-devel ports do the same thing as ncurses in base system for the following statement?
TERMCAP=/usr/src/usr.sbin/sysinstall/../../share/termcap/termcap.src ./rtermcap ansi | file2c 'const char termcap_ansi[] = {' ',0};' >> makedevs.c
Any ideas?
Best Regrds
Unga
More information about the freebsd-stable
mailing list