lkcd
[Top] [All Lists]

Re: Compiling on SunOS

To: Hiro Sugawara <hsugawar@xxxxxxxxxxx>
Subject: Re: Compiling on SunOS
From: Luc Chouinard <lucc@xxxxxxx>
Date: Mon, 16 Jul 2001 22:52:47 -0400
Cc: "'Matt D. Robinson'" <yakker@xxxxxxxxxxxxxx>, "'lkcd@xxxxxxxxxxx'" <lkcd@xxxxxxxxxxx>
Organization: SGI
References: <F13508319A1CD41187DE00508BACED6A020673AC@cs2ex.brocade.com>
Sender: owner-lkcd@xxxxxxxxxxx
Hi Hiro, 

It's a necessity for the lexer and parser to support variable prefixes
like the -P option to lex. This is the premise for being able to make
the sial preprocessor and compiler work together inside a single image.
So you most steer away from the SunOS lex implementation.

As for the yack problem with the preprocessor file, I'll see what I can
found out.
SunOS is not something that has been on Matt or Tom's agenda as far as I
know...and I'm following their cue. I'll check it out, but no promises
:) I managed to find a SunOS 5 in munich.sgi so that's a good start.

It could be a mather of adding some more sed substitutions in the
sial-lsed and sialpp-lsed files. Did you try that ?

More later.

Thanks,

