工作环境:Ubuntu 20.04-Vmware
虚拟机环境在编译pmon-loongarch、linux-4.19-loongson、uefi-loongarch提示缺少各种工具及库,详情如下。
PMON编译
编译pmon-loongarch遇到的问题:
-
make命令未找到
sudo apt-get install make
-
make:cc:命令未找到
sudo apt-get install gcc
-
make:bison:命令未找到
sudo apt-get install bison
-
/bin/sh: 1: flex: not found
sudo apt-get install flex
-
bin/sh: 1: makedepend: not found
sudo apt-get install xutils-dev
-
/bin/sh: 1: iasl: not found
sudo apt-get install acpica-tools
在虚拟机ubuntu20.04环境中,使用交叉编译工具链loongarch64-linux-gnu-2021-12-10-vector编译pmon-loongarch源码过程中依次遇到上述问题,通过安装make、gcc、bison、flex、xutils-dev、acpica-tools后,pmon编译成功。
Uefi编译
在搭建完pmon环境后,uefi-loongarch编译时遇到的问题
-
exec: python:未找到
sudo apt-get install python2.7
sudo ln -s /usr/bin/python2.7 /usr/bin/python2
sudo ln -s /usr/bin/python2 /usr/bin/python
安装python2.7,uefi交叉编译成功。
2. 如果环境变量已生效,编译过程中还报如下错误,在编译目录执行./build.sh clean
/bin/sh: 1: /loongarch64-linux-gnu-gcc: not found
内核编译
在pmon,uefi环境的基础上,内核linux-4.19-loongson遇到的编译问题
-
找不到ncurses
错误现象:
* Unable to find the ncurses package.
* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution).
*
make[1]: *** [scripts/kconfig/Makefile:228:scripts/kconfig/.mconf-cfg] 错误 1
make: *** [Makefile:556:menuconfig] 错误 2
sudo apt-get install libncurses-dev
-
缺libelf-dev
error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel
make: *** [Makefile:1141:prepare-objtool] 错误 1
sudo apt-get install libelf-dev
-
openssl/bio.h 没有这个文件或目录
scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: 没有那个文件或目录
21 | #include <openssl/bio.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.host:90:scripts/extract-cert] 错误 1
HOSTCC scripts/dtc/srcpos.o
make[1]: *** 正在等待未完成的任务....
HOSTLD scripts/genksyms/genksyms
make: *** [Makefile:1088:scripts] 错误 2
make: *** 正在等待未完成的任务....
CALL scripts/checksyscalls.sh
sudo apt-get install libssl-dev
openssl是一个程序组,帮助我们生成CA和证书等,libssl-dev包含了openssl的include文件和代码库。
linux-4.19-loongson安装上述三个包:libncurses-dev, libelf-dev,libssl-dev后,编译正常。