This bug was noticed in asymptote 2.21.
When a latex-file is compiled with the command line argument -output-directory, all output files are put into the given build-directory. Among them are the asymptote files texfilename-*.asy. Then asymptote can be executed for those files.
Now when rerunning the latex compiler (again with -output-directory) the asymptote tex package looks for the texfilename-*.pdf files not in the build-directory, but in the directory of the source texfilename.tex. Obviously they are not there, nor should they be, when the -output-directory argument is provided.
Sometimes this problem can be circumvented, by creating a symlink inside the build-directory to the build-directory itself and setting \asydir in the tex-file to the build-directory. Only in my case this collides with the tex security settings, as my build-directory starts with a dot.
Ticket moved from /p/asymptote/bugs/187/
This is not really a bug but rather a feature request.
In any case, your wish has been granted: in svn r5704
there is an option that you can use for this purpose:
% Optional subdirectory for latex files (no spaces):
\def\asylatexdir{DIR}
Note that there is no way of using the value of -output-directory
directly since this is not made available to TeX.
Also note that not all TeX packages support -output-directory.
For example, the media9 package, using latex+dvips, looks for the .m9 file in the wrong place. An alternative is to cd to your desired output directory and run latex by specifying the full path to the tex file.
Last edit: John Bowman 2015-05-11