顯示具有 cross compile 標籤的文章。 顯示所有文章
顯示具有 cross compile 標籤的文章。 顯示所有文章

2022年11月15日 星期二

lazarus freePascal install and cross compile, on Host 64bit linux ,and cross to build win32 program

 *** My host is  linux ubuntu 18.04 64bit, 
*** target is to build linux 64bit  , and cross build win32 program
* download and install 3 packages : fpc-src, fpc-laz and lazarus-project


fpc-src_3.2.2-210709_amd64.deb
fpc-laz_3.2.2-210709_amd64.deb
lazarus-project_2.2.4-0_amd64.deb


* install 
$ sudo dpkg -i fpc-src_3.2.2-210709_amd64.deb
$ sudo dpkg -i fpc-laz_3.2.2-210709_amd64.deb
sudo apt install ./lazarus-project_2.2.4-0_amd64.deb
* check if successful
$ apt-cache policy fpc-src fpc-laz lazarus-project
** not need if you want remove 
** $ apt remove fpc-src fpc-laz lazarus-project


* How to build win32 exe file from  linux 64bit host
[00.] copy /usr/share/fpcsrc/3.2.2 to your ~/fpcsrc/3.2.2
[01.] cd ~/fpcsrc/3.2.2
[02.] make clean all OS_TARGET=win32 CPU_TARGET=i386
[03.] sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
[04.] sudo ln -sf /usr/lib/fpc/3.2.2/ppcross386 /usr/bin/ppcross386
[05.] launch lazarus ,open a hello project,
     project options -- compiler options -- config and target
Target OS(-T) Win32
Target Cpu(-P) i386
Target processor 386/486(-cp80386)
[06.] Run -- clean up and build 



*** below is for 64bit host , to gen linux 32bit code

---- gedit i386-linux-ld ---
#!/bin/bash
# name this file /usr/bin/i386-linux-ld
ld -A elf32-i386 $@
----^^ and save to disk

----make file i386-linux-as ---
#!/bin/bash
# name this file /usr/bin/i386-linux-as
as --32 $@
----^^

* copy above 2 bash file to /usr/bin/ , and let it as exe file
$ chmod +x i386-linux-as
$ chmod +x i386-linux-ld

01. cd ~/fpcsrc/3.2.2
02. make clean all OS_TARGET=linux CPU_TARGET=i386
03. sudo make crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=/usr

食用油

豆大芥小 加熱均 又非橄㰖 造假多 油麻菜籽 螻蟻命 自求多福 身安康 目前 我推 芥花油,較耐高溫. 從成份上來看 橄㰖>芥花>大豆 . 從CP/造假上來看 又不推 高價 橄㰖了, 可能 摻其它大豆等油/加色素等, 最近新聞 數千公頓大豆 不知所踪, 合理推測, 是...