Now I understand the FAQ "LaTeX won’t include from other directories" but that applies to include statements referring to directories up the tree (\include{../bar/xyz.tex}) but I'm not trying to do that, and yet the error I have looks like the same thing.
I continued fiddling about (as you do) and discovered that if I omit the -output-directory flag then it all works fine. Can it be that in order to implement the -output-directory flag the code changes to that directory, after which the imbed of ./foo/bar becomes ../foo/bar and fails because of the limitation?
Would this count as a bug? It's certainly counter-intuitive.
I read your posts and thought about it. I just could not test as I'm traveling. Good to read that it probably works fine without the -output-directory flag!
Your TeX version is old though, of 2015. I know, stable Debian is behind the official TeX Live releases, though that's ok for common TeX documents without new features. TeX Live 2018 is in the testing phase and will be released in some weeks, I hope. Perhaps (after release) consider a TeX install from tug.org/texlive instead of from Debian repositories, it should work fine. I do that with Debian (servers) and Ubuntu (desktop, based on Debian).
henrylaw wrote:Can it be that in order to implement the -output-directory flag the code changes to that directory, after which the imbed of ./foo/bar becomes ../foo/bar and fails because of the limitation?
Not quite. Whenever you \include something, a partial aux file is opened for writing and when you change your output directory, this will be opened under that directory. However, this routine does not create missing folders on the fly...
In other words: your \include{foo/bar} tells LaTeX to create .pdf/foo/bar.aux which fails, because you did not create a subfolder foo in ./pdf.
Another possibility would be to use \input instead of \include, because \input just reads the file.