Linux下常见的编译错误及解决方法

本文汇总了在编译Android源代码过程中常见的错误及其解决方案,包括bison、flex、gperf等工具缺失导致的问题,以及libGL.so共享库文件找不到等错误的处理办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
解决方法:sudo apt-get install bison

2、make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127
解决方法: sudo apt-get install flex

3、make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
解决方法:sudo apt-get install gperf

4、/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directoryIn file included from /home/hudan/android/source/android4.1.1/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../sysroot/usr/include/sys/types.h:27:0,
                 from frameworks/native/include/utils/Errors.h:20,
                 from frameworks/native/include/utils/String8.h:20,
                 from cts/suite/audio_quality/lib/include/Settings.h:21,
                 from cts/suite/audio_quality/lib/src/Settings.cpp:17:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directoryIn file included from /usr/include/stdlib.h:25:0,
                 from cts/suite/audio_quality/lib/src/Adb.cpp:16:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory

compilation terminated.
compilation terminated.
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcts_audio_quality_intermediates/src/SimpleScriptExec.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcts_audio_quality_intermediates/src/Adb.o] Error 1
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcts_audio_quality_intermediates/src/Settings.o] Error 1
In file included from /usr/include/semaphore.h:22:0,
                 from cts/suite/audio_quality/lib/include/Semaphore.h:21,
                 from cts/suite/audio_quality/lib/src/Semaphore.cpp:17:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcts_audio_quality_intermediates/src/Semaphore.o] Error 
解决方法:sudo apt-get install gcc-multilib 

5、error libGL.so: cannot open shared object file: No such file or directory
OSError: libGL.so: cannot open shared object file: No such file or directory

may appear on Linux systems when you try to launch VNL for the first time. To solve it, create (as administrator) a new link in /usr/lib:

sudo ln -s /usr/lib/libGL.so.1.2 /usr/lib/libGL.so

If you have a 64-bit Linux, use /usr/lib64 instead.

First check that you actually have "libGL.so.1.2" in /usr/lib or /usr/lib64; it might be called "libGL.so.1" or something else instead, or located in another directory, depending on the video drivers. You can use

locate libGL

to find the correct file to link to.


6、E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

解决:sudo  rm /var/lib/apt/lists/lock

7、sh: gperf: not found

target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/create_regex_tables
Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 140.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h'

解决方法:sudo apt-get install gperf


8、n file included from /usr/include/stdlib.h:25,
                 from build/tools/acp/acp.c:11:
/usr/include/features.h:323: 致命错误: bits/predefs.h:没有那个文件或目录编译中断。
make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] 错误 1

make: *** [out/host/linux-86/obj/STATIC_LIBRARIES/libcts_audio_quality_intermediates/src/Adb.o] Error 1

安装:libc6-dev-i386
     sudo apt-get install libc6-dev-i386

9、make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libwebcore_intermediates/LINKED/libwebcore.so] Error 1

make: *** Waiting for unfinished jobs....

make: *** [out/target/common/obj/APPS/android.core.tests.libcore.package.dalvik.no-core-tests-res_intermediates/noproguard.classes-with-local.dex] Error 130

上次make或或者mmm的时候生成一些错误的东西

可以使用:make clean 再重新make

解决:rm out/target/common/obj/APPS/ -r (如果还是有这样的错误,就只能clean了)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值