1.错误zlib.h
compress.c:14:58: fatal error: zlib.h: No such file or directory
compilation terminated.
解决:sudo apt-get install zlib1g-dev
2.错误bison
make[2]: bison: Command not found
解决:sudo apt-get install bison
3.错误flex
/bin/sh: flex: not found
make[2]: *** [lib/conf-lex.c] Error 127
解决:sudo apt-get install flex
4.错误
lib/libsensors.so: undefined reference to sensors_yylex
lib/libsensors.so: undefined reference to sensors_yyin
lib/libsensors.so: undefined reference to sensors_lex_error
lib/libsensors.so: undefined reference to sensors_yylineno
collect2: ld returned 1 exit status
make[2]: *** [prog/sensors/sensors] Error 1
解决:After installing flex and/or bison, you'll need to 'make clean' before 'make user' will work properly.(安装flex或者bison之后,需要先make clean一下)
5.错误gmake
/bin/sh: gmake: not found
make[3]: *** [clean] Error 1
原因:在ubuntu中已经取消掉了gmake,都用make代替。
解决: sudo ln -s /usr/bin/make /usr/bin/gmake
6.错误
(cd basis/build/linux-am34-bluraypan; sh build_me.sh -c -b -j -L lex)
[: 133: unexpected operator
[: 133: unexpected operator
Error: DirectFB path point to an invalid path
Hint: you can set DirectFB path by:
- setenv MEI2_TOOLCHAIN_JAVA_DIR your_directfb_path
- use -D build switch, type build_me.sh -h for help
make[4]: [clean] Error 1
解决:$ sudo dpkg-reconfigure dash(可见dash的说明文)
选择[NO]
7.错误
Sequence (?<...) not recognized in regex; marked by <-- HERE in m//+|(?<\ <-- HERE !/)$/ at -e line 1.
解决:perl版本差别引起的异常message,降级perl版本至5.8.9
8.错误XftConfigLexDone
xftlex.l: In function XftConfigLexDone:
xftlex.l:274: `XftConfig_current_buffer' undeclared (first use in this function)
解决:
flex包版本不匹配.降级到2.5.4后,make clean后,编译通过.
9.错误libext2fs.info
make[5]: makeinfo: Command not found
make[5]: *** [libext2fs.info] Error 127
解决:$ sudo apt-get install texinfo
10.错误gawk
/bin/sh: line 1: gawk: command not found
make[6]: *** [stamp-gtktypebuiltins.h] Error 127
解决:$ sudo apt-get install gawk
11.错误indent
/bin/sh: line 2: indent: command not found
make[6]: *** [stamp-gtkmarshal.h] Error 127
解决:$ sudo apt-get install indent
12 错误: openssl/bio.h
“error : openssl/bio.h :No such file or folder
解决方法:sudo apt-get install libssl-dev
13 错误: code model kernel does not support PIC mode
在进行make oldconfig时出现,code model kernel does not support PIC mode的错误
解决方法如下:
在源码的根目录下的Makefile中的KBUILD_CFLAGS中添加一个编译选项
14 编译linux内核出现"linux/compiler-gcc7.h: No such file or directory"
解决方法如下
15 重启之后开机出现错误如下:
[Linux] end Kernel panic - not syncing: System is deadlocked on memory错误
解决方法:在虚拟机选项中将内存改大一些,我这边直接改成3GB了,然后再重启
总结:
1.一般出现”NO such file or directory”之类的报错,先看报错缺的是什么,然后再网上搜索对应的包是什么,使用sudo apt-get install X安装该包
2.建议不要使用太旧的linux内核版本,因为现在的交叉编译环境也再不断更新,使用太老旧的内核有时候会报一些奇奇怪怪的错误