GitHub Actionsã§ã¯ARM64ã©ã³ãã¼ãå ¬éããã¤ã¤ããã¾ãããããã§ã¯ gcc ã使ã£ãã¯ãã¹ã³ã³ãã¤ã«ã説æãã¾ãããã®è¨äºã§ã¯ãã¹ã*1ã®ã¢ã¼ããã¯ãã£ã x86_64ãã¿ã¼ã²ãã*2ã®ã¢ã¼ããã¯ãã£ã arm64 ã¨ãã¦ãã¾ãããä»ã®ã¿ã¼ã²ããã§ãåæ§ã®æé ã¨ãªãã§ããããã¾ããCè¨èªãåæã«æ¸ãã¦ãã¾ãããä»ã®è¨èªã§ãã©ã¤ãã©ãªããªã³ã¯ããå ´åã¯åèã«ãªãããããªãããªã¨æãã¾ãã
aptãªãã¸ããªã®æºå
ã¾ãã¯ã¿ã¼ã²ããã¨ãªãã¢ã¼ããã¯ãã£ãããã±ã¼ã¸ç®¡çã·ã¹ãã ã«è¿½å ãã¾ãã
sudo dpkg --add-architecture arm64
GitHub Actionsã®ubuntuã©ã³ãã¼ã«ã¯x86ããã±ã¼ã¸ã®ãªãã¸ããªããè¨å®ããã¦ããªãã®ã§ãARMããã±ã¼ã¸ãããaptãªãã¸ããªã®URLã/etc/apt/sources.list.d/arm64.listã«è¨å®ãã¾ãã
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted
ã¾ããGitHub Actionsã©ã³ãã¼ã® /etc/apt/sources.list ã¯ã¢ã¼ããã¯ãã£ãå¶éãã¦ããªãã®ã§ããã®ã¾ã¾ã 㨠arm64 ããã±ã¼ã¸ãæ¢ãã¦ãã¾ã£ã¦è¦åãåºåããã¾ããã©ã®ã¿ã¡ããã©ã«ãã®ãªãã¸ããªã« arm64 ããã±ã¼ã¸ã¯ç¨æããã¦ããªãã®ã§ãæ¢ããªããã arch= ãªãã·ã§ã³ãè¨å®ãã¦ããã¾ãã
sudo sed -i -E '/^deb(-src)? ([^[])/s/ / [arch=amd64,i386] /' /etc/apt/sources.list
sources.list ã®åé ç®ãã©ããªæå³ãªã®ãã¯ä»¥ä¸ã®è¨äºãåãããããã¨æãã¾ãã
ã³ã³ãã¤ã©ã¨ã©ã¤ãã©ãªã®ã¤ã³ã¹ãã¼ã«
ããã¾ã§çµããã°ãã³ã³ãã¤ã©ã¨å¿ è¦ãªã©ã¤ãã©ãªãã¤ã³ã¹ãã¼ã«ãã¾ãããã
sudo apt update sudo apt install -y gcc-aarch64-linux-gnu sudo apt install -y libsystemd-dev libsystemd-dev:arm64 # libsystemdããªã³ã¯ãããå ´åã®ä¾
ãã®ã¨ãã gcc ã§ã¯ aarch64 ã®é¨åãã¿ã¼ã²ã¼ããã®ã¢ã¼ããã¯ãã£åã«ãªãã¾ããã¾ãããªã³ã¯ããã©ã¤ãã©ãªã¯ããã±ã¼ã¸åã®å¾ãã« :arm64 ã®ããã«ã¢ã¼ããã¯ãã£åã追å ãã¾ãã
arm64ã¨aarch64ã®é¢ä¿
ããã¾ã§ã§ã arm64 ã aarch64 ã¨ãã£ãå称ã使ãã¾ããããä½ãéãã®ã§ããããã
ãããã®ååã¯ãaarch64 ã¯å½ä»¤ã»ããã®ååã«ãarm64 ã¯ARMããã»ããµã®64bitã¢ã¼ããã¯ãã£ã«ç±æ¥ãã¾ããã¯ãã¹ã³ã³ãã¤ã«ããç¶æ³ã«ããã¦ã¯çµå±ã©ã¡ãã64bit ARMãæå³ãã¦ãã¾ãããæ´å²çãªäºæ ã«ãã£ã¦ä½¿ã£ã¦ããå称ãç°ãªãã¾ãã
以ä¸ã¯åã·ã¹ãã ãã©ã¡ãã®è¡¨è¨ã使ã£ã¦ãããã¾ã¨ãã表ã§ãããã£ãããªã®ã§x86ã®è¡¨è¨ãå ãã¦ã¿ã¾ããã
ã·ã¹ãã | x86 | ARM |
---|---|---|
GCC | x86_64 | aarch64 |
Clang | x86_64 | aarch64 1 |
GNU | x86_64 | arm64 |
Debian/Ubuntu | amd64 | arm64 |
RHELç³» | x86_64 | aarch64 |
Plan 9 | amd64 | arm64 |
Go | amd64 | arm64 |
Windows | x64 2 | arm64 |
ãªã®ã§ãgccããã±ã¼ã¸ã®ã¿ã¼ã²ããå㯠aarch64 ã¨ãªã£ã¦ããããã©ã¤ãã©ãªã®ã¢ã¼ããã¯ãã£åã¯Debian/Ubuntuã®å½åã«æ²¿ãã®ã§ libsystemd:arm64 表è¨ã使ããã¦ããããã§ãã*3ã
ã½ã¼ã¹ã³ã¼ãããã«ããã
ãã«ãããã¨ãã¯ã¿ã¼ã²ããç¨ã® gcc ã使ãã°ããã ãã§ãã make ã使ã£ã¦ããå ´å㯠CC å¤æ°ã«ã»ãããã¾ãã
make CC=aarch64-linux-gnu-gcc
ã©ã¤ãã©ãªã®ãªã³ã¯çã¯ãã¿ã¼ã²ããç¨ã® gcc ãã¿ã¼ã²ããç¨ã®ã©ã¤ãã©ãªãæ¢ãã¦ãããã®ã§ãéçºè ãæèãããã¨ã¯ããã¾ããã
ã¯ã¼ã¯ããã¼
ããã¾ã§ã®ã¯ã¼ã¯ããã¼ãã¾ã¨ãã¾ãã
steps: - name: Add an architecture to install packages run: | sudo dpkg --add-architecture arm64 sudo sed -i -E '/^deb(-src)? ([^[])/s/ / [arch=amd64,i386] /' /etc/apt/sources.list source /etc/lsb-release o="$(mktemp)" url='http://ports.ubuntu.com/ubuntu-ports' echo "deb [arch=arm64] $url $DISTRIB_CODENAME main restricted" >>"$o" echo "deb [arch=arm64] $url $DISTRIB_CODENAME-security main restricted" >>"$o" echo "deb [arch=arm64] $url $DISTRIB_CODENAME-updates main restricted" >>"$o" sudo install -m 644 "$o" /etc/apt/sources.list.d/arm64.list - name: Build sources run: | sudo apt update sudo apt install -y gcc-aarch64-linux-gnu sudo apt install -y libsystemd-dev libsystemd-dev:arm64 make CC=aarch64-linux-gnu-gcc
ãªãã¸ããªã®è¨å®é¨åã¯lufia/workflows/.github.actions/setup-multiarchã¨ãã¦è¤åã¯ã¼ã¯ããã¼ã«ãã¦ãããã®ã§ããããã°ä½¿ã£ã¦ãã ããã
steps: - uses: lufia/workflows/.github/actions/[email protected] with: arch: arm64
- Appleããã¯ã¨ã³ãã®ãã¨ãARM64ã¨å¼ãã§ãããAArch64ã«çµ±åããã↩
- x86-64 表è¨ãããããx64 ã®æ¹ãå¤ãã¨æã↩
*1:ã½ã¼ã¹ã³ã¼ããã³ã³ãã¤ã«ããå´
*2:ãã«ãããããã¤ããªãå®è¡ããå´
*3:çå±ã¯åãããã©ç´ããããã®ã§çµ±ä¸ãã¦ã»ãã