Lazarusでビルド時にcrtbeginS.oとcrtendS.oが見つからない警告が出る

ビルドするたびに毎回次のような警告が出る。

project1.lpr(27,1) Warning: “crtbeginS.o” not found, this will probably cause a linking failure
project1.lpr(27,1) Warning: “crtendS.o” not found, this will probably cause a linking failure

問題のcrtbeginS.oとcrtendS.oは、GCCがインストールされていれば通常存在している。findでどこにあるかを特定する。Fedora 42の場合は次のようになっている。

$ find /usr/ -iname "crtbeginS.o"
/usr/lib/gcc/x86_64-redhat-linux/15/32/crtbeginS.o
/usr/lib/gcc/x86_64-redhat-linux/15/crtbeginSo
...
$ find /usr/ -iname "crtendS.o"  
/usr/lib/gcc/x86_64-redhat-linux/15/32/crtendS.o
/usr/lib/gcc/x86_64-redhat-linux/15/crtendS.o
...

/etc/fpc.cfg にこのパスを追加してやれば良い。

...fpc.cfgから一部抜粋...
# searchpath for libraries
#IFDEF CPU64
#-Fl/usr/lib64/fpc/$fpcversion/lib
#-Fl/lib64;/usr/lib64
-Fl/usr/lib64/fpc/$fpcversion/lib/$FPCTARGET
-Fl/usr/lib/gcc/x86_64-redhat-linux/14
-Fl/usr/lib/gcc/x86_64-redhat-linux/15 ⭐️これを追加⭐️
#ELSE
#-Fl/usr/lib/fpc/$fpcversion/lib
#-Fl/lib;/usr/lib
-Fl/usr/lib/fpc/$fpcversion/lib/$FPCTARGET
#ENDIF
...

コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です