n-t-roff / heirloom-doctools

The Heirloom Documentation Tools: troff, nroff, and related utilities
http://n-t-roff.github.io/heirloom/doctools.html
Other
127 stars 23 forks source link

Build problem #85

Open aksr opened 5 years ago

aksr commented 5 years ago

After updating bison from 3.1 to 3.2:

cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE   -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  diacrit.o e.o eqnbox.o font.o fromto.o funny.o glob.o integral.o io.o lex.o lookup.o mark.o matrix.o move.o over.o paren.o pile.o shift.o size.o sqrt.o text.o version.o  -o eqn
/usr/bin/ld: eqnbox.o: in function `eqnbox':
eqnbox.c:(.text+0x37): undefined reference to `yyval'
/usr/bin/ld: eqnbox.c:(.text+0xa4): undefined reference to `yyval'
/usr/bin/ld: font.o: in function `setfont':
font.c:(.text+0xb): undefined reference to `yyval'
/usr/bin/ld: font.o: in function `font':
font.c:(.text+0xe1): undefined reference to `yyval'
/usr/bin/ld: font.c:(.text+0x19b): undefined reference to `yyval'
/usr/bin/ld: font.o:font.c:(.text+0x1bf): more undefined references to `yyval' follow
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:125: eqn] Error 1

Edit: The build problem is also reproducible with the latest bison (3.3.2). Edit²: This build problem will be more evident in a near future (a few months, I think), when the most distrubutions have their bison updated.

n-t-roff commented 5 years ago

There is a sed script which likely needs to be adjusted to make access to yyval. This had already been the case one time. If that works again I'll address that next week. Else it could be more work... Thank you for reporting it.

n-t-roff commented 5 years ago

The fix should solve the issue. I could not test it on non-bison systems, unfortunately.

aksr commented 5 years ago

Fixed, thank you.

n-t-roff commented 4 years ago

The issue reappeared with bison 3.5. Does someone has the time to fix it? Preferably by fixing the source code to not need the sed script anymore.

nmeum commented 4 years ago

A workaround seems to be using byacc (or some other yacc implementation) instead of bison.

n-t-roff commented 4 years ago

IMHO it is not really a bison issue but rather that the source code does use yacc internal variables which is a software design issue which should be fixed. It would make the software independent of the actual parser generator. It is not much work but unfortunately I don't have the time. IMHO bison is not referred anyway but $(YACC) instead, so the configure script could be adjusted for example. But it would be better to fix eqn from the ancient design bug.

nmeum commented 4 years ago

But it would be better to fix eqn from the ancient design bug.

Totally agree, just needed a quick build fix for the Alpine package.

n-t-roff commented 3 years ago

The software does still not build on systems with new bison versions. There are just some trivial changes required to fix the issue, but unfortunately I don't have the time. IIRC I had fixed the same issue for DWB in the past. I did not fix heirloom at that time since Gunnar had provided a sed script which did work these days. This sed script had not been a good idea and it should eventually be removed now. Does someone has some time an C knowledge to fix it?

meolar commented 3 years ago

I am trying to build the Heirloom version of groff on Void Linux without success.

I tried installing byacc, based on a comment I found above. However, xbps would not let me remove bison, saying it would break installed packages (base-devel and flex).

I had some e-mail correspondence with someone who very kindly tried to help, but does not have sufficient time to fix it. So, at this point, I don't have a solution. I'm hoping someone might be able to help here.

Based on the aforementioned e-mail correspondence, here is what I learned:

  1. It seems that the problem is in the lexer.
  2. Most files in the heirloom/eqn directory are affected
  3. The required changes are trivial variable name changes.
  4. Fixing it requires significant knowledge of YACC, LEX, and c.

Unfortunately, that list is beyond the scope of my knowledge. If anyone could help, I would appreciate it.

Below is the latter part of the output I got from running make.

cc   -D_GNU_SOURCE   -I. -I.. -I../../include  -c ../version.c
cc   -D_GNU_SOURCE     diacrit.o e.o eqnbox.o font.o fromto.o funny.o glob.o integral.o io.o lex.o lookup.o mark.o matrix.o move.o over.o paren.o pile.o shift.o size.o sqrt.o text.o version.o  -o eqn
/bin/ld: eqnbox.o: in function `eqnbox':
eqnbox.c:(.text+0x16): undefined reference to `yyval'
/bin/ld: eqnbox.c:(.text+0x175): undefined reference to `yyval'
/bin/ld: eqnbox.c:(.text+0x196): undefined reference to `yyval'
/bin/ld: eqnbox.c:(.text+0x1cb): undefined reference to `yyval'
/bin/ld: eqnbox.c:(.text+0x2c6): undefined reference to `yyval'
/bin/ld: font.o:font.c:(.text+0x15): more undefined references to `yyval' follow
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:125: eqn] Error 1
make[1]: Leaving directory '/home/meolar/Downloads/heirloom-groff/heirloom-doctools/eqn/eqn.d'
make: *** [makefile:52: all] Error 2
n-t-roff commented 3 years ago

What did work for me to force to use byacc when bison is installed is to run

YACC=/usr/bin/byacc
export YACC

before running

make mrproper
./configure
make
meolar commented 3 years ago

Thanks for the suggestion n-t-roff. I tried it, but I still get errors.

Here is the output from ./configure

Checking for make(1) ... yes Checking for $(LEX) ... yes Checking for strlcpy(3) ... no Checking for strlcat(3) ... no Checking for wcslcpy(3) ... no

Here is the output from make

cat cfg.mk stuff/bst/Makefile.mk >stuff/bst/Makefile cat cfg.mk eqn/eqn.d/Makefile.mk >eqn/eqn.d/Makefile cat cfg.mk eqn/neqn.d/Makefile.mk >eqn/neqn.d/Makefile cat cfg.mk eqn/checkeq.d/Makefile.mk >eqn/checkeq.d/Makefile cat cfg.mk eqn/eqnchar.d/Makefile.mk >eqn/eqnchar.d/Makefile cat cfg.mk tbl/Makefile.mk >tbl/Makefile cat cfg.mk pic/Makefile.mk >pic/Makefile cat cfg.mk grap/Makefile.mk >grap/Makefile cat cfg.mk vgrind/Makefile.mk >vgrind/Makefile cat cfg.mk refer/Makefile.mk >refer/Makefile cat cfg.mk mpm/Makefile.mk >mpm/Makefile cat cfg.mk troff/libhnj/Makefile.mk >troff/libhnj/Makefile cat cfg.mk troff/libhnj/hyphen.d/Makefile.mk >troff/libhnj/hyphen.d/Makefile cat cfg.mk troff/troff.d/font/Makefile.mk >troff/troff.d/font/Makefile cat cfg.mk troff/troff.d/font/devhtml/Makefile.mk >troff/troff.d/font/devhtml/Makefile cat cfg.mk troff/troff.d/tmac.d/Makefile.mk >troff/troff.d/tmac.d/Makefile cat cfg.mk troff/troff.d/postscript/Makefile.mk >troff/troff.d/postscript/Makefile cat cfg.mk troff/troff.d/Makefile.mk >troff/troff.d/Makefile cat cfg.mk troff/troff.d/dpost.d/Makefile.mk >troff/troff.d/dpost.d/Makefile cat cfg.mk troff/troff.d/dhtml/Makefile.mk >troff/troff.d/dhtml/Makefile cat cfg.mk troff/nroff.d/Makefile.mk >troff/nroff.d/Makefile cat cfg.mk troff/nroff.d/terms.d/Makefile.mk >troff/nroff.d/terms.d/Makefile cat cfg.mk picpack/Makefile.mk >picpack/Makefile cat cfg.mk checknr/Makefile.mk >checknr/Makefile cat cfg.mk ptx/Makefile.mk >ptx/Makefile cat cfg.mk soelim/Makefile.mk >soelim/Makefile cat cfg.mk col/Makefile.mk >col/Makefile for i in stuff/bst eqn/eqn.d eqn/neqn.d eqn/checkeq.d eqn/eqnchar.d tbl pic grap vgrind refer mpm troff/libhnj troff/libhnj/hyphen.d troff/troff.d/font troff/troff.d/font/devhtml troff/troff.d/tmac.d troff/troff.d/postscript troff/troff.d troff/troff.d/dpost.d troff/troff.d/dhtml troff/nroff.d troff/nroff.d/terms.d picpack checknr ptx soelim col; \ do \ (cd "$i" && make all) || exit; \ done make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/stuff/bst' cc -c -o bst.o bst.c make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/stuff/bst' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/eqn.d' /usr/bin/byacc -d ../e.y /usr/bin/byacc: 85 shift/reduce conflicts, 71 reduce/reduce conflicts. sed -f ../yyval.sed <y.tab.c >e.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../diacrit.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c e.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../eqnbox.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../font.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../fromto.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../funny.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../glob.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../integral.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../io.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../lex.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../lookup.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../mark.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../matrix.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../move.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../over.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../paren.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../pile.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../shift.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../size.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../sqrt.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../text.c cc -D_GNU_SOURCE -I. -I.. -I../../include -c ../version.c cc -D_GNU_SOURCE diacrit.o e.o eqnbox.o font.o fromto.o funny.o glob.o integral.o io.o lex.o lookup.o mark.o matrix.o move.o over.o paren.o pile.o shift.o size.o sqrt.o text.o version.o -o eqn sed 's"/usr/pub/"/usr/local/pub/"' eqnchar.7.in > eqnchar.7 make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/eqn.d' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/neqn.d' /usr/bin/byacc -d ../e.y /usr/bin/byacc: 85 shift/reduce conflicts, 71 reduce/reduce conflicts. sed -f ../yyval.sed <y.tab.c >e.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../diacrit.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c e.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../eqnbox.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../font.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../fromto.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../funny.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../glob.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../integral.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../io.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../lex.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../lookup.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../mark.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../matrix.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../move.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../over.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../paren.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../pile.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../shift.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../size.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../sqrt.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../text.c cc -D_GNU_SOURCE -I. -I.. -I../../include -DNEQN -c ../version.c cc -D_GNU_SOURCE diacrit.o e.o eqnbox.o font.o fromto.o funny.o glob.o integral.o io.o lex.o lookup.o mark.o matrix.o move.o over.o paren.o pile.o shift.o size.o sqrt.o text.o version.o -o neqn make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/neqn.d' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/checkeq.d' cc -D_GNU_SOURCE -c checkeq.c cc -D_GNU_SOURCE checkeq.o -o checkeq make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/checkeq.d' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/eqnchar.d' cc -D_GNU_SOURCE -DEUC -c genutf8.c cc -D_GNU_SOURCE genutf8.o -o genutf8 ./genutf8 >utf-8 make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/eqn/eqnchar.d' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/tbl' cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t0.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t1.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t2.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t3.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t4.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t5.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t6.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t7.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t8.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c t9.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tb.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tc.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c te.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tf.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tg.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c ti.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tm.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c ts.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tt.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tu.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c tv.c cc -D_GNU_SOURCE -DMACDIR='"/usr/local/ucblib/doctools/tmac"' -I../include -c version.c cc -D_GNU_SOURCE t0.o t1.o t2.o t3.o t4.o t5.o t6.o t7.o t8.o t9.o tb.o tc.o te.o tf.o tg.o ti.o tm.o ts.o tt.o tu.o tv.o version.o -o tbl make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/tbl' make[1]: Entering directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/pic' /usr/bin/byacc -d picy.y /usr/bin/byacc: 208 shift/reduce conflicts. mv -f y.tab.c picy.c lex -t picl.l > picl.c 1522/1700 nodes(%e), 4103/5000 positions(%p), 599/700 (%n), 42186 transitions , 145/150 packed char classes(%k), 1732/1800 packed transitions(%a), 1412/1600 output slots(%o) cc -D_GNU_SOURCE -I../include -c arcgen.c cc -D_GNU_SOURCE -I../include -c blockgen.c cc -D_GNU_SOURCE -I../include -c boxgen.c cc -D_GNU_SOURCE -I../include -c circgen.c cc -D_GNU_SOURCE -I../include -c for.c cc -D_GNU_SOURCE -I../include -c input.c input.c: In function 'pushsrc': input.c:41:11: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 41 | srcp->sp = ptr; | ^ cc -D_GNU_SOURCE -I../include -c linegen.c cc -D_GNU_SOURCE -I../include -c main.c cc -D_GNU_SOURCE -I../include -c misc.c cc -D_GNU_SOURCE -I../include -c movegen.c cc -D_GNU_SOURCE -I../include -c picl.c cc -D_GNU_SOURCE -I../include -c picy.c cc -D_GNU_SOURCE -I../include -c pltroff.c cc -D_GNU_SOURCE -I../include -c print.c cc -D_GNU_SOURCE -I../include -c symtab.c cc -D_GNU_SOURCE -I../include -c textgen.c cc -D_GNU_SOURCE -I../include -c version.c cc -D_GNU_SOURCE arcgen.o blockgen.o boxgen.o circgen.o for.o input.o linegen.o main.o misc.o movegen.o picl.o picy.o pltroff.o print.o symtab.o textgen.o version.o -lm -o pic /bin/ld: picl.o: in function yylex': picl.c:(.text+0xc9): undefined reference toyywrap' collect2: error: ld returned 1 exit status make[1]: [Makefile:126: pic] Error 1 make[1]: Leaving directory '/home/me/0-old-disk/rust/Downloads/heirloom-doctools/pic' make: [makefile:52: all] Error 2

A search https://en.wikibooks.org/wiki/C_Programming/C_Reference/nonstandard/strlcpy said strlcpy and strlcat are in libbsd, but that package is already installed.

I couldn’t find with any certainty where wcslcpy was, but I think it may be in libbsd also based on https://man.cx/libbsd(7)

I tried installing libbsd-devel, but the output was the same.

n-t-roff commented 3 years ago

Is flex installed?

n-t-roff commented 3 years ago

Normally the -devel packages are required in the build process. But IMHO strlcpy is not really required. It is just when it is available.

If flex is installed and the ./configure script does not automatically select it you could force to use it the same way as for byacc:

LEX=path_to_flex
export LEX

then the same commands as posted above. (Don't forget make mrproper before configure.)

meolar commented 3 years ago

I didn't have flex install. Oops! Thanks for pointing that out.

I think it may be installed, but I'm not sure. I'm trying to see if a small example file will work to test and know for sure. Regular groff still works normally, but I'm not sure how to access Heirloom troff. I don't know where the binary file is.

I made a sample file I called temp.groff with an OpenType font to test something that gnu troff cannot do.

.do xflag 3
.sp 1i
.ps 20
.vs 24
.fp 0 IC Inconsolata.otf
.ft IC
Hello
.br
ABCDEFGHIJKLMNOPQ
.br
abcdefghijklmnopq

Then I set the environment variable to where the Inconsolate.otf file is located. TROFFONTS=/usr/share/fonts/OTF

Then, I tried running troff temp.groff > temp.ps which returned

troff: temp.groff:5: warning: can't find font 'Inconsolata.otf'
troff: temp.groff:6: warning: can't find font 'IC'

It looks like gnu troff is trying to process it.

and

troff temp.groff | dpost > temp.ps which returned

bash: dpost: command not found
troff: temp.groff:5: warning: can't find font 'Inconsolata.otf'
troff: temp.groff:6: warning: can't find font 'IC'
meolar commented 3 years ago

groff temp.groff | zathura - shows the document, but it gives the font warnings listed above and does not use the correct font.

meolar commented 3 years ago

More failed guesses:

/usr/local/ucb/troff temp.groff | zathura -
/usr/local/ucb/troff | /usr/local/ucb/dpost temp.groff | zathura -

I'll keep digging.

n-t-roff commented 3 years ago

What do you mean by failed guesses? The binary and all helper tools need taken from /usr/local/ucb. Maybe you should temporarily put this path in front of the PATH variable. When the tools are there then it has been installed. Anyway make install should complain when when the build or install would not have succeeded.

/usr/local/ucb/troff temp.groff | /usr/local/ucb/dpost > file.ps

should produce a PostScript file (as you wrote above without the full path).

meolar commented 3 years ago

I figured out what I did wrong!

I didn't export TROFFONTS

Thank you for being so patient and helpful.

andlabs commented 7 months ago

bison 3.8.2 on macOS 10.12 via MacPorts here. YYTYPE_UINT8 is no longer anywhere in y.tab.c, so the sed script no longer does anything. I changed the script to add the global variable after extern YYSTYPE yylval; instead, and that works.

Thanks for keeping these tools alive!