测试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

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

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


浙公网安备 33010602011771号