LazReport depends on LCL, which in turn depends on a GUI toolkit and requires a graphical desktop. So when running CGI apps (which are basically a console program - no GUI), the LazReport program will fail because it can't hook into the graphical desktop environment.
This is a bad design of LazReport, because generating reports and PDF's really shouldn't require a GUI at all. The engine part should have been 100% non-GUI, and the visual report designer should have been the only GUI part in a separated package. Unfortunately this was never done.
A better solution would be to use a pure report or PDF engine that doesn't require LCL or any other GUI. fpGUI includes such a PDF report engine, and soon (no exact timeframe yet) FPC will include such a report engine too.
Work-Around
In the mean time you will have to compile your CGI+LazReport application with the LCL-NoGUI interface as a work-around. It fakes some GUI desktop features to get around the problem, but still a terrible work-around.
Hope that helps.