Re: Jail compile error on CURRENT?
- In reply to: Warner Losh : "Re: Jail compile error on CURRENT?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 09 Aug 2023 12:48:24 UTC
On Mon, 7 Aug 2023 21:32:03 -0600 Warner Losh <imp@bsdimp.com> wrote: > On Mon, Aug 7, 2023, 5:55 PM Yuri <yuri@aetern.org> wrote: > > > James Gritton wrote: > > > On 2023-08-07 13:29, Dimitry Andric wrote: > > >> On 7 Aug 2023, at 04:50, Yoshihiro Ota <ota@j.email.ne.jp> wrote: > > >>> > > >>> Am I the only one seeing this error? > > >>> I'm on 12.4-RELEASE amd64 and building CURRENT as of now. > > >>> > > >>> jaillex.c:2228:43: error: unused parameter 'yyscanner' > > >>> [-Werror,-Wunused-parameter] > > >>> void *yyalloc (yy_size_t size , yyscan_t yyscanner) > > >>> ^ > > >>> jaillex.c:2233:58: error: unused parameter 'yyscanner' > > >>> [-Werror,-Wunused-parameter] > > >>> void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) > > >>> ^ > > >>> jaillex.c:2245:36: error: unused parameter 'yyscanner' > > >>> [-Werror,-Wunused-parameter] > > >>> void yyfree (void * ptr , yyscan_t yyscanner) > > >>> ^ > > >>> 6 errors generated. > > >>> *** [jaillex.o] Error code 1 > > >>> > > >> > > >> It seems you are not crazy. :) I can reproduce the error, and I think it > > >> might be caused by: > > >> > > >> > > https://cgit.freebsd.org/src/commit/?id=086e0149ae56641af245ce472e787c2f67d3aea5 > > >> > > >> However, as to why this does not result in an error (or even a warning) > > >> on -CURRENT, I have no clue. Maybe in the mean time flex in -CURRENT got > > >> updated... > > > > > > That is indeed the culprit. Fortunately, it builds from 13.2-RELEASE, > > > so building CURRENT from 12 can be done in two steps. I hate to be the > > > reason the update doesn't work directly, but the include capability I > > > added to jail(8) requires re-entrant lex, which apparently managed to > > > work around the error in 13. They reason it doesn't give a warning BTW > > > is these two lines that lex adds: > > > > > > struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; > > > (void)yyg; > > > > > > That makes yyscanner officially "used" even though its value is never > > > actually read. I suspect the version of lex in 12.4-RELEASE doesn't > > > have one or both of those lines. > > > > > > Perhaps you could add such lines to the offending functions yourself, > > > and continue the make. Or maybe build (and install) lex on its own > > > first; by the time you see this error, there should already be a newer > > > version of lex you could pop into place. > > > > > > There's probably something I should do to make this work better, or > > > perhaps some note I should put into UPDATING before 14.0 is released. > > > > Or there is already a recipe for bootstrapping lex in Makefile.inc1, > > though for somewhat older versions; possibly it could be updated for < 13? > > > > .if ${BOOTSTRAPPING} < 1000033 > > > > > When in doubt, adding BOOTSTRAPPING=0 can help...not sure why you'd need to > bootstrap lex though... > > Warner > Hi, thanks for many inputs. In short, 1. the toolchain lex doesn't work as is, 2. there are other errors I didn't paste originally and failing. In more details, I tried few ways to kick off lex toolchain build but still getting errors. The 2 belows are examples only 2 of my attempts while I tried few other ways to set this on. Try #1: ``` % setenv BOOTSTRAPPING 0 % make buildworld -j 4 ``` Try #2: ``` --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2305,7 +2305,7 @@ _zic= usr.sbin/zic # If you add a new bootstrap tool where we could also use the host version, # please ensure that you also add a .else case where you add the tool to the # _bootstrap_tools_links variable. -.if ${BOOTSTRAPPING} < 1000033 +.if ${BOOTSTRAPPING} < 1300033 # Note: lex needs m4 to build but m4 also depends on lex (which needs m4 to # generate any files). To fix this cyclic dependency we can build a bootstrap # version of m4 (with pre-generated files) then use that to build the real m4 ``` So, I looked at the generated file and grabbed one of function here: ``` void *yyalloc (yy_size_t size , yyscan_t yyscanner) { return (void *) malloc( size ); } ``` With above 2 and more attemps, I still kept getting the same error. So, I decided to fix my PATH (and started compiling usr.sbin/lex only) as below. This resulted picking up local lex and generated code looks a bit better. But there are few other errors as you can see below. (I had it originally but failed/missed to copy&paste sending the 1st email) ``` % find /usr/obj/usr/src/amd64.amd64/ -name lex -type f /usr/obj/usr/src/amd64.amd64/tmp/legacy/bin/lex /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/usr.bin/lex/lex % setenv PATH /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/usr.bin/lex:$PATH % cd /usr/src/usr.sbin/jail % make cc -O2 -pipe -fno-common -I. -I/usr/src/usr.sbin/jail -DINET6 -DINET -fPIE -g -gz=zlib -MD -MF.depend.jaillex.o -MTjaillex.o -std=gnu99 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unus ed-const-variable -Qunused-arguments -c jaillex.c -o jaillex.o jaillex.c:845:1: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] YY_DECL ^ /usr/src/usr.sbin/jail/jaillex.l:41:36: note: expanded from macro 'YY_DECL' #define YY_DECL int yylex(YYSTYPE *yylval, yyscan_t yyscanner) ^ ./y.tab.h:19:16: note: previous declaration is here extern YYSTYPE yylval; ^ /usr/src/usr.sbin/jail/jaillex.l:159:59: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] text2lval(size_t triml, size_t trimr, int tovar, YYSTYPE *yylval, ^ ./y.tab.h:19:16: note: previous declaration is here extern YYSTYPE yylval; ^ 2 errors generated. *** Error code 1 Stop. ```