Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failure building using pdfpages package #43

Open
jmelahman opened this issue Oct 14, 2020 · 4 comments
Open

failure building using pdfpages package #43

jmelahman opened this issue Oct 14, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@jmelahman
Copy link

BUILD

load("@bazel_latex//:latex.bzl", "latex_document")

latex_document(
    name = "cover_letter_resume",
    main = "cover_letter_resume.tex",
    srcs = [
        ":cover_letter.pdf",
        ":resume.pdf",
        "@bazel_latex//packages:calc",
        "@texlive_texmf__texmf-dist__tex__generic__ifxetex",
        "@texlive_texmf__texmf-dist__tex__generic__oberdiek",
        "@texlive_texmf__texmf-dist__tex__latex__pdfpages",
        "@texlive_texmf__texmf-dist__tex__latex__eso-pic",
        "@texlive_texmf__texmf-dist__tex__latex__graphics",
        "@texlive_texmf__texmf-dist__tex__latex__oberdiek",
    ],
)

cover_letter_resume.tex

\documentclass{report}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{cover_letter.pdf}
\includepdf[pages=-]{resume.pdf}
\end{document}
$ bazel build src:cover_letter_resume --verbose_failures
INFO: Analyzed target //src:cover_letter_resume (1 packages loaded, 4 targets configured).
INFO: Found 1 target...
ERROR: /home/lahmanja/code/resume/src/BUILD:19:15: LuaLatex src/cover_letter_resume.pdf failed (Exit 1): run_lualatex failed: error executing command 
  (cd /home/lahmanja/.cache/bazel/_bazel_lahmanja/a1e01723933a64fd774eb9f1c6859e9d/sandbox/linux-sandbox/44/execroot/__main__ && \
  exec env - \
    PATH='$PATH:/home/lahmanja/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/var/lib/snapd/snap/bin:/snap/bin/' \
  bazel-out/host/bin/external/bazel_latex/run_lualatex external/texlive_bin__x86_64-linux/kpsewhich external/texlive_bin__x86_64-linux/luatex external/texlive_bin__x86_64-linux/bibtex external/texlive_bin__x86_64-linux/biber external/bazel_latex_latexrun/latexrun cover_letter_resume src/cover_letter_resume.tex bazel-out/k8-fastbuild/bin/src/cover_letter_resume.pdf)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox run_lualatex failed: error executing command 
  (cd /home/lahmanja/.cache/bazel/_bazel_lahmanja/a1e01723933a64fd774eb9f1c6859e9d/sandbox/linux-sandbox/44/execroot/__main__ && \
  exec env - \
    PATH='$PATH:/home/lahmanja/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/var/lib/snapd/snap/bin:/snap/bin/' \
  bazel-out/host/bin/external/bazel_latex/run_lualatex external/texlive_bin__x86_64-linux/kpsewhich external/texlive_bin__x86_64-linux/luatex external/texlive_bin__x86_64-linux/bibtex external/texlive_bin__x86_64-linux/biber external/bazel_latex_latexrun/latexrun cover_letter_resume src/cover_letter_resume.tex bazel-out/k8-fastbuild/bin/src/cover_letter_resume.pdf)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
failed to open file recorder output: [Errno 2] No such file or directory: 'lualatex.fls'

Possibly a dupe/related to #20?

$ uname -a
Linux lahmanja 5.8.14-arch1-1 #1 SMP PREEMPT Wed, 07 Oct 2020 23:59:46 +0000 x86_64 GNU/Linux
$ bazel version
Build label: 3.5.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Sep 14 06:01:07 2020 (1600063267)
Build timestamp: 1600063267
Build timestamp as int: 1600063267
@patbro
Copy link
Member

patbro commented Oct 22, 2020

Actually, your issue seems not to be related to the issue you mentioned. lualatex.fls is an output file, rather than an input file. That lualatex.fls is missing only tells you the build failed.

Furthermore, I think the actual error message is missing from your build output. Since the output just tells the build failed, not exactly which error (or maybe warning?) caused the build to fail.

I attempted to reproduce your issue, I copied the output PDF of the example report to the example folder and updated my_report.tex to:

\documentclass[a4paper]{report}
\usepackage{pdfpages}
\title{Bazel rules for LaTex example}
\author{Prodrive Technologies}
\date{2019-11-13}

\begin{document}
\maketitle
\input{example/chapters/introduction}
\includepdf[pages=-]{example.pdf}
\end{document}

The BUILD.bazel changed to:

load("@bazel_latex//:latex.bzl", "latex_document")

latex_document(
    name = "my_report",
    srcs = glob([
        "chapters/*.tex",
    ]) + [
        ":example.pdf",
        "@bazel_latex//packages:calc",
        "@texlive_texmf__texmf-dist__tex__generic__ifxetex",
        "@texlive_texmf__texmf-dist__tex__generic__oberdiek",
        "@texlive_texmf__texmf-dist__tex__latex__pdfpages",
        "@texlive_texmf__texmf-dist__tex__latex__eso-pic",
        "@texlive_texmf__texmf-dist__tex__latex__graphics",
        "@texlive_texmf__texmf-dist__tex__latex__oberdiek",
    ],
    main = "my_report.tex",
)

The build then fails mentioning [color] No driver specified, [graphics] No driver specified and Cannot find file example.pdf. However, when running bazel query 'kind("source file", deps(//example:my_report))' the example.pdf seems to be included in the package. I'm not totally sure what the pdfpages package is doing which causes the build to exit with these errors.

Do you encounter the same or different errors? Please let me know so we can look into this issue a bit more.

@patbro patbro added the question Further information is requested label Oct 22, 2020
@patbro patbro self-assigned this Oct 22, 2020
@jmelahman
Copy link
Author

So, I've created a branch to add the pdfpages package. I was able to reproduce the same No driver specified issue above by running bazel build //packages:all.

After a little googling, seems I might have missed a few dependent packages, namely @texlive_texmf__texmf-dist__tex__latex__graphics-cfg and @texlive_texmf__texmf-dist__tex__latex__graphics-def. Still not sure why my example wasn't giving me these errors, but adding those seemed to resolve that issue for both my branch and the original example.

However, now both are failing for,

texmf/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty:537: error: [pdftexcmds] Wrong version of lua module

Wondering if this could be resolved by upgrading to texlive 2020? If you're interested, I think I started generating the tarballs last week and would be happy to assist if possible (the 2020 update added the dejavu font which I'd like to use haha).

@patbro
Copy link
Member

patbro commented Oct 24, 2020

Yes, it looks like it would. But: updating the oberdiek bundle alone won't solve this. Because the community is making the oberdiek bundle more maintainable, some packages were removed. Unfortunately, the newer version of pdftexcmds is not included in the newest oberdiek bundle (I didn't check a not-so-new oberdiek bundle version). So, updating the oberdiek bundle won't solve your problem straight-away, rather it requires some additional work.

You could also just include the newer pdftexcmds package from its new location rather than dealing with updating the whole oberdiek bundle and mainly fixing all dependencies. The latter would - obviously - be a much nicer/neater solution.

If the newest oberdiek bundle contains a lot of improvements compared to the current version, I would like to update the oberdiek bundle. Otherwise including the newer pdftexcmds package seems fine to me as well.

@patbro patbro added enhancement New feature or request and removed question Further information is requested labels Oct 24, 2020
@pawellozinski
Copy link

Couldn't get pdfpages to work as well. Any chance for the core team to create the correct latex_package?

@patbro patbro mentioned this issue Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants