Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

Dynamic library dependency error

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

xrfang

Hi All,

I try to make a dynamic library and get this error:

paintrect.pas(0,0) Fatal: Can not find unit Controls used by paintrect. Check if package LCLBase is in the dependencies.

The source code of my library is:

library liboval;
{$mode objfpc}{$H+}
uses
? paintrect, oval;
function GetPainter: TPainter;
begin
end;
exports GetPainter;
begin
end. ? ?

And the used paintrect.pas is attached.

Any hint is greatly appreciated.

Thanks,
Shannon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130122/32b7f2d4/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: paintrect.pas
Type: text/x-pascal
Size: 10406 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130122/32b7f2d4/attachment.bin>

Reply by email

Howard Page-Clark
to xrfang
xrfang wrote
I try to make a dynamic library and get this error: paintrect.pas(0,0) Fatal: Can not find unit Controls used by paintrect. Check if package LCLBase is in the dependencies.

You need to add LCLBase as a project dependency.
Use the Project Inspector's Add button to show the Add to Project dialog. Project -> Project Inspector,
then in the Project Inspector click the middle tab to open the New Requirement page, and in the Package Name combo dropdown choose LCLBase from the long list presented.
Then click the [Create New Requirement] button, and you're done - the new package requirement will be listed under Required Packages node in the Project Inspector.

Reply by email

xrfang
to Howard Page-Clark

Hi Howard,

Thanks for your info. ?After adding LCLBase to dependencies, I get these errors:

/usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/bin/ld: /home/xrfang/Desktop/paintrect/lib/x86_64-linux/paintrect.o: relocation R_X86_64_32S against `_$PAINTRECT$_Ld1' can not be used when making a shared object; recompile with -fPIC /home/xrfang/Desktop/paintrect/lib/x86_64-linux/paintrect.o: ??????: ???? liboval.lpr(14) Error: Error while linking

where "??????: ????" means "cannot read symbol: illegal value".

What's wrong here?

Thanks,
Shannon

? ?, 1? 22, 2013 at 10:41 ???Howard Page-Clark ???

xrfang wrote
I try to make a dynamic library and get this error: paintrect.pas(0,0) Fatal: Can not find unit Controls used by paintrect. Check if package LCLBase is in the dependencies.

You need to add LCLBase as a project dependency.
Use the Project Inspector's Add button to show the Add to Project dialog. Project -> Project Inspector,
then in the Project Inspector click the middle tab to open the New Requirement page, and in the Package Name combo dropdown choose LCLBase from the long list presented. Then click the [Create New Requirement] button, and you're done - the new package requirement will be listed under Required Packages node in the Project Inspector.

Reply by email

Antonio Fortuny
to xrfang

Le 22/01/2013 16:14, xrfang a ?crit :

Show quoted text 13 lines
Hi Howard, Thanks for your info. ? After adding LCLBase to dependencies, I get these errors: /usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/bin/ld: /home/xrfang/Desktop/paintrect/lib/x86_64-linux/paintrect.o: relocation R_X86_64_32S against `_$PAINTRECT$_Ld1' can not be used when making a shared object; recompile with -fPIC /home/xrfang/Desktop/paintrect/lib/x86_64-linux/paintrect.o: ?? ???????????????: ???????????? liboval.lpr(14) Error: Error while linking where "?? ???????????????: ????????????" means "cannot read symbol: illegal value". What's wrong here?

Try adding
-fPIC
-dFPC_PIC
into program's options, Other section
Tha's what I use when building shared libraries.

Antonio.

Reply by email

Xiangrong Fang
to Antonio Fortuny

Thanks, I added -fPIC and it worked, it seems no need to add -dFPC_PIC?

Also I found a small problem. While create a new shared library and compile fpc always complain that -WR is invalid. I have to uncheck "Relocatable" option to fix this.

I think this is a bug in lazarus project template, what do you think?

2013/1/23 Antonio Fortuny

Show quoted text 44 lines
Le 22/01/2013 16:14, xrfang a ?crit : > Hi Howard, > > Thanks for your info. ? After adding LCLBase to dependencies, I get these > errors: > > > /usr/bin/ld: warning: link.res contains output sections; did you forget > -T? > /usr/bin/ld: /home/xrfang/Desktop/**paintrect/lib/x86_64-linux/**paintrect.o: > relocation R_X86_64_32S against `_$PAINTRECT$_Ld1' can not be used when > making a shared object; recompile with -fPIC > /home/xrfang/Desktop/**paintrect/lib/x86_64-linux/**paintrect.o: ?? > ??????? ????? ?: ???????????? > > liboval.lpr(14) Error: Error while linking > > where "?? ??????? ????? ?: ????????????" means "cannot read symbol: > illegal value". > > What's wrong here? > > Try adding -fPIC -dFPC_PIC into program's options, Other section Tha's what I use when building shared libraries. Antonio. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130123/6b328cfb/attachment.html>

Reply by email