Drawing overlay graphics over minted code

I want to draw ellipses around some code I have on a slide, as overlays, per this answer. However, it doesn't seem to work. Indeed, XeLaTeX isn't even rendering the second slide.

My code is something like:

\begin{frame}[fragile=singleslide]{Frame title}
\begin{minted}[autogobble,fontfamily=myfont,escapeinside=||}{c}
int main(int argc, char** argv) {
return |\tikzmark{start}|0|\tikzmark{end}|;
}
\end{minted}

\begin{tikzpicture}[remember picture,overlay]
\node<2>[draw,line width=2,cyan,circle,fit={(pic cs:start) (pic cs:end)}] {};
\end{tikzpicture}
\end{frame}


I'm using latexmk, FWIW. I tested the code linked in the aforementioned answer and I get the correct output, so I guess it's doing the correct number of passes. However, when I remove the minted environment, it still doesn't work:

\begin{frame}[fragile=singleslide]{Frame title}
Hello \tikzmark{start}World\tikzmark{end}

\begin{tikzpicture}[remember picture,overlay]
\node<2>[draw,line width=2,cyan,circle,fit={(pic cs:start) (pic cs:end)}] {};
\end{tikzpicture}
\end{frame}

• Would you mind posting a complete MWE? Does putting \pause before your tikzpicture help? – user121799 Feb 13 '18 at 15:56
• The \pause made no difference. I found the problem, though, and added my answer below. – Xophmeister Feb 13 '18 at 16:02

OK, I found the problem. If I remove the fragile=singleslide frame option, then it works in the second example. However, the minted environment needs at least the fragile option. This combination, fortunately, works:

\begin{frame}[fragile]{Frame title}
\begin{minted}[autogobble,fontfamily=myfont,escapeinside=||}{c}
int main(int argc, char** argv) {
return |\tikzmark{start}|0|\tikzmark{end}|;
}
\end{minted}

\begin{tikzpicture}[remember picture,overlay]
\node<2>[draw,line width=2,cyan,circle,fit={(pic cs:start) (pic cs:end)}] {};
\end{tikzpicture}
\end{frame}