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

Make latexpdf fails on windows #4911

Closed
dm413 opened this Issue Apr 28, 2018 · 14 comments

Comments

Projects
None yet
7 participants
@dm413

dm413 commented Apr 28, 2018

Subject: Make latexpdf fails with "Failed to run: make"

Problem

  • When running on windows, if you run "make latexpdf", sphinx-build generates the latex files, but then fails with the message "Failed to run: make".
  • After sphinx-build fails, if I manually run "latexpdf ProjectName.tex" from the _build/latex folder, it correctly runs Miktex and builds the pdf file.
  • It appears that build-spinx does not create a make.bat file in the _build/latex folder. It does create a makefile, but that won't run on windows (no make command/executable).
  • This problem can be reproduced by running quickstart with all the defaults to create a minimal project, and then running "make latexpdf".

Procedure to reproduce the problem

sphinx-quickstart                     (accept all the defaults)
make latexpdf

Error logs / results

F:\SphinxTest3>make latexpdf
Running Sphinx v1.7.4
making output directory...
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [latex]: all documents
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
processing SphinxTest3.tex...index
resolving references...
writing... done
copying TeX support files...
done
build succeeded.

The LaTeX files are in _build\latex.
Error: Failed to run: make

Expected results

sphinx-build should create a make.bat in the _build/latex folder and execute it.

Environment info

  • OS: Windows 7-64
  • Python version: 2.7.12
  • Sphinx version: 1.7.4
@t-b

This comment has been minimized.

t-b commented May 14, 2018

@dm413 Yeep same here. I've also tested sphinx 1.5.4 and it does not work in that neither. So maybe it was never working?

@dm413

This comment has been minimized.

dm413 commented May 14, 2018

Thanks for confirming. It worked at one time, because I discovered the problem after I updated sphinx. Unfortunately I don't have good notes about what version I was running.

@tk0miya tk0miya added this to the 1.8 milestone May 15, 2018

@tk0miya tk0miya removed the help wanted label May 15, 2018

@Sow-Hunter

This comment has been minimized.

Sow-Hunter commented Jun 8, 2018

same problem.

Environment info

  • OS: Windows 7-64
  • Python version: 2.7.15
  • Sphinx version: 1.7.5
@fleimgruber

This comment has been minimized.

fleimgruber commented Jun 22, 2018

Same problem.

Environment info

  • OS: Windows 7-64
  • Python: 3.6.5
  • Sphinx: 1.7.5

How to debug?

@tk0miya

This comment has been minimized.

Member

tk0miya commented Jun 23, 2018

At present, Sphinx does not provide make.bat script for windows environment. So you need to install make.exe to build PDF. In detail, please see #1867.

@dm413

This comment has been minimized.

dm413 commented Jun 23, 2018

Sphinx does provide a make.bat script. Sphinx-quickstart asks if you want to create one, and the default answer (at least on windows) is yes. The make.bat works for html, but does not work for pdf.

Furthermore, this used to work. I have projects I generated with an older version of sphinx (not sure what version, but it was 2016), that generated a much larger make.bat than does the current version. This make.bat does include the pdflatex command and successfully creates a pdf file.

@jfbu

This comment has been minimized.

Contributor

jfbu commented Jun 24, 2018

You might be looking for --no-use-make-mode option of sphinx-quickstart.

@fleimgruber

This comment has been minimized.

fleimgruber commented Jun 25, 2018

@tk0miya thanks, installing make.exe solved it.

@dm413

This comment has been minimized.

dm413 commented Jun 25, 2018

The --no-use-make-mode option to sphinx-quickstart does not solve the problem. In the resulting generated project, running make.bat latexpdf still produces "Error: Failed to run: make".

Make-mode is an option to move some of the functionality of make into Sphinx itself. It does not affect the problem here, which is that the generated make.bat file tries to run make.exe instead of running the command latexpdf ProjectName.tex.

Running make.bat to build other output types works, it is just building pdf that fails.

@tk0miya

This comment has been minimized.

Member

tk0miya commented Jun 25, 2018

Sphinx does provide a make.bat script. Sphinx-quickstart asks if you want to create one, and the default answer (at least on windows) is yes. The make.bat works for html, but does not work for pdf.

Sorry for confuse. The make.bat I mentioned is different with which sphinx-quickstart generates. sphinx-build generates additional make script for building PDF on output directory (cf. _build/latex/Makefile). But sphinx-build does not generate batch file at present.

Furthermore, this used to work. I have projects I generated with an older version of sphinx (not sure what version, but it was 2016), that generated a much larger make.bat than does the current version. This make.bat does include the pdflatex command and successfully creates a pdf file.

So far, sphinx-quickstart has never generated make.bat which calls latexpdf directly, AFAIK. Is it really generated by Sphinx?

Anyway, we need to generate an additional make.bat on make latex. I'll try it on next release.
Thanks,

@jfbu

This comment has been minimized.

Contributor

jfbu commented Jun 25, 2018

the problem here, which is that the generated make.bat file tries to run make.exe instead of running the command latexpdf ProjectName.tex.

Just for the record, the command would be pdflatex not latexpdf which is nickname adopted by Sphinx for make target. On GNU/Linux, the natural thing to do after make latex is make -C <latexbuilddir> all-pdf and for some reason Sphinx proposes make latexpdf instead (related: #5085). For Windows, one sees at

if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)

that the "old" make.bat will indeed as you report try to execute make all-pdf in the latex build directory.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Aug 5, 2018

tk0miya added a commit to tk0miya/sphinx that referenced this issue Aug 8, 2018

@tk0miya tk0miya closed this in 2552efe Aug 13, 2018

tk0miya added a commit that referenced this issue Aug 13, 2018

@dm413

This comment has been minimized.

dm413 commented Sep 17, 2018

I tested with version 1.8.0. Running
make latexpdf
give the error message
latexmk: The script engine could not be found. latexmk: Data: scriptEngine="perl.exe", scriptName="latexmk"

Although latexmk is installed with MiKTeX, it requires perl to be installed as well. This is a new dependency for Sphinx as far as I know.

I note another minor issue -- if you run make with no parameters, it lists the possible targets, but does not list latexpdf as one of those possible targets.

@tk0miya

This comment has been minimized.

Member

tk0miya commented Sep 18, 2018

@dm413 Thank you for confirmation. I'd forgotten to add latexmk to new dependency (because it had been already used in other platforms).
And I also added help entry (you can see it if you re-generate make.bat).

see #5451 .
Thanks,

tk0miya added a commit to tk0miya/sphinx that referenced this issue Sep 18, 2018

tk0miya added a commit that referenced this issue Sep 18, 2018

Merge pull request #5451 from tk0miya/4911_help_for_nonmakemode
Fix #4911: add latexpdf to make.bat for non make-mode
@panda-z

This comment has been minimized.

panda-z commented Sep 26, 2018

Hello,
I've noticed that sphinx use make.bat.new_t as template when invoking sphinx-quickstart. The latexpdf help entry is still missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment