View Issue Details

IDProjectCategoryView StatusLast Update
0023760FPCfpReportpublic2013-01-28 16:44
Reportersilvioprog Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Summary0023760: LazReport and shared library
DescriptionHello,

I'm trying to compile a .SO file, embeddeding a small report generator using LazReport, but it not compiles on Linux (Mint 14, GTK2, 64bit).

Attached, the project to reproduce the error.

This is the compile log:
===============================
Options changed, recompiling clean with -B
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Error: Illegal parameter: -WR
===============================

If I disable -WR:
===============================
Options changed, recompiling clean with -B
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.7.1 [2012/12/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling lr.lpr
Compiling unit1.pas
Compiling resource /home/brook/liblr/lib/x86_64-linux/lr.or
Linking liblr.so
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: relocation R_X86_64_32S against `U_$LR_CLASS_$$_FRFUNCTIONSCOUNT' can not be used when making a shared object; recompile with -fPIC
/home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: could not read symbols: Bad value
lr.lpr(24) Error: Error while linking
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: relocation R_X86_64_32S against `U_$LR_CLASS_$$_FRFUNCTIONSCOUNT' can not be used when making a shared object; recompile with -fPIC
/home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: could not read symbols: Bad value
lr.lpr(24) Error: Error while linking
lr.lpr(24) Fatal: There were 1 errors compiling module, stopping
===============================

Thank you!
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

2013-01-27 02:50

 

liblr.zip (2,358 bytes)

Jesus Reyes

2013-01-27 09:03

developer   ~0065208

To start, the compiler say you should use -fPIC, but this problem is better addressed on the FPC project, so moving it ...

Jonas Maebe

2013-01-27 10:01

manager   ~0065212

As mentioned, recompile all used units with -fPIC (or -Cg, that's the same). If that doesn't help, please provide an example that does not depend on the LCL or Lazarus.

silvioprog

2013-01-27 19:28

reporter   ~0065224

Sorry by reopen, but I can't comment in a resolved topic, the Mantis disables the comment button/memo for me.

The problem continue, see:

brook@brook-dev ~/liblr $ fpc -MObjFPC -Scghi -O1 -Xs -XX -vewnhi -Filib/x86_64-linux -Fl/opt/gnome/lib -Fu../lazarus/components/lazreport/source/addons/pdfexport/lib/x86_64-linux -Fu../lazarus/components/lazreport/source/lib/x86_64-linux -Fu../lazarus/components/printers/lib/x86_64-linux/gtk2 -Fu../lazarus/components/synedit/units/x86_64-linux/gtk2 -Fu../powerpdf/lib/x86_64-linux -Fu../lazarus/ideintf/units/x86_64-linux/gtk2 -Fu../lazarus/components/lazcontrols/lib/x86_64-linux/gtk2 -Fu../lazarus/lcl/units/x86_64-linux/gtk2 -Fu../lazarus/lcl/units/x86_64-linux -Fu../lazarus/components/lazutils/lib/x86_64-linux -Fu../lazarus/packager/units/x86_64-linux -Fu. -FUlib/x86_64-linux/ -l -oliblr.so -dLCL -dLCLgtk2 -fPIC lr.lpr
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.7.1 [2012/12/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling lr.lpr
Compiling unit1.pas
unit1.pas(26,1) Error: Can't create object file: lib/x86_64-linux/unit1.o (error code: 2)
unit1.pas(26,1) Fatal: Can't create object lib/x86_64-linux/unit1.o
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
brook@brook-dev ~/liblr $

Jonas Maebe

2013-01-27 19:38

manager   ~0065225

That means that the directory lib/x86_64-linux doesn't exist.

silvioprog

2013-01-27 19:43

reporter   ~0065226

I think it would be impossible, because LazReport depends on the LCL. My idea in creating reports in .SO files is just to pack LCL, because only then could use LazReport with CGI applications.

I have a project to create, but unfortunately all alternatives for reports are not compatible with CGI. (I've been thinking about use an PHP alternative (http://stimulsoft.com)) :(

I contacted the folks at FastReport to see if they would help me with this problem, but the FastReport team never reply my emails, so this prove that the FastReport don't is compatible with FPC too! :/

silvioprog

2013-01-27 19:51

reporter   ~0065227

> That means that the directory lib/x86_64-linux doesn't exist.

OK. See the new log:

brook@brook-dev ~/liblr $ ls
lib lr.lpi lr.lpr unit1.lfm unit1.pas
brook@brook-dev ~/liblr $ cd lib/
brook@brook-dev ~/liblr/lib $ ls
x86_64-linux
brook@brook-dev ~/liblr/lib $ cd ..
brook@brook-dev ~/liblr $ fpc -MObjFPC -Scghi -O1 -Xs -XX -vewnhi -Filib/x86_64-linux -Fl/opt/gnome/lib -Fu../lazarus/components/lazreport/source/addons/pdfexport/lib/x86_64-linux -Fu../lazarus/components/lazreport/source/lib/x86_64-linux -Fu../lazarus/components/printers/lib/x86_64-linux/gtk2 -Fu../lazarus/components/synedit/units/x86_64-linux/gtk2 -Fu../powerpdf/lib/x86_64-linux -Fu../lazarus/ideintf/units/x86_64-linux/gtk2 -Fu../lazarus/components/lazcontrols/lib/x86_64-linux/gtk2 -Fu../lazarus/lcl/units/x86_64-linux/gtk2 -Fu../lazarus/lcl/units/x86_64-linux -Fu../lazarus/components/lazutils/lib/x86_64-linux -Fu../lazarus/packager/units/x86_64-linux -Fu. -FUlib/x86_64-linux/ -l -oliblr.so -dLCL -dLCLgtk2 -fPIC lr.lpr
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.7.1 [2012/12/22] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling lr.lpr
Compiling unit1.pas
Compiling resource lib/x86_64-linux/lr.or
Linking liblr.so
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: relocation R_X86_64_32S against `U_$LR_CLASS_$$_FRFUNCTIONSCOUNT' can not be used when making a shared object; recompile with -fPIC
/home/brook/lazarus/components/lazreport/source/lib/x86_64-linux/lr_class.o: could not read symbols: Bad value
lr.lpr(24) Error: Error while linking
lr.lpr(24) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
brook@brook-dev ~/liblr $

silvioprog

2013-01-27 20:01

reporter   ~0065228

Another similar problem: http://bugs.freepascal.org/view.php?id=23664

Jonas Maebe

2013-01-27 20:51

manager   ~0065231

Did you also rebuild the entire LCL and the lazreport package with -fPIC?

silvioprog

2013-01-27 23:38

reporter   ~0065236

I did not find this option (-fPIC or -Cg) in the "lazreport.lpk". :/

Jonas Maebe

2013-01-28 16:15

manager   ~0065259

Then add it somewhere and rebuild the package. Please use the Lazarus forum or mailing list to ask for further help if you don't know how to do that.

silvioprog

2013-01-28 16:44

reporter   ~0065261

OK. Thank you!

Issue History

Date Modified Username Field Change
2013-01-27 02:50 silvioprog New Issue
2013-01-27 02:50 silvioprog File Added: liblr.zip
2013-01-27 02:50 silvioprog Widgetset => GTK 2
2013-01-27 09:03 Jesus Reyes Project Lazarus => FPC
2013-01-27 09:03 Jesus Reyes Note Added: 0065208
2013-01-27 10:01 Jonas Maebe Status new => resolved
2013-01-27 10:01 Jonas Maebe Resolution open => no change required
2013-01-27 10:01 Jonas Maebe Assigned To => Jonas Maebe
2013-01-27 10:01 Jonas Maebe Note Added: 0065212
2013-01-27 19:28 silvioprog Note Added: 0065224
2013-01-27 19:28 silvioprog Status resolved => feedback
2013-01-27 19:28 silvioprog Resolution no change required => reopened
2013-01-27 19:38 Jonas Maebe Note Added: 0065225
2013-01-27 19:38 Jonas Maebe Status feedback => resolved
2013-01-27 19:38 Jonas Maebe Resolution reopened => no change required
2013-01-27 19:43 silvioprog Note Added: 0065226
2013-01-27 19:43 silvioprog Status resolved => feedback
2013-01-27 19:43 silvioprog Resolution no change required => reopened
2013-01-27 19:51 silvioprog Note Added: 0065227
2013-01-27 19:51 silvioprog Status feedback => assigned
2013-01-27 20:01 silvioprog Note Added: 0065228
2013-01-27 20:51 Jonas Maebe Note Added: 0065231
2013-01-27 21:44 Jonas Maebe Status assigned => feedback
2013-01-27 23:38 silvioprog Note Added: 0065236
2013-01-27 23:38 silvioprog Status feedback => assigned
2013-01-28 16:15 Jonas Maebe Note Added: 0065259
2013-01-28 16:15 Jonas Maebe Status assigned => resolved
2013-01-28 16:15 Jonas Maebe Resolution reopened => no change required
2013-01-28 16:44 silvioprog Note Added: 0065261
2013-01-28 16:44 silvioprog Status resolved => closed
2019-04-22 09:49 Michael Van Canneyt Category LazReport => fpReport