Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

Can't build SuperC on Ubuntu 20.10 x64 #2

Closed
jyapayne opened this issue Feb 26, 2021 · 5 comments
Closed

Can't build SuperC on Ubuntu 20.10 x64 #2

jyapayne opened this issue Feb 26, 2021 · 5 comments

Comments

@jyapayne
Copy link

I'm trying to build SuperC via your instructions in the readme. However, I get stuck on the last make step. The errors I get are:

(joey @ JMachine)-> make
make -C /home/joey/IdeaProjects/superc/src/xtc classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc'
make -C /home/joey/IdeaProjects/superc/src/xtc/util classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/util'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/util'
make -C /home/joey/IdeaProjects/superc/src/xtc/tree classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/tree'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/tree'
make -C /home/joey/IdeaProjects/superc/src/xtc/type classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/type'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/type'
make -C /home/joey/IdeaProjects/superc/src/xtc/parser classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/parser'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/parser'
make -C /home/joey/IdeaProjects/superc/src/xtc/lang classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/lang'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/lang'
make -C /home/joey/IdeaProjects/superc/src/xtc/lang/cpp classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/lang/cpp'
javac -d /home/joey/IdeaProjects/superc/classes -sourcepath /home/joey/IdeaProjects/superc/src CContext.java 
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:107: error: '}' expected
    ""end of file"",
      ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:107: error: ';' expected
    ""end of file"",
                 ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:109: error: ';' expected
    ""invalid token"",
                   ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:1973: error: class, interface, or enum expected
}
^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:471: error: class yytoknum_wrapper is public, should be declared in a file named yytoknum_wrapper.java
  public static class yytoknum_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:489: error: class yyr1_wrapper is public, should be declared in a file named yyr1_wrapper.java
  public static class yyr1_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:557: error: class yyr2_wrapper is public, should be declared in a file named yyr2_wrapper.java
  public static class yyr2_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:625: error: class yydefact_wrapper is public, should be declared in a file named yydefact_wrapper.java
  public static class yydefact_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:727: error: class yydefgoto_wrapper is public, should be declared in a file named yydefgoto_wrapper.java
  public static class yydefgoto_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:756: error: class yypact_wrapper is public, should be declared in a file named yypact_wrapper.java
  public static class yypact_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:858: error: class yypgoto_wrapper is public, should be declared in a file named yypgoto_wrapper.java
  public static class yypgoto_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:887: error: class yytable_wrapper is public, should be declared in a file named yytable_wrapper.java
  public static class yytable_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:1379: error: class yycheck_wrapper is public, should be declared in a file named yycheck_wrapper.java
  public static class yycheck_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:1871: error: class yystos_wrapper is public, should be declared in a file named yystos_wrapper.java
  public static class yystos_wrapper {
                ^
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:107: error: cannot find symbol
    ""end of file"",
          ^
  symbol:   class of
  location: class yytname_wrapper
/home/joey/IdeaProjects/superc/src/xtc/lang/cpp/CParseTables.java:109: error: cannot find symbol
    ""invalid token"",
      ^
  symbol:   class invalid
  location: class yytname_wrapper
16 errors
make[1]: *** [/home/joey/IdeaProjects/superc/Makerules:48: /home/joey/IdeaProjects/superc/classes/xtc/lang/cpp/CContext.class] Error 1
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/lang/cpp'
make: *** [Makefile:130: /home/joey/IdeaProjects/superc/src/xtc/lang/cpp.class] Error 2

So it looks like the parser generator generates bad code (double double quotes). Is this a known issue, or am I using a version of bison that is too new?

@jyapayne
Copy link
Author

Bison version is:

bison (GNU Bison) 3.7
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@jyapayne
Copy link
Author

Sorry, the above error is after I fixed the following error:

make
make -C /home/joey/IdeaProjects/superc/src/xtc classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc'
make -C /home/joey/IdeaProjects/superc/src/xtc/util classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/util'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/util'
make -C /home/joey/IdeaProjects/superc/src/xtc/tree classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/tree'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/tree'
make -C /home/joey/IdeaProjects/superc/src/xtc/type classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/type'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/type'
make -C /home/joey/IdeaProjects/superc/src/xtc/parser classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/parser'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/parser'
make -C /home/joey/IdeaProjects/superc/src/xtc/lang classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/lang'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/lang'
make -C /home/joey/IdeaProjects/superc/src/xtc/lang/cpp classes
make[1]: Entering directory '/home/joey/IdeaProjects/superc/src/xtc/lang/cpp'
rm -f -f CContext.java
echo -e " /* COPIED FROM SYMLINKED .CContext.java BY MAKE.  DO NOT EDIT. */\n" > CContext.java
cat .CContext.java >> CContext.java
chmod a-w CContext.java
javac -d /home/joey/IdeaProjects/superc/classes -sourcepath /home/joey/IdeaProjects/superc/src CContext.java 
rm -f -f c.y
echo -e " /* COPIED FROM SYMLINKED .c.y BY MAKE.  DO NOT EDIT. */\n" > c.y
cat .c.y >> c.y
chmod a-w c.y
bison -o c.tab.c c.y
# extract prologue, epilogue, and inline actions for inclusion in
# CActions
./extract_bison_java.sh c.y
gcc  -DBISON_PARSER_FILE=c.bison_content -DCLASS_NAME=CParseTables -o gen_c_tables gen_tables.c
gen_tables.c: In function ‘main’:
gen_tables.c:88:21: error: ‘YYUNDEFTOK’ undeclared (first use in this function); did you mean ‘YYUNDEF’?
   88 |   constructor_entry(YYUNDEFTOK);
      |                     ^~~~~~~~~~
gen_tables.c:81:69: note: in definition of macro ‘constructor_entry’
   81 | # define constructor_entry(x)  do { printf("          %d, // %s\n", x, #x); } while (0)
      |                                                                     ^
gen_tables.c:88:21: note: each undeclared identifier is reported only once for each function it appears in
   88 |   constructor_entry(YYUNDEFTOK);
      |                     ^~~~~~~~~~
gen_tables.c:81:69: note: in definition of macro ‘constructor_entry’
   81 | # define constructor_entry(x)  do { printf("          %d, // %s\n", x, #x); } while (0)
      |                                                                     ^
gen_tables.c:127:3: warning: implicit declaration of function ‘print_uint16’ [-Wimplicit-function-declaration]
  127 |   print_uint16("yytranslate", yytranslate, YYMAXUTOK);
      |   ^~~~~~~~~~~~
gen_tables.c:130:3: warning: implicit declaration of function ‘print_char’; did you mean ‘putchar’? [-Wimplicit-function-declaration]
  130 |   print_char("yytname", yytname, YYNTOKENS + YYNNTS - 1);
      |   ^~~~~~~~~~
      |   putchar
gen_tables.c:135:3: warning: implicit declaration of function ‘print_int16’ [-Wimplicit-function-declaration]
  135 |   print_int16("yydefgoto", yydefgoto, YYNNTS - 1);
      |   ^~~~~~~~~~~
make[1]: *** [Makefile:138: c.tab.c] Error 1
make[1]: Leaving directory '/home/joey/IdeaProjects/superc/src/xtc/lang/cpp'
make: *** [Makefile:130: /home/joey/IdeaProjects/superc/src/xtc/lang/cpp.class] Error 2

YYUNDEFTOK is undefined in gen_tables.c, so I set it to:

#define YYUNDEFTOK YYSYMBOL_YYUNDEF

But I'm not sure if that was correct. After using that, I get the first error in my original post.

@jyapayne
Copy link
Author

It looks like I solved this by using version 3.0.2 of bison. It would be nice if it worked with the latest bison, but I understand that's probably not feasible. You can close the issue if you don't want to support the latest bison :) But maybe put in the readme which version it requires. I only found this version by accident in expression.bison_content

@paulgazz
Copy link
Owner

Thanks for the report and for figuring this out. I’ll leave it open and fix it, as supporting recent bison versions is a good idea.

The bison parse tables get converted to Java, and that converter is the likely culprit.

@paulgazz
Copy link
Owner

(Please see the referenced issue in the new repository.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants