westes / flex

The Fast Lexical Analyzer - scanner generator for lexing in C and C++
Other
3.56k stars 533 forks source link

pdf support is incomplete #537

Open dctaylor87 opened 2 years ago

dctaylor87 commented 2 years ago

Attempting to build flex.pdf fails.

Here's a patch to configure.ac to fix it so that 'make pdf' works:

diff --git a/configure.ac b/configure.ac index 9b5afd2..5eed27a 100644 --- a/configure.ac +++ b/configure.ac @@ -95,7 +95,12 @@ AC_PATH_PROG([HELP2MAN], help2man, [\${top_srcdir}/build-aux/missing help2man])

AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi]) AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],

wendajiang commented 2 years ago

Thanks! It's help. And I want to offer my question and how to resolve.

System is MacOS 12.4

make pdf throw error:

texi2dvi: Can't use option `--output' with more than one argument.

and run brew install texinfo to intall the newest version of texinfo toolset. It's work.

musvaage commented 1 year ago

OP's code sample wasn't enclosed to render patch syntax.

```patch

```

Since opening this issue the file has been changed.

$ date
Sun Mar 12 22:06:04 CET 2023
$ git clone -q https://github.com/westes/flex.git
$ ed -s flex/configure.ac <<<'118,123p'
AC_PATH_PROGS([TEXI2DVI], [gtexi2dvi texi2dvi], [\${top_srcdir}/build-aux/missing texi2dvi])
  AS_IF([test "$TEXI2DVI" = "\${top_srcdir}/build-aux/missing texi2dvi"],
    AC_MSG_WARN(texi2dvi: program not found: building pdf version of manual will not work)
  )

# Check for a m4 that supports -P
$ 

I am neither going to comment on any merits of this Issue nor on whether a patch is needed.

dctaylor87 commented 1 year ago

FYI, I am not a flex maintainer, nor do I have a Mac. I use GNU/Linux.

I just updated my clone of the GitHub flex repository and checked configure.ac. I noticed that changes have been made to the file, but my patch has not been applied (nor has PDF support been otherwise fixed).

If I correctly understand wendajiang's posting, her problem was solved by updating texinfo -- which suggests to me that configure.ac should either have a version check (I do not know when the required support was added to texinfo) or it should check to see if texi2dvi has the needed support.

Good luck, David

musvaage commented 1 year ago

workaround

clone repo and cd to flex directory

./autogen.sh && ./configure

sed -i "s#@TEXI2PDF@#/usr/bin/texi2pdf#g" doc/Makefile

make pdf

Mightyjo commented 1 year ago

The make pdf target is meant to be called from distribution sources. Have you tried running make distcheck to get a distro tarball, then expanding it and trying these targets in that folder?

That part of the build system has been stable since 2.6.4 if you want to download a ready tarball for testing.

musvaage commented 1 year ago

MacOS 12.4

possibly @wendajiang was using 2.6.4 (released on May 6, 2017)

adding a version check based on a coder's use of brew seems excessive

GNU/Linux

as per last comment of @dctaylor87 it's possibly inferred that the OP was using a clone prior to opening this ticket


flex.dvi and (as per my last comment) flex.pdf build on my Slackware box

$ ls /var/log/packages | grep texinfo
texinfo-6.8-x86_64-3
$ 
musvaage commented 1 year ago

stable since 2.6.4

$ tar xf flex-2.6.4.tar.gz
$ cd flex-2.6.4 && ./configure -silent
config.status: creating po/POTFILES
config.status: creating po/Makefile
$ 

running thereafter make pdf successfully builds flex.pdf

absent any other comments possibly this ticket can be closed as resolved

dctaylor87 commented 1 year ago

Okay. I just tried that. Did a 'make distcheck' Took the tarball, untarred it into /tmp/flex-2.6.4. Did './configure' and then ran 'make pdf'. Here's the output: taylor@bloomington:/tmp/flex-2.6.4$ make pdf Making pdf in src make[1]: Entering directory '/tmp/flex-2.6.4/src' make[1]: Nothing to be done for 'pdf'. make[1]: Leaving directory '/tmp/flex-2.6.4/src' Making pdf in doc make[1]: Entering directory '/tmp/flex-2.6.4/doc' TEXINPUTS="../build-aux:$TEXINPUTS" \ MAKEINFO='/bin/bash '/tmp/flex-2.6.4/build-aux/missing' makeinfo -I ./../examples/manual/ -I .' \ @TEXI2PDF@ -I ./../examples/manual/ --build-dir=flex.t2p -o flex.pdf \ flex.texi /bin/bash: line 1: @TEXI2PDF@: command not found make[1]: [Makefile:444: flex.pdf] Error 127 make[1]: Leaving directory '/tmp/flex-2.6.4/doc' make: [Makefile:545: pdf-recursive] Error 1 taylor@bloomington:/tmp/flex-2.6.4$ which makeinfo /usr/bin/makeinfo taylor@bloomington:/tmp/flex-2.6.4$ which texi2pdf /usr/bin/texi2pdf taylor@bloomington:/tmp/flex-2.6.4$

As you can see, makeinfo and texi2pdf are installed. But, 'make pdf' failed.

As to my suggestion about a version check for wendajiang's problem. It's not brew specific. if the build requires a feature that is only available in recent releases of a command, it is not unreasonable to check if the version installed is recent enough.

Mightyjo commented 1 year ago

Do you have a tex system like texlive installed?

On Fri, Mar 17, 2023, 15:01 dctaylor87 @.***> wrote:

Okay. I just tried that. Did a 'make distcheck' Took the tarball, untarred it into /tmp/flex-2.6.4. Did './configure' and then ran 'make pdf'. Here's the output: @.:/tmp/flex-2.6.4$ make pdf Making pdf in src make[1]: Entering directory '/tmp/flex-2.6.4/src' make[1]: Nothing to be done for 'pdf'. make[1]: Leaving directory '/tmp/flex-2.6.4/src' Making pdf in doc make[1]: Entering directory '/tmp/flex-2.6.4/doc' TEXINPUTS="../build-aux:$TEXINPUTS" MAKEINFO='/bin/bash '/tmp/flex-2.6.4/build-aux/missing' makeinfo -I ./../examples/manual/ -I .' @TEXI2PDF@ -I ./../examples/manual/ --build-dir=flex.t2p -o flex.pdf flex.texi /bin/bash: line 1: @TEXI2PDF@: command not found make[1]: [Makefile:444: flex.pdf] Error 127 make[1]: Leaving directory '/tmp/flex-2.6.4/doc' make: [Makefile:545: pdf-recursive] Error 1 @.:/tmp/flex-2.6.4$ which makeinfo /usr/bin/makeinfo @.:/tmp/flex-2.6.4$ which texi2pdf /usr/bin/texi2pdf @.:/tmp/flex-2.6.4$

As you can see, makeinfo and texi2pdf are installed. But, 'make pdf' failed.

As to my suggestion about a version check for wendajiang's problem. It's not brew specific. if the build requires a feature that is only available in recent releases of a command, it is not unreasonable to check if the version installed is recent enough.

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1474280410, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVJXIPMKPPDFCQUCWMPX2DW4SYG5ANCNFSM55BS6JNQ . You are receiving this because you commented.Message ID: @.***>

musvaage commented 1 year ago
$ grep texi2dvi $(which texi2pdf)
# Execute texi2dvi --pdf.
texi2dvi --pdf ${1+"$@"}
$ grep pdflatex $(which texi2dvi) | sed 1q
  -p, --pdf     use pdftex or pdflatex for processing
$ file $(which pdflatex)
/usr/bin/pdflatex: symbolic link to pdftex
$ 
dctaylor87 commented 1 year ago

Yes, I have TeX installed. And both of your grep's return the same result on my system as shown in your message.

texi2dvi --version reports that it is version 6.8. And tex --version reports that it is TeX 3.141592653 (TeX Live 2022/dev/Debian) kpathsea version 6.3.4/dev

This is in Ubuntu 22.04 (LTS), if that matters...

On Sat, Mar 18, 2023 at 3:57 PM musvaage @.***> wrote:

$ grep texi2dvi $(which texi2pdf)

Execute texi2dvi --pdf.

texi2dvi --pdf ${1+"$@"} $ grep pdflatex $(which texi2dvi) | sed 1q -p, --pdf use pdftex or pdflatex for processing $

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1474973206, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQW5RBGCKBHPFVFUSSZ34DW4YHS7ANCNFSM55BS6JNQ . You are receiving this because you authored the thread.Message ID: @.***>

musvaage commented 1 year ago

Ubuntu 22.04 (LTS)

I don't have access to that distribution and version.

$ pdftex --version | sed 1q
pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021 on Slackware)
$ 

texlive-2021.210418-x86_64-2.txz

Slackware's texlive is a single package whereas .deb and .rpm based distributions typically use multiple packages.

dctaylor87 commented 1 year ago

'pdftex --version | sed 1q' returns: pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)

I have TeX installed and have previously used it to produce PDF files using texi2pdf. With the small patch that I posted I was able to produce PDF from flex's texinfo file.

Mightyjo commented 1 year ago

I don't doubt you. I'm trying to decide whether it's a "will fix."

