Recent

Author Topic: Lazreport and cgi problem  (Read 3191 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Lazreport and cgi problem
« on: April 25, 2015, 08:56:51 am »
Hello guys, I'm creating a cgi with freespider / lazarus and everything seems to work. Then when I go to insert the generation of a report with LazReport instead does not compile anymore. Tells me:

/ usr / bin / ld: warning: link.res contains output sections; Perhaps you have forgotten -T

The problem are the two units: LR_Class, LR_DBSet

How do I fix it? thanks a lot
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Lazreport and cgi problem
« Reply #1 on: April 25, 2015, 09:56:05 am »
The question is: why do you generate GUI report in web application?
Could you please explain your project function

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazreport and cgi problem
« Reply #2 on: April 25, 2015, 10:03:21 am »
no gui report but pdf report with lazreport and pdfexport addons. other idea?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Lazreport and cgi problem
« Reply #3 on: April 25, 2015, 10:06:41 am »
Ok, I got it
Add interfaces unit in the main project file :

Code: [Select]

Uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
  CThreads,
{$ENDIF}{$ENDIF} interfaces,
 main, form, fortes324forlaz
  { add your units here };

begin
  DataModule1:= TDataModule1.Create(nil)
end.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazreport and cgi problem
« Reply #4 on: April 25, 2015, 01:51:31 pm »
Error in browser

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazreport and cgi problem
« Reply #5 on: April 26, 2015, 10:32:58 am »
I can not understand. I do a simple report generator pdf I print hello world on a report LazReport and then exports it to pdf? Or with any work other stumento. thanks
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: Lazreport and cgi problem
« Reply #6 on: April 26, 2015, 01:17:51 pm »
Please test your CGI executable without apache by typing:

yourappname -con

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazreport and cgi problem
« Reply #7 on: April 27, 2015, 11:14:43 am »
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.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

TinyPortal © 2005-2018