Recent

Author Topic: Cross-compiling dynamic library for Linux ARM  (Read 961 times)

mata_fp

  • New member
  • *
  • Posts: 6
Cross-compiling dynamic library for Linux ARM
« on: June 24, 2020, 01:18:20 pm »
Hi,

I'm unable to link dynamic library for Linux ARM, when cross-compiling from linux x64.
Everything works fine for executables (ARM and x64), and dynamic libraries on x64.

Code: Pascal  [Select][+][-]
  1. library knihovna;
  2.  
  3. {$mode objfpc}{$H+}
  4. {$R *.res}
  5.  
  6. function Get_Version: Int32; cdecl;
  7. begin
  8.   Result := 1;
  9. end;
  10.  
  11. exports
  12.   Get_Version;
  13.  
  14. begin
  15. end.  

Compile Project, Mode: ARM, CPU: arm, Target: libknihovna.so: Exit code 1, Errors: 1
/home/shareman/Lazarus_FPC/Lazarus_2_0_0/cross/bin/arm-linux/arm-linux-gnueabihf-ld: warning: /media/sf_Projekty_FPC/Temp/17_dll_so/so/link.res contains output sections; did you forget -T?
/home/shareman/Lazarus_FPC/Lazarus_2_0_0/cross/bin/arm-linux/arm-linux-gnueabihf-ld: cannot find /lib/ld-linux-armhf.so.3
knihovna.lpr(17,0) Error: Error while linking

/lib/ld-linux-armhf.so.3 exists at the specified location, if I copy it to the project directory warnings disappear, but the linking error persists.

Is there any way to fix it?

Thanks for the help.

---------------------------------------   
OS: Linux Mint XFCE x64
Lazarus: 2.0.0
FPC:   3.0.4   

DelphiDinosaur

  • New member
  • *
  • Posts: 6
Re: Cross-compiling dynamic library for Linux ARM
« Reply #1 on: November 24, 2021, 04:36:00 pm »
@mata_fp did you find a solution to this problem?

I have a Console application that dynamically loads a library file. It works fine when compiled for x86_64. When compiled for ARM, the console application runs until it attempts to load a function from the .so library.

DD.

 

TinyPortal © 2005-2018