Skip to content

C & Java examples fail to run #24

@AlexPoupakis

Description

@AlexPoupakis

The examples are built without issue, but running them raises multiple warnings and errors. The message starts with

/tmp/pybison/pybison_Parser/tmp.y:9:1: warning: ‘dllexport’ attribute directive ignored [-Wattributes]
 __attribute__ ((dllexport)) char *rules_hash = "e75e4fff863f00275cca52cdad5000500054ed4d";
 ^~~~~~~~~~~~~
/tmp/pybison/pybison_Parser/tmp.y: In function ‘yyparse’:
/tmp/pybison/pybison_Parser/tmp.y:58:19: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
           $$ = (*py_callback)(

followed by many assignment from int without cast warnings and ends with

tmp.tab.c:6024:18: warning: passing argument 1 of ‘yyerror’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
In file included from /tmp/pybison/pybison_Parser/tmp.y:3:0:
/tmp/pybison/pybison_Parser/tmp.y:27:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int yyerror(char *msg);
     ^~~~~~~
/tmp/pybison/pybison_Parser/tmp.y: At top level:
/tmp/pybison/pybison_Parser/tmp.y:3444:1: warning: ‘dllexport’ attribute directive ignored [-Wattributes]
 {
 ^
/tmp/pybison/pybison_Parser/tmp.l:20:10: fatal error: tokens.h: No such file or directory
 #include "tokens.h"
          ^~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
  File "/usr/lib/python3.6/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/usr/lib/python3.6/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/lib/python3.6/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/usr/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'cc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c.py", line 1162, in <module>
    main(*(sys.argv[1:]))
  File "c.py", line 1157, in main
    p = Parser(verbose=verbose, keepfiles=keepfiles)
  File "/home/alex/.local/lib/python3.6/site-packages/bison/__init__.py", line 224, in __init__
    self.engine = ParserEngine(self)
  File "src/bison/cython/bison_.pyx", line 135, in bison.bison_.ParserEngine.__init__
  File "src/bison/cython/bison_.pyx", line 172, in bison.bison_.ParserEngine.openCurrentLib
  File "src/bison/cython/bison_.pyx", line 691, in bison.bison_.ParserEngine.buildLib
  File "/usr/lib/python3.6/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.6/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'cc' failed with exit status 1

I get the same message for both C and Java examples. The issue is similar to #19 and was supposedly fixed in the latest version.

OS: Ubuntu 18.04.5 (also tested on CentOS 7 & 8)

Tool versions: flex 2.6.4 (latest), bison 3.0.4 (latest), pybison 0.2.9 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions