#1 2016-11-03 10:36:12

tklaz
Member
Registered: 2016-11-02
Posts: 10

Cross compiled library won't load under Linux

Hi,
got another strange error when crosscompiling to Linux, this time on one shared library.
When I compile the same lpi project under Linux the library normally loads.
But when I try to load the same library which was crosscompiled (I only select Linux in project options, no other modification to the project), following error occurs:

procedure TPlugin.LoadModule;
var
  ErrorMsg: string;
begin
  if FModule = 0 then
    FModule := LoadLibrary(PChar(FPath));
  ErrorMsg := GetLoadErrorStr;
  if FModule <> 0 then
  begin
    FFuncOpen := GetProcAddress(FModule, 'Open');     
    //etc
  end;
end;

ErrorMsg has the value:
'/path_to_project/lib/i386-linux/libtest.so: undefined symbol: GENERICS.DEFAULTS$_$TORDINALCOMPARER$2$CRC09680922_$__$$_create'

and FModule is zero.

It has sth. to do with generics. Interesting is that another library using generics and crosscompiled in the same way loads fine.

I have no idea what's the problem.

Thanks

EDIT: When I removed the dependencies on Generics.* units the problem disappeared.
In fact those dependencies were not needed in this library (no generics used there).
So it seems this error only comes when some portion of Generics* is not used in the module.
Because as said in other of my libraries Generics* are used heavily and this (crosscompiled) library loaded fine.

Last edited by tklaz (2016-11-03 11:12:31)

Offline

#2 2016-11-03 17:45:32

AOG
Member
Registered: 2014-02-24
Posts: 346

Re: Cross compiled library won't load under Linux

Thanks for the feedback !
I have added the linker path into fpcupdeluxe ... do not yet know if 100% correct.
I am awaiting user feedback.

Ps: you can use fpcupdeluxe to install NewPascal anywhere !

Offline

#3 2016-11-14 23:31:18

tklaz
Member
Registered: 2016-11-02
Posts: 10

Re: Cross compiled library won't load under Linux

This is the same problem as http://synopse.info/forum/viewtopic.php?id=3634.
Only here the linker runs fine but the library loader does not find requested symbol.
Don't want to dig too much into those ABI details but clean up and rebuilding the library always helps.

Offline

#4 2016-11-15 08:18:24

AOG
Member
Registered: 2014-02-24
Posts: 346

Re: Cross compiled library won't load under Linux

Offline

Board footer

Powered by FluxBB