Skip to content

Compilation error: conflicting types for 'yyerror' and ‘yylex’ (Bison 3.8) #52

@vasdommes

Description

@vasdommes

MPSolve (the latest master, 8450a4d) does not compile with Bison 3.8 (installed from http://ftp.gnu.org/gnu/bison/bison-3.8.tar.xz)
WSL Ubuntu-22.04, GCC 11.4

Note that it compiles with Bison 3.8.2.

Error from make:

monomial/yacc-parser.c:189:6: error: conflicting types for ‘yyerror’; have ‘void(void *, void *, const char *)’
  189 | void yyerror (void * scanner, void * data, const char *msg);
      |      ^~~~~~~
monomial/yacc-parser.y:39:14: note: previous declaration of ‘yyerror’ with type ‘int(void *, void *, const char *)’
   39 |   extern int yyerror(void*,void*,const char*);
      |              ^~~~~~~
monomial/yacc-parser.c:192:5: error: conflicting types for ‘yylex’; have ‘int(mps_formal_polynomial **, void *, void *)’
  192 | int yylex (YYSTYPE *yylvalp, void * scanner, void * data);
      |     ^~~~~
monomial/yacc-parser.y:38:14: note: previous declaration of ‘yylex’ with type ‘int(void *, void *, void *)’
   38 |   extern int yylex(void * yylval, void * scanner, void * data);
      |              ^~~~~

Full output:

$ ./autogen.sh 

 ****************************************
 *** MPSolve is initializing autoconf ***
 ***                                  ***
 *** Please use this command only if  ***
 *** you checked out the source from  ***
 *** the git repository!              ***
 ****************************************

libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:135: warning: The macro `AC_PROG_CC_C99' is obsolete.
configure.ac:135: You should run autoupdate.
./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
configure.ac:135: the top level
configure.ac:137: warning: AC_PROG_LEX without either yywrap or noyywrap is obsolete
./lib/autoconf/programs.m4:716: _AC_PROG_LEX is expanded from...
./lib/autoconf/programs.m4:709: AC_PROG_LEX is expanded from...
aclocal.m4:944: AM_PROG_LEX is expanded from...
configure.ac:137: the top level
configure.ac:210: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:210: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
m4/acx_pthread.m4:63: ACX_PTHREAD is expanded from...
configure.ac:210: the top level
configure.ac:210: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:210: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
m4/acx_pthread.m4:63: ACX_PTHREAD is expanded from...
configure.ac:210: the top level
configure.ac:261: warning: The macro `AC_TRY_RUN' is obsolete.
configure.ac:261: You should run autoupdate.
./lib/autoconf/general.m4:2997: AC_TRY_RUN is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
m4/ax_func_snprintf.m4:30: AX_FUNC_SNPRINTF is expanded from...
configure.ac:261: the top level
configure.ac:23: installing './compile'
configure.ac:25: installing './missing'
examples/C/Makefile.am: installing './depcomp'
examples/python/Makefile.am:5: installing './py-compile'
parallel-tests: installing './test-driver'
configure.ac: installing './ylwrap'

$ YACC=$HOME/install/bison/3.8/bin/yacc ./configure --prefix=$HOME/install --disable-dependency-tracking --disable-examples --disable-ui --disable-graphical-debugger --disable-documentation
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... none
checking whether make supports nested variables... (cached) yes
checking for gfortran... gfortran
checking whether the compiler supports GNU Fortran... yes
checking whether gfortran accepts -g... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gfortran option to produce PIC... -fPIC
checking if gfortran PIC flag -fPIC works... yes
checking if gfortran static flag -static works... yes
checking if gfortran supports -c -o file.o... yes
checking if gfortran supports -c -o file.o... (cached) yes
checking whether the gfortran linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking dependency style of g++... none
checking for bison... /home/vasdommes/install/bison/3.8/bin/yacc
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking for library containing yywrap... -ll
checking whether yytext is a pointer... yes
checking for inline... inline
checking whether C compiler accepts -fcx-limited-range... yes
checking whether C compiler accepts -fno-math-errno... yes
checking whether C compiler accepts -fomit-frame-pointer... yes
checking for _Bool... yes
checking for stdbool.h that conforms to C99... yes
checking for size_t... yes
checking for error_at_line... yes
checking for memset... yes
checking for modf... yes
checking for pow... no
checking for sqrt... no
checking for strchr... yes
checking for Win32 platform... no
checking for __attribute__((visibility("hidden")))... yes
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking whether to check for GCC pthread/shared inconsistencies... yes
checking whether -pthread is sufficient with -shared... yes
checking whether what we have so far is sufficient with -nostdlib... yes
checking if sysconf(_SC_NPROCESSORS_ONLN) is supported... yes
checking for malloc in -ltcmalloc_minimal... no
checking for snprintf... yes
checking for vsnprintf... yes
checking for working snprintf... yes
checking for working vsnprintf... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getline... yes
checking for strndup... yes
checking if C99 complex.h is supported from the C++ compiler... no
checking for pow in -lm... yes
checking for __gmpz_init2 in -lgmp... yes
checking for main in -lgmpxx... yes
checking for gmp.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for check >= 0.9.4... no
checking for gtk+-3.0... no
checking for gtk+-2.0... no
checking for cairo... no
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 3.10
checking for python platform... linux
checking for GNU default python prefix... ${prefix}
checking for GNU default python exec_prefix... ${exec_prefix}
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.10/site-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.10/site-packages
checking for python3.10-config... /usr/bin/python3.10-config
checking python include flags... -I/usr/include/python3.10 -I/usr/include/python3.10
checking python module: ctypes... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/mps/Makefile
config.status: creating include/mps/private/Makefile
config.status: creating examples/Makefile
config.status: creating examples/C/Makefile
config.status: creating examples/fortran/Makefile
config.status: creating examples/octave/Makefile
config.status: creating examples/matlab/Makefile
config.status: creating examples/gtk/Makefile
config.status: creating examples/python/Makefile
config.status: creating examples/python/tests/Makefile
config.status: creating examples/mandelbrot-solver/Makefile
config.status: creating examples/mandelbrot-solver/mandelbrot-solver.1
config.status: creating examples/quadratic-solver/Makefile
config.status: creating examples/quadratic-solver/quadratic-solver.1
config.status: creating include/mps/mt.h
config.status: creating include/mps/version.h
config.status: creating src/Makefile
config.status: creating src/mpsolve/Makefile
config.status: creating src/mpsolve/mpsolve.1
config.status: creating src/libmps/Makefile
config.status: creating src/tests/Makefile
config.status: creating src/xmpsolve/Makefile
config.status: creating src/xmpsolve/xmpsolve.desktop
config.status: creating src/xmpsolve/xmpsolve.1
config.status: creating doc/Makefile
config.status: creating doc/Doxyfile
config.status: creating mime/Makefile
config.status: creating config.h
config.status: executing libtool commands
config.status: executing depfiles commands


MPSolve configuration:

        Source location:        .
        Pthread CFLAGS:         
        C compiler:             gcc
        CFLAGS:                 -D_REENTRANT -Wall -DMPS_USE_BUILTIN_COMPLEX  -DNICE_DEBUG -fcx-limited-range -fno-math-errno -fomit-frame-pointer -D_MPS_PRIVATE
        LDFLAGS:                 
        Additional CFLAGS:      -g -O2
        Debug enabled:          yes
        Check enabled:          no
        Octave module:          no
        MATLAB (tm) module:     no
        Graphical UI:           no
        Python module:          yes

Type 'make' to compile MPSolve, and then make install
to install the binaries, the library and the headers
system-wide.


$ make
make  all-recursive
make[1]: Entering directory '/home/vasdommes/bootstrap/MPSolve'
Making all in include
make[2]: Entering directory '/home/vasdommes/bootstrap/MPSolve/include'
Making all in mps
make[3]: Entering directory '/home/vasdommes/bootstrap/MPSolve/include/mps'
Making all in private
make[4]: Entering directory '/home/vasdommes/bootstrap/MPSolve/include/mps/private'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/include/mps/private'
make[4]: Entering directory '/home/vasdommes/bootstrap/MPSolve/include/mps'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/include/mps'
make[3]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/include/mps'
make[3]: Entering directory '/home/vasdommes/bootstrap/MPSolve/include'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/include'
make[2]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/include'
Making all in src
make[2]: Entering directory '/home/vasdommes/bootstrap/MPSolve/src'
Making all in libmps
make[3]: Entering directory '/home/vasdommes/bootstrap/MPSolve/src/libmps'
  YACC     monomial/yacc-parser.c
/home/vasdommes/bootstrap/MPSolve/src/libmps/monomial/yacc-parser.y:1.1-12: warning: POSIX Yacc does not support %pure-parser [-Wyacc]
    1 | %pure-parser
      | ^~~~~~~~~~~~
/home/vasdommes/bootstrap/MPSolve/src/libmps/monomial/yacc-parser.y:1.1-12: warning: deprecated directive: ‘%pure-parser’, use ‘%define api.pure’ [-Wdeprecated]
    1 | %pure-parser
      | ^~~~~~~~~~~~
      | %define api.pure
/home/vasdommes/bootstrap/MPSolve/src/libmps/monomial/yacc-parser.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
updating monomial/yacc-parser.h
make  all-am
make[4]: Entering directory '/home/vasdommes/bootstrap/MPSolve/src/libmps'
  CC       chebyshev/chebyshev-evaluation.lo
  CC       chebyshev/chebyshev-parser.lo
  CC       chebyshev/chebyshev.lo
  CC       common/aberth.lo
  CC       common/approximation.lo
  CC       common/cluster-analysis.lo
  CC       common/cluster.lo
  CC       common/context.lo
  CC       common/convex.lo
  CC       common/defaults.lo
  CC       common/file-starting.lo
  CC       common/improve.lo
  CC       common/inclusion.lo
  CC       common/inline-poly-parser.lo
  CC       common/interface.lo
  CC       common/jacobi-aberth.lo
  CC       common/list-element.lo
  CC       common/list.lo
  CC       common/modify.lo
  CXX      common/nroots-polynomial.lo
  CC       common/parser.lo
  CC       common/polynomial.lo
  CXX      common/polynomialxx.lo
  CC       common/recursive-starting.lo
  CC       common/sort.lo
  CC       common/starting-configuration.lo
  CC       common/starting.lo
  CC       common/strndup.lo
  CC       common/test.lo
  CC       common/tools.lo
  CC       common/touch.lo
  CC       common/user.lo
  CC       common/utils.lo
  CC       common/version.lo
  CC       common/validation.lo
  CXX      formal/formal-monomial.lo
  CXX      formal/formal-polynomial.lo
  CC       floating-point/gmptools.lo
  CC       floating-point/link.lo
  CC       floating-point/mpc.lo
  CC       floating-point/mt.lo
  CC       general/general-radius.lo
  CC       general/general-starting.lo
  CC       matrix/hessenberg-determinant.lo
  CC       monomial/horner.lo
  CC       monomial/monomial-matrix-poly.lo
  CC       monomial/monomial-parser.lo
  CC       monomial/monomial-poly.lo
  CC       monomial/monomial-threading.lo
  CC       monomial/newton.lo
  CC       monomial/yacc-parser.lo
monomial/yacc-parser.c:189:6: error: conflicting types for ‘yyerror’; have ‘void(void *, void *, const char *)’
  189 | void yyerror (void * scanner, void * data, const char *msg);
      |      ^~~~~~~
monomial/yacc-parser.y:39:14: note: previous declaration of ‘yyerror’ with type ‘int(void *, void *, const char *)’
   39 |   extern int yyerror(void*,void*,const char*);
      |              ^~~~~~~
monomial/yacc-parser.c:192:5: error: conflicting types for ‘yylex’; have ‘int(mps_formal_polynomial **, void *, void *)’
  192 | int yylex (YYSTYPE *yylvalp, void * scanner, void * data);
      |     ^~~~~
monomial/yacc-parser.y:38:14: note: previous declaration of ‘yylex’ with type ‘int(void *, void *, void *)’
   38 |   extern int yylex(void * yylval, void * scanner, void * data);
      |              ^~~~~
make[4]: *** [Makefile:1511: monomial/yacc-parser.lo] Error 1
make[4]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/src/libmps'
make[3]: *** [Makefile:852: all] Error 2
make[3]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/src/libmps'
make[2]: *** [Makefile:433: all-recursive] Error 1
make[2]: Leaving directory '/home/vasdommes/bootstrap/MPSolve/src'
make[1]: *** [Makefile:492: all-recursive] Error 1
make[1]: Leaving directory '/home/vasdommes/bootstrap/MPSolve'
make: *** [Makefile:424: all] Error 2

$ $HOME/install/bison/3.8/bin/bison --version
bison (GNU Bison) 3.8
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2021 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.

$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0
Copyright (C) 2021 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions