[Tex/LaTex] I can’t write on file ‘foo.aux’

errorsoutput

I am getting an error when compiling this template with pdflatex -output-directory=./_out thesis.tex:

! I can't write on file `text/abbreviations.aux'.
\@include ...\immediate \openout \@partaux #1.aux 
                                                  \immediate \write \@partau...
l.187 \include{text/abbreviations}

(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name: ^D
! Emergency stop.
\@include ...\immediate \openout \@partaux #1.aux 
                                                  \immediate \write \@partau...
l.187 \include{text/abbreviations}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on _out/thesis.log.

This is usually the way that I use the -output-directory option, and I have never had a problem with that usage before, but I must be doing something wrong because the compiling works fine without this option.


File Tree

Result of ls -R from the project root:

_README.txt     _out            figures         ociamthesis.cls references.bib  splitcolor.py   text            thesis.tex

./_out:
thesis.aux       thesis.bcf       thesis.lof       thesis.mtc       thesis.out
thesis.bbl       thesis.blg       thesis.log       thesis.mtc0      thesis.toc

./figures:
beltcrest.pdf sample

./figures/sample:
Gray498.png

./text:
abbreviations.tex    abstract.tex         acknowledgements.tex appendix-1.tex       ch1-intro.tex        ch2-litreview.tex

Version

I am on OSX and the manual for pdflatex doesn't show any option -aux_directory, my version is:

pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.17; using libpng 1.6.17
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04

Best Answer

@DavidCarlisle proposed a solution in comment of the OP. It seems to be sufficient to create a subdirectory _out/text for the compilation to succeed.