Hmm..., are bison and flex rules in Make.rules OK?

catalincatalin Member ✭✭
Hi!

I have installed Ice-1.2.0 on a RedHat 9.0 machine at school. It uses gcc version 3.3, bison 1.875 and flex 2.5.4.

For installation I used the recepie given by beranrd toward the end on this thread
since it contains some details not present in the INSTALL.LINUX file.

(The python2 allTests.py failed with the now faimous "function not defined" message even though I set LD_ASSUME_KERNEL to 2.4.1)

After installing Ice-1.2.0 I uncommented the flex and bison rules in Make.rules and I added a single line of comment to the Grammar.y file, just like this
// blah, blah

make fails now with the following message:
making all in Slice
make[2]: Entering directory `/ifi/tyrfing/a09/catalin/hfag/prog/ice120/src/Slice'
rm -f Grammar.h Grammar.cpp
bison -dvt Grammar.y
mv Grammar.tab.c Grammar.cpp
mv Grammar.tab.h Grammar.h
rm -f Grammar.output
c++ -c -I.. -I../../include -DSLICE_API_EXPORTS -g -ftemplate-depth-128 -fPIC -Wall -D_REENTRANT Scanner.cpp
c++ -c -I.. -I../../include -DSLICE_API_EXPORTS -g -ftemplate-depth-128 -fPIC -Wall -D_REENTRANT Grammar.cpp
Grammar.tab.c: In function `int slice_parse()':
Grammar.tab.c:3305: error: parse error before `goto'
make[2]: *** [Grammar.o] Error 1
make[2]: Leaving directory `/ifi/tyrfing/a09/catalin/hfag/prog/ice120/src/Slice'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/ifi/tyrfing/a09/catalin/hfag/prog/ice120/src'
make: *** [all] Error 1

My guess is that the make rules for flex and/or bison in Make.rules are not 100% correct for bison 1.875 (Grammar.cpp which ships with Ice-1.2.0 is generated by bison 1.35).

Comparing file sizes and file dates in the src/Slice directory (I made a copy of the original directory to begin with) I can see that 4 files have been regenerated. What suprises me most is the difference in size between the original and the new files.

Original
Grammar.y 40136
Grammar.cpp 90299
Grammar.h 1099
Scanner.o 502952

New
Grammar.y 40151
Grammar.cpp 95788 +5K
Grammar.h 3319 +2K
Scanner.o 504036

I will try to attach the two Grammar.* files, if anyone cares to look into this.
Sugestions for how to rebuild the Slice parser are very welcome.

Thanks a lot,
Catalin

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Looks as if bison 1.875 generates broken code. At line 3305 in Grammer.cpp, you'll find:
      /* Suppress GCC warning that yyerrlab1 is unused when no action
         invokes YYERROR.  */
    #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
      __attribute__ ((__unused__))
    #endif
    
    This doesn't compile with GCC 3.3. If your remove this code, it will work fine.
  • catalincatalin Member ✭✭
    Yes, indeed, it looks like the code is broken. I can compile the parser anew if I comment out the code you mention. Of course this is a very tedious fix, since the Grammar.cpp file will be regenerated by the allegedly broken bison 1.875 every time I make a change to Grammar.y, so that I would have to comment out the code after each alteration. I guess this could be scripted somehow, but I am not that good.

    I have downloaded the source code of bison 1.35 and I have built it and installed it in a local directory, since I have no root privileges at school.

    How can I modify Make.rules so that it uses my local bison instead of the one provided by the system? Hopefully this version will generate code consistent with the rest of the Ice-1.2.0 package. At least it worked with Ice-1.1.0, on my home machine.

    Catalin
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Just put bison 1.35 into your PATH before /bin and /usr/bin. There is no need to modify the make rules. Bison 1.35 definitely works, we use it all the time. It's also the bison version that ships with Redhat 9.
  • catalincatalin Member ✭✭
    Thanks, it did the trick.

    I do have another difficulty now, though. It seems to me that in Ice 1.2.0 there are other dependencies on the Grammar.o or some other output of the remaking of the Slice parser, than it was the case in Ice-1.1.0.

    When I issued make after changing the grammar file with Ice-1.1.0, only the parser and a (very) few other things did get recompiled. Now, on the other hand, most of Ice gets recompiled, tests and everything. This is quite natural, I guess. Since many parts of ICE are declared in Slice, these parts should be regenerated by the new parser and recompiled. This takes an awfull lot of time for each lousy change I make to the grammar.

    How can I limit the recompilation process until I reach a stable state of the Slice parser?

    Thanks again,
    Catalin
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    The easiest way it to simply only invoke make in the directory that you want to recompile.

    Another possibility is to remove $(SLICEPARSERLIB) from the rules below, found in config/Make.rules:
    $(HDIR)/%F.h: $(SDIR)/%F.ice $(SLICE2CPP) $(SLICEPARSERLIB)
    	rm -f $(HDIR)/$(*F)F.h $(*F)F.cpp
    	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
    	mv $(*F)F.h $(HDIR)
    	rm -f $(*F)F.cpp
    
    $(HDIR)/%.h %.cpp: $(SDIR)/%.ice $(SLICE2CPP) $(SLICEPARSERLIB)
    	rm -f $(HDIR)/$(*F).h $(*F).cpp
    	$(SLICE2CPP) $(SLICE2CPPFLAGS) $<
    	mv $(*F).h $(HDIR)
    
    %.h %.cpp: %.ice $(SLICE2CPP) $(SLICEPARSERLIB)
    	rm -f $(*F).h $(*F).cpp
    	$(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice
    
Sign In or Register to comment.