Page MenuHome GnuPG

asn1-parse.y:861:20: error: 'yytoknum' undeclared
Open, HighPublic


I'm getting a build error when compiling libksba git master commit ce1de8cb2bcd712381f77519de4da87af42879a4 under Gentoo Linux using GCC 12.0.0-commit-34fac9ef724ab7c1bee69aaa214327e2cb8bef30-20210920. Here is a snippet of the error with the full log attached.


libtool: link: x86_64-pc-linux-gnu-ar cr .libs/libgnu.a .libs/dummyobj.o
libtool: link: x86_64-pc-linux-gnu-ranlib .libs/libgnu.a
libtool: link: ( cd ".libs" && rm -f "" && ln -s "../" "" )
make[3]: Leaving directory '/var/tmp/portage/dev-libs/libksba-9999/work/libksba-9999/gl'
make[2]: Leaving directory '/var/tmp/portage/dev-libs/libksba-9999/work/libksba-9999/gl'
Making all in src
make[2]: Entering directory '/var/tmp/portage/dev-libs/libksba-9999/work/libksba-9999/src'
test -f asn1-parse.c || /bin/sh ../build-aux/ylwrap asn1-parse.y asn1-parse.c echo asn1-parse.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/ y.output asn1-parse.output -- bison -o
x86_64-pc-linux-gnu-gcc \

 -I. -DBUILD_GENTOOLS -o asn1-gentables \
./asn1-gentables.c \
        `test -f 'asn1-parse.c' || echo './'`asn1-parse.c  \
        ./asn1-func.c      \

asn1-parse.y: In function 'yylex':
asn1-parse.y:861:20: error: 'yytoknum' undeclared (first use in this function)

861 |             return yytoknum[k];                                                                                                                                                        
    |                    ^~~~~~~~

asn1-parse.y:861:20: note: each undeclared identifier is reported only once for each function it appears in
make[2]: * [Makefile:1245: asn1-gentables] Error 1
make[2]: Leaving directory '/var/tmp/portage/dev-libs/libksba-9999/work/libksba-9999/src'
* [Makefile:486: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-libs/libksba-9999/work/libksba-9999'
make: *** [Makefile:418: all] Error 2



Event Timeline

werner added a subscriber: werner.

Sorry, I don't know which software has version 12.0.0 and which git master this is. In case this is stock libksba, please tell us at least the last commit id. Note that we in general do not support arbitrary versions from the repos but only released versions .

shoober420 changed Version from git master as of 09-21-21 to ce1de8cb2bcd712381f77519de4da87af42879a4.

Sorry about that, I forgot to add GCC. I updated the original post with the needed information.

werner triaged this task as Normal priority.Wed, Sep 22, 9:55 PM
werner added a project: toolchain.

Looks like yytoknum was removed from Bison in version 3.8:

I ran into this issue also on my distro. I was unable to build libksba-1.6.0 from git, so I temporarily switched to a tarball. GCC 11.2.0 if that's at all relevant

werner raised the priority of this task from Normal to High.Mon, Oct 11, 5:49 PM

Thanks for your findings. I recall that I read this in the announcement and cursed about this new tendency in GNU to break long standing APIs.

We need to detect this and apply a workaround.

gniibe added a subscriber: gniibe.

I think that a simple way is defining a table (string -> token) by ourselves in yylex, not enabling %token-table.
(Then, we don't need to depend on the feature of string with %token, which is not supported by POSIX yacc.)

Bison used to be the de-facto standard yacc ;-)