# Problem with package listlbls and report class

I'm getting an error with package listlbls: https://www.ctan.org/pkg/listlbls?lang=en. It prints a list of labels used in the document. Here's a MWE:

\documentclass[draft]{report}
\usepackage[utf8]{inputenc}
\usepackage{listlbls}

\begin{document}
\listoflabels
\chapter{Second}\label{ch:ghost}
\section{A section}\label{sec:first}
Some text anf a reference \ref{ch:ghost}.
\section{Another Section}\label{sec:another}
Some more text and and another reference \ref{sec:first}.
$$\label{eq:triv} 1=1$$
By equation \ref{eq:triv}  section \ref{sec:another}.
\end{document}


When I use it together with the report class I get an error:

/usr/share/texlive/texmf-dist/tex/latex/listlbls/listlbls.sty:55:
LaTeX Error:
Missing \begin{document}.
l.55 \ifdefined\chapter*


So it seems to be something to do with the chapter command as it works fine in the article class. Most puzzlingly one of the online compilers I tested it on returned and error and gave an output with a empty first page bar one * character! Any ideas?

That looks like a bug in listlbls.sty. You can solve it by making a private copy of that file in your working directory and changing the line (line number 55)
\ifdefined\chapter*

\ifdefined\chapter