We don't include checks for "requirements" that are only needed by the maintainer sources. Someone building from a tarball shouldn't need texlive, for example. That makes problems like yours frustrating from all sides, I know.

The best diagnostic I can ask for is whether you have the same problem building from the last release tarball. That's meant to be portable so if you're having a problem with it it's a will fix.

If the problem only pops up when you build from a clone, we need to nail down your build environment to understand why we aren't seeing the same behavior. Right now it looks like you're in the next LTS version of Ubuntu up from the one the main branch expects. I haven't had time yet to see whether that makes a difference.

I'm not above overlooking my own assumptions. Mine are laid out in the build scripts in .github and in the contributing PR.

-Joe

On Tue, Mar 21, 2023, 12:04 dctaylor87 @.***> wrote:

'pdftex --version | sed 1q' returns: pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)

I have TeX installed and have previously used it to produce PDF files using texi2pdf. With the small patch that I posted I was able to produce PDF from flex's texinfo file.

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1478115698, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVJXIMYQIZUUIIQOLBICLDW5HGQFANCNFSM55BS6JNQ . You are receiving this because you commented.Message ID: @.***>

musvaage commented 1 year ago

https://github.com/westes/flex/issues/537#issuecomment-1472644388

@srivasta

Are you able to successfully build flex.pdf?

dctaylor87 commented 1 year ago

Sorry for the delay. If I take the 2.6.4 tarball, configure it, and say 'make pdf', it succeeds. But, if I take the top of the master branch, do a 'make distcheck', untar it in a clean directory, configure it, and then do a 'make pdf', it fails. So, something has changed to break it. If I apply my posted patch, it succeeds.

musvaage commented 1 year ago

Why are there 3 AC_MSG_WARN macros in the opening post?

dctaylor87 commented 1 year ago

When I first read this, my first thought was 'Huh?'. Then I realized that you were talking about the original issue, back in July, where I posted the patch.

The first two were fixing an unrelated issue. In the original code, after testing for DVI support, if it fails to find it, it prints a message about lacking PDF support. The first two AC_MSG_WARN are simply fixing the message to say dvi instead of pdf.

Perhaps it should have been a separate issue. It's a one line 'issue' immediately adjacent to the issue I was reporting.

The remaining AC_MSG_WARN is part of the check for TEXI2PDF -- if if doesn't find texi2pdf, it prints a message telling the user. It parallels the immediately preceding code that checks for texi2dvi and prints a message, using AC_MSG_WARN, if it is not found.

On Thu, Mar 30, 2023 at 4:10 PM musvaage @.***> wrote:

Why there are 3 AC_MSG_WARN macros in the Opening Post?

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1490885641, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASQW5RDQGTLNUL3HEW32JQDW6XSDZANCNFSM55BS6JNQ . You are receiving this because you authored the thread.Message ID: @.***>

Mightyjo commented 1 year ago

Thanks for checking that the last release works. I'll recheck that HEAD still works for me on my reference image, then try to understand what changed in 22.04 assuming 20.04 still works.

On Fri, Mar 31, 2023, 11:22 dctaylor87 @.***> wrote:

When I first read this, my first thought was 'Huh?'. Then I realized that you were talking about the original issue, back in July, where I posted the patch.

The first two were fixing an unrelated issue. In the original code, after testing for DVI support, if it fails to find it, it prints a message about lacking PDF support. The first two AC_MSG_WARN are simply fixing the message to say dvi instead of pdf.

Perhaps it should have been a separate issue. It's a one line 'issue' immediately adjacent to the issue I was reporting.

The remaining AC_MSG_WARN is part of the check for TEXI2PDF -- if if doesn't find texi2pdf, it prints a message telling the user. It parallels the immediately preceding code that checks for texi2dvi and prints a message, using AC_MSG_WARN, if it is not found.

On Thu, Mar 30, 2023 at 4:10 PM musvaage @.***> wrote:

Why there are 3 AC_MSG_WARN macros in the Opening Post?

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1490885641, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ASQW5RDQGTLNUL3HEW32JQDW6XSDZANCNFSM55BS6JNQ

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/westes/flex/issues/537#issuecomment-1492115357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVJXIIIW3C6VNGRFINBII3W63ZCBANCNFSM55BS6JNQ . You are receiving this because you commented.Message ID: @.***>

musvaage commented 1 year ago

I posted the patch

https://github.com/westes/flex/issues/537#issuecomment-1465302579

with syntax highlighting

It's easier to read a patch by posting its content enclosed in three backticks with GH Linguist patch designation.

without syntax highlighting

It's easier to read a patch by simply posting the shell output of cat my.patch enclosed in three backticks.