前幾天 upstream tianocore/edk2 更新了 edk2_stable202205,本來想說直接 rebase 上去就好,沒想到都這麼穩定的 code 了還能遇到 build error
哪裡出了錯?
該 build error 的紀錄如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/LongJump.obj /home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/LongJump.iii
/home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/LongJump.iii:44: error: parser: instruction expected
/home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/LongJump.iii:49: error: parser: instruction expected
make: *** [GNUmakefile:787: /home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/LongJump.obj] Error 1
build.py...
: error 7000: Failed to execute command
make tbuild [/home/runner/work/myedk2/myedk2/Build/Shell/RELEASE_CLANGDWARF/X64/MdePkg/Library/BaseLib/BaseLib]
build.py...
: error F002: Failed to build module
/home/runner/work/myedk2/myedk2/edk2/MdePkg/Library/BaseLib/BaseLib.inf [X64, CLANGDWARF, RELEASE]
|
可以看到似乎問題跟 NASM 看不懂 MdePkg/Library/BaseLib/X64/LongJump.nasm 的 44 行與 49 行有關係,上網找了一下有沒有其他人遇到,很快就看到有人跟我一樣踩到同樣的問題。
解決方法並不難,只要將 NASM 更新到版本 2.15.05
,但我的 Ubuntu 上使用 apt 安裝的最新版本只有到 2.13.02-0.1
,看起來只能自己手動更新了。
安裝新版 NASM 的作法
可以直接到 NASM 官網下載最新版本替換即可
可以參考下面指令安裝 NASM 2.15.05 版本
1
2
3
4
5
6
|
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install -y wget alien
wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/linux/nasm-2.15.05-0.fc31.x86_64.rpm -O/tmp/nasm-2.15.05-0.fc31.x86_64.rpm
sudo alien /tmp/nasm-2.15.05-0.fc31.x86_64.rpm -i
rm -f /tmp/nasm-2.15.05-0.fc31.x86_64.rpm
|
安裝完新版的 NASM 之後就可以正常編譯了。
參考