秋·风

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
测试so project,编译时不使用cthreads,cmem编译链接正常能生成so文件。
library Project1;

{$mode objfpc}{$H+}



uses
  Classes
  {$ifdef UNIX}
  , cthreads,cmem
  {$endif}
  { you can add units after this };

begin

end.
      

使用了cthreads后,编译时会出现链接出错:

D:\QFLazarus4.4\cross\bin-x86_64-win64\arm-linux\arm-linux-gnueabihf-ld.exe: D:\QFLazarus4.4\cross\lib\arm-linux\crtbegin.o: relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
D:\QFLazarus4.4\cross\lib\arm-linux\crtbegin.o: error adding symbols: Bad value
project1.lpr(16,1) Error: Error while linking

 

QQ_1770017438402

解决方法:
project-->project options-->Compiler options-->Custom options-->添加

-fPIC

QQ_1770017956714

 重新编译就可以生成so文件:

QQ_1770018120514

 

posted on 2026-02-02 15:42  秋·风  阅读(0)  评论(0)    收藏  举报