Hiro Sugawara wrote:
> 
> Okay, here's the complete log of my experiments (4 cases):
> 
> ===============================
> SunOS 5.8's native lex and yacc
>         SunOS' lex does not accept -P
> ===============================
> lex -Psialpp -t
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.l  >
> ./lex.sialpp.c
> lex: illegal option -- P
> Usage: lex [-ewctvnVY] [-Q(y/n)] [file]
> 
> ===============================
> flex 2.5.4 and SunOS 5.8's native yacc
>          Files compile, but linker fails
> ===============================
> yacc -psial -v -t -d
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial.y
> 
> conflicts: 255 shift/reduce, 18 reduce/reduce
> cat ./y.tab.c | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial-lsed >
> ./sial.tab.c
> cat ./y.tab.h | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial-lsed >
> ./sial.tab.h
> 
> ...
> 
> yacc -psialpp -v -t -d
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y
> 
> conflicts: 23 shift/reduce
> cat ./y.tab.c | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp-lsed >
> ./sialpp.tab.c
> cat ./y.tab.h | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp-lsed >
> ./sialpp.tab.h
> gcc -gstabs -I.
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial -c
> ./sialpp.tab.c
> gcc -gstabs -I.
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial -c
> ./sial.tab.c
> flex -L -Psial -t
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial.l >
> ./lex.sial.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> ./lex.sial.c
> flex -Psialpp -t
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.l  >
> ./lex.sialpp.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> ./lex.sialpp.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -o
> mkbaseop
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/mkbaseop.c
> ./mkbaseop > baseops.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> baseops.c
> ar ccurl libsial.a sial_util.o sial_node.o sial_var.o sial_func.o sial_str.o
> sial_op.o sial_num.o sial_stat.o sial_builtin.o sial_type.o sial_case.o
> sial_api.o sial_member.o sial_alloc.o sial_define.o sial_input.o
> sial_print.o sialpp.tab.o sial.tab.o lex.sial.o lex.sialpp.o baseops.o
> make[1]: Leaving directory
> `/users/home11/hsugawar/springboard/tools/obj/sparc-sun-solaris/powerpc-linu
> x/lkcdutils/libsial'
> 
> ...
> 
> gcc -o lcrash  -L. -L./../libklib -L./../liballoc -L./../librl
> -L./../libsial main.o util.o eval.o report.o stabs.o struct.o vmdump.o
> sial.o -lcmds -larch -lalloc -lrl -lklib -lncurses -lopcodes -lbfd -liberty
> -ldl -lsial
> ./../libsial/libsial.a(sial.tab.o)(.data+0x0): multiple definition of `yys'
> ./../libsial/libsial.a(sialpp.tab.o)(.data+0x0): first defined here
> ./../libsial/libsial.a(sial.tab.o)(.data+0x4): multiple definition of `yyv'
> ./../libsial/libsial.a(sialpp.tab.o)(.data+0x4): first defined here
> ./../libsial/libsial.a(sial.tab.o)(.data+0xc): multiple definition of
> `yytoks'
> ./../libsial/libsial.a(sialpp.tab.o)(.data+0xc): first defined here
> /usr/gnu/sparc-sun-solaris2.7/bin/ld: Warning: size of symbol `yytoks'
> changed from 208 to 808 in sial.tab.o
> ./../libsial/libsial.a(sial.tab.o): In function `sial_toctype':
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial.y:423:
> multiple definition of `yyreds'
> ./../libsial/libsial.a(sialpp.tab.o):/usr/ccs/bin/yaccpar:136: first defined
> here
> /usr/gnu/sparc-sun-solaris2.7/bin/ld: Warning: size of symbol `yyreds'
> changed from 116 to 740 in sial.tab.o
> collect2: ld returned 1 exit status
> make[1]: *** [lcrash] Error 1
> 
> ====================================
> flex 2.5.4 + bison 1.28
>         sial.y compiles, but sialpp.y fails
> ====================================
> bison -psial -v -t -d
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial.y -o
> ./y.tab.c
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial.y
> contains 253 shift/reduce conflicts and 20 reduce/reduce conflicts.
> cat ./y.tab.c | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial-lsed >
> ./sial.tab.c
> cat ./y.tab.h | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sial-lsed >
> ./sial.tab.h
> 
> ...
> 
> bison -psialpp -v -t -d
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y -o
> ./y.tab.c
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y
> contains 23 shift/reduce conflicts.
> cat ./y.tab.c | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp-lsed >
> ./sialpp.tab.c
> cat ./y.tab.h | sed -f
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp-lsed >
> ./sialpp.tab.h
> gcc -gstabs -I.
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial -c
> ./sialpp.tab.c
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y: In
> function `sial_getppnode':
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y:83:
> `yyval' undeclared (first use in this function)
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y:83:
> (Each undeclared identifier is reported only once
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/sialpp.y:83:
> for each function it appears in.)
> make[1]: *** [sialpp.tab.o] Error 1
> 
> ====================================
> Linux' lex/yacc output files copied
>         Everything looks good
> ====================================
> gcc -gstabs -I.
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial -c
> ./sialpp.tab.c
> gcc -gstabs -I.
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial -c
> ./sial.tab.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> ./lex.sial.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> ./lex.sialpp.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -o
> mkbaseop
> /users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/mkbaseop.c
> ./mkbaseop > baseops.c
> gcc -g -D__BROCADE__ -Dlinux=1 -D__BIG_ENDIAN__=1 -I. -I./include
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial
> -I/users/home11/hsugawar/springboard/tools/src/lkcdutils/libsial/include -c
> baseops.c
> 
> hiro
> 
> > -----Original Message-----
> > From: Hiro Sugawara
> > Sent: Monday, July 16, 2001 16:56
> > To: 'Matt D. Robinson'; Luc Chouinard
> > Cc: Hiro Sugawara; lkcd@xxxxxxxxxxx
> > Subject: RE: Compiling on SunOS
> >
> >
> > Thanks for the kind responses.
> >
> > I used the yacc and lex that came with my SunOS 5.8, then
> > tried bison 1.28 and flex 2.5.4, and none worked well.
> > I think the exact problems were both in compilation and
> > linking, but I only vaguely remember.
> >
> > I will post the exact symptom(s) as soon as I have time to
> > reproduce the trouble (and I will have to do it anyway).
> >
> > Regards,
> > hiro
> >
> > > -----Original Message-----
> > > From: Matt D. Robinson [mailto:yakker@xxxxxxxxxxxxxx]
> > > Sent: Monday, July 16, 2001 16:46
> > > To: Luc Chouinard
> > > Cc: Hiro Sugawara; lkcd@xxxxxxxxxxx
> > > Subject: Re: Compiling on SunOS
> > >
> > >
> > > To take this a step further, what lex/yacc revision are you using?
> > > And is this an RPM-based user-land, and if so, which RPMs?
> > >
> > > If this is as simple as changing 'yacc' to 'bison', that's easy,
> > > but if you're using the same lex/yacc revision that is commonly
> > > used on x86 RH systems, then we've got a whole other problem to
> > > solve.
> > >
> > > --Matt
> > >
> > > Luc Chouinard wrote:
> > > >
> > > > Hiro, I did a checkin last week on sourceforge to fix a
> > problem with
> > > > using the bison parser instead of yacc. Make sure you
> > > cvs/update with
> > > > the latest. If you are running with the latest, then send
> > > me the error
> > > > messages that you get I'll check it out.
> > > >
> > > > Let me know,
> > > >
> > > > Hiro Sugawara wrote:
> > > > >
> > > > > Hi!
> > > > >
> > > > > I am porting LKCD to our embedded PPC Linux with SunOS 5 as the
> > > > > host. With modified gdbserver as an agent, lcrash can now show
> > > > > ps, backtrace process stack, disassemble the code, and do other
> > > > > things on a live kernel.
> > > > >
> > > > > One big problem is that the lex and yacc files do not compile
> > > > > well on SunOS. I work around this problem by using Linux to
> > > > > produce *.c files from the source and then copying those files
> > > > > by hand.
> > > > >
> > > > > Does anybody have encountered (and hopefully solved) this
> > > > > problem?
> > > > >
> > > > > hiro
> > > >
> > > > --
> > > > Luc
> > >
> >

-- 
Luc

<Prev in Thread] Current Thread [Next in Thread>