记录一些日常遇到的编译问题及解决方法,查找的时候可以直接搜索问题描述的关键部分。
FAILED: out/target/product/gin/abl.elf /bin/bash -c "\$(pwd)/prebuilts/build-tools/linux-x86/bin/make -C bootable/bootloader/edk2 BOOTLOADER_OUT=../../../out/target/product/gin/obj/ABL_OBJ all PREBUILT_HOST_TOOLS=CC=/home/sun/project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/bin/clang\\ CXX=/home/sun/project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/bin/clang++\\ LDPATH=\"-fuse-ld=/home/sun/project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/bin/ld.lld\"\\ AR=/home/sun/project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/bin/llvm-ar PREBUILT_PYTHON_PATH=\$(pwd)/prebuilts/python/linux-x86/2.7.5/bin/python2 MAKEPATH=\$(pwd)/prebuilts/build-tools/linux-x86/bin/ BUILD_SYSTEM_ROOT_IMAGE=0 VERIFIED_BOOT=0 VERIFIED_BOOT_2=1 VERIFIED_BOOT_LE=0 USER_BUILD_VARIANT=0 DISABLE_PARALLEL_DOWNLOAD_FLASH=0 AB_RETRYCOUNT_DISABLE=0 DYNAMIC_PARTITION_SUPPORT=1 TARGET_SUPPORTS_EARLY_USB_INIT=0 CLANG_BIN=/home/sun/project/Android10_Project/vendor/qcom/proprietary/llvm-arm-toolchain-ship/8.0/bin/ CLANG_PREFIX=/home/sun/project/Android10_Project/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- ABL_USE_SDLLVM=true ABL_SAFESTACK=true SAFESTACK_SUPPORTED_CLANG_VERSION=6.0 CLANG_GCC_TOOLCHAIN=/home/sun/project/Android10_Project/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 TARGET_ARCHITECTURE=AARCH64 BOARD_BOOTLOADER_PRODUCT_NAME=gin USERDATAIMAGE_FILE_SYSTEM_TYPE=f2fs" make: Entering directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2' Loading previous configuration from /home/sun/project/Android10_Project/bootable/bootloader/edk2/Conf/BuildEnv.sh WORKSPACE: /home/sun/project/Android10_Project/bootable/bootloader/edk2 EDK_TOOLS_PATH: /home/sun/Project/Android10_Project/bootable/bootloader/edk2/BaseTools CONF_PATH: /home/sun/project/Android10_Project/bootable/bootloader/edk2/Conf make[1]: Entering directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools' /home/sun/project/Android10_Project/prebuilts/build-tools/linux-x86/bin/make -C Source/C make[2]: Entering directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools/Source/C' Attempting to detect ARCH from 'uname -m': x86_64 Detected ARCH of X64 using uname. mkdir -p . /home/sun/project/Android10_Project/prebuilts/build-tools/linux-x86/bin/make -C Common make[3]: Entering directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools/Source/C/Common' make[3]: *** No rule to make target '/home/sun/Project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/lib64/clang/9.0.3/include/stdint.h', needed by 'BasePeCoff.o'. Stop. make[3]: Leaving directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools/Source/C/Common' make[2]: *** [GNUmakefile:79: Common] Error 2 make[2]: Leaving directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools/Source/C' make[1]: *** [GNUmakefile:25: Source/C] Error 2 make[1]: Leaving directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2/BaseTools' make: *** [makefile:138: EDK_TOOLS_BIN] Error 2 make: Leaving directory '/home/sun/project/Android10_Project/bootable/bootloader/edk2' 17:08:52 Disallowed PATH tool "pkg-config" used: []string{"pkg-config", "--cflags", "ncursesw"} 17:08:52 See https://android.googlesource.com/platform/build/+/master/Changes.md#PATH_Tools for more information. |
错误一: “EDK_TOOLS_PATH: /home/sun/Project/Android10_Project/bootable/bootloader/edk2/BaseTools”
(1) 问题描述:
同步代码的时候我建的文件夹确实叫做"Project",但是后来我把"P"改成小写的"p",而在编译的时候edk2的路径EDK_TOOLS_PATH并不会重新生成,所以路径无效最终导致编译失败。
(2) 解决办法:
进入EDK_TOOLS_PATH的上一级目录,即/home/sun/project/Android10_Project/bootable/bootloader/edk2,然后执行下面命令重新生成edk2的路径
rm -rf Conf/BuildEnv.sh #EDK_TOOLS_PATH就在这个文件中
unset EDK_TOOLS_PATH
./edksetup.sh BaseTools
错误二: “make[3]: *** No rule to make target ‘/home/sun/Project/Android10_Project/prebuilts/clang/host/linux-x86/clang-r353983c1/lib64/clang/9.0.3/include/stdint.h’, needed by ‘BasePeCoff.o’. Stop.”
(1) 问题描述:
这个其实和上面的错误一个道理,都是旧目录名称没有更新(旧目录叫“Project”,新目录叫“project”)
(2) 解决办法:
上个错误已解决的基础上,在EDK_TOOLS_PATH目录,执行make clean即可。
使用
git clean -df
和git checkout .
重置仓库再编译也会报这个错误,原因是 edk2/Conf 包含.gitignore
,这个文件中忽略了Conf目录的新增文件,所以使用git是无法重置的。
[ 5% 634/10974] build out/target/product/trinket/obj/PACKAGING/vndk_intermediates/check-list-timestamp FAILED: out/target/product/trinket/obj/PACKAGING/vndk_intermediates/check-list-timestamp /bin/bash -c "(( diff --old-line-format=\"Removed %L\" --new-line-format=\"Added %L\" --unchanged-line-format=\"\" build/make/target/product/gsi/29.txt out/target/product/trinket/obj/PACKAGING/vndk_intermediates/libs.txt || ( echo -e \" error: VNDK library list has been changed.\\n\" \" Changing the VNDK library list is not allowed in API locked branches.\"; exit 1 )) ) && (mkdir -p out/target/product/trinket/obj/PACKAGING/vndk_intermediates/ ) && (touch out/target/product/trinket/obj/PACKAGING/vndk_intermediates/check-list-timestamp )" Added VNDK-core: libturbo_jpeg.so error: VNDK library list has been changed. Changing the VNDK library list is not allowed in API locked branches. |
问题描述: 看报错内容,可以知道是用diff命令对29.txt和libs.txt的内容进行了逐行比较,因两个文件内容不一致而导致的问题。至于为什么不一样,那是因为由于项目原因,需要添加一个名为libturbo_jpeg的VNDK动态库,在编译的时候新库名字被写到了libs.txt,而29.txt还是原先内容
动态库的创建是在external/libjpeg-turbo/Android.bp中,如下
cc_library {
name: "libturbo_jpeg",
host_supported: true,
vendor_available: true, //VNDK库需要设置为true
vndk: {
enabled: true, //VNDK库需要设置为true
},
defaults: ["libjpeg-defaults"],
export_include_dirs: ["."],
target: {
windows: {
enabled: true,
},
},
srcs: [
"jdatadst-tj.c",
"jdatasrc-tj.c",
"turbojpeg.c",
"transupp.c",
"rdbmp.c",
"rdppm.c",
"wrbmp.c",
"wrppm.c",
],
cflags: [
"-DBMP_SUPPORTED",
"-DPPM_SUPPORTED",
"-Werror",
"-Wno-unused-parameter",
],
}
解决方法:
将libs.txt的内容直接全部拷贝到29.txt中即可
FAILED: build/make/core/main.mk:1158: warning: "xxf : _modules_xxx_cut" = build/make/core/Makefile:76: warning: Duplicate header copy: out/target/product/myproject/obj/include/mycarcam/mycarcam.h build/make/core/Makefile:76: warning: _ Using vendor/qcom/proprietary/mm-camera/ais/API/inc/mycarcam.h build/make/core/Makefile:76: warning: __ from vendor/qcom/proprietary/mm-camera/ais/libais_client.mk build/make/core/Makefile:76: warning: _ Ignoring vendor/qcom/proprietary/mm-camera/ais/API/inc/mycarcam.h build/make/core/Makefile:76: warning: __ from vendor/qcom/proprietary/mm-camera/ais/libais_client.mk build/make/core/Makefile:76: warning: Duplicate header copy: out/target/product/myproject/obj/include/mycarcam/mycarcam_types.h build/make/core/Makefile:76: warning: _ Using vendor/qcom/proprietary/mm-camera/ais/API/inc/mycarcam_types.h build/make/core/Makefile:76: warning: __ from vendor/qcom/proprietary/mm-camera/ais/libais_client.mk build/make/core/Makefile:76: warning: _ Ignoring vendor/qcom/proprietary/mm-camera/ais/API/inc/mycarcam_types.h build/make/core/Makefile:76: warning: __ from vendor/qcom/proprietary/mm-camera/ais/libais_client.mk build/make/core/Makefile:95: error: duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers. |
问题描述: 看error那行,意思是不再允许拷贝重复的头文件,然后我们再看上面的warning,发现编译过程中mycarcam.h和mycarcam_types.h被重复拷贝了,这是不被允许的(不过我试过只重复一个文件就没问题,费解。。。)
解决方法: 经过排查是mk文件中,这两个头文件被重复拷贝了,可根据项目实际情况进行添加条件避免重复拷贝
[ 99% 365/366] finishing build rules ... FAILED: vendor/qcom/proprietary/pis/test/test_util/Android.mk: error: "libpis_test_util (native:platform) can not link against libimg (native:vendor)" vendor/qcom/proprietary/pis/test/test_util/Android.mk: error: "libpis_test_util (SHARED_LIBRARIES android-arm64) missing libjpeg (SHARED_LIBRARIES android-arm64)" You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build. ... build/make/core/main.mk:959: error: exiting from previous errors. 14:45:48 ckati failed with: exit status 1 #### failed to build some targets (02:46 (mm:ss)) #### |
错误一: “libpis_test_util (native:platform) can not link against libimg (native:vendor)”
(1) 错误分析:
这个error表达的是库libpis_test_util(native:platform)
不能链接库libimg (native:vendor)
。看下面两个Android.mk文件,libpis_test_util(native:platform)
用链接系统库
的方式链接了vendor库
,这个肯定是不行。
libpis_test_util的Android.mk:
...//省略 LOCAL_MODULE := libpis_test_util LOCAL_HEADER_LIBRARIES := libtest_headers LOCAL_SHARED_LIBRARIES += libtest libimg libjpeg //LOCAL_SHARED_LIBRARIES这个flag是用来链接系统库的 ...//省略
libimg的Android.mk:
...//省略 include $(CLEAR_VARS) LOCAL_MODULE := libimg LOCAL_MODULE_CLASS := SHARED_LIBRARIES LOCAL_MODULE_SUFFIX := .so LOCAL_STRIP_MODULE := false LOCAL_MULTILIB := 64 LOCAL_MODULE_OWNER := qcom LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := ../../.././target/product/xxx/system/lib64/libimg.so LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/lib64 LOCAL_PROPRIETARY_MODULE := true //这里可以看到libimg库是属于proprietary的,也就是vendor的模块 include $(BUILD_PREBUILT) ...//省略
(2) 解决方法:
把libimg的Android.mk中的LOCAL_PROPRIETARY_MODULE
置为false,或者把libpis_test_util的Android.mk中的LOCAL_SHARED_LIBRARIES
改为LOCAL_LDFLAGS
(就是把链接方式由链接系统库改为链接第三方库)
错误二: “libpis_test_util (SHARED_LIBRARIES android-arm64) missing libjpeg (SHARED_LIBRARIES android-arm64)”
(1) 错误分析:
这个error表达的是编译系统没有找到libjpeg库,通过查看是没有为libjpeg库添加编译规则
(2) 解决方法:
在对应的Android.mk中加入编译规则,对应内容如下所示:
include $(CLEAR_VARS)
LOCAL_MODULE := libjpeg
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
LOCAL_STRIP_MODULE := false
LOCAL_MULTILIB := 64
LOCAL_MODULE_OWNER := qcom
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := ../../.././target/product/xxx/system/lib64/libjpeg.so
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/lib
include $(BUILD_PREBUILT)
刚开始编译就报了下面的错误:
13:46:41 Waiting up to 10s to lock out/.lock to ensure no other Soong process is running in the same output directory 13:46:51 Tried to lock out/.lock, but timed out polling every 1s until 10s . Make sure no other Soong process is using it |
(1) 问题分析:
Android 7以后在编译系统方面,谷歌使用了Soong+Blueprint+Android.bp
替代Makefile+Android.mk
的方案(并未完全替代)。
在真正开始编译源码之前,会检查Soong进程是否唯一,核心代码如下:
//路径:build/soong/ui/build/proc_sync.go
func lockSynchronous(lock lockable, waiter waiter, logger logger.Logger) (err error) {
waited := false
for {
//[part 1]:使用tryLock()上锁,如果成功代表soong进程只有一个,则return nil,退出for循环
err = lock.tryLock() //成功返回空(nil)
if err == nil {
if waited {
// If we had to wait at all, then when the wait is done, we inform the user
logger.Printf("Acquired lock on %v; previous Soong process must have completed. Continuing...\n", lock.description())
}
return nil
}
//[part 2]:如果上边上锁失败,则会执行下面的代码。
done, description := waiter.checkDeadline() //waiter先检查是否超时,超时done置为true
if !waited {
logger.Printf("Waiting up to %s to lock %v to ensure no other Soong process is running in the same output directory\n", description, lock.description())
}
waited = true
if done { //如果done为true,则return错误信息,退出for循环
return fmt.Errorf("Tried to lock %s, but timed out %s . Make sure no other Soong process is using it",
lock.description(), waiter.summarize())
} else {
waiter.wait() //如果done不为true,则继续等待,进入下一次循环
}
}
}
(2) 解决方法:
保证不要对同一套代码同时编译多次,比如下面这个错误的编译指令就会造成同时编译两次。使用管道符连接make update-api
和make -j8
,众所周知,管道符两侧的命令是并行执行的,所以这样相当于同时执行两次make,而锁的机制大家也都知道,不能在锁没有释放的情况下再次上锁,所以后执行的make会报错退出。
错误的编译命令:
make update-api | make -j8 | tee build-android.log
正确编译命令:
make update-api && make -j8 | tee build-android.log
※ 上面的错误例子只是抛砖引玉,只要记住同一套代码,在编译还没完成的情况下,禁止再开个终端进行编译该套代码。
TEMPORARY_DISABLE_PATH_RESTRICTIONS was a temporary migration method, and is now obsolete
(1) 问题分析:
上面的问题翻译过来是:临时禁用路径限制是一种临时迁移方法,现已过时。报错脚本源码如下:
在终端用echo命令打印TEMPORARY_DISABLE_PATH_RESTRICTIONS的值,发现确实为true。
(2) 解决方法:
不知道是什么原因导致TEMPORARY_DISABLE_PATH_RESTRICTIONS被设置为了true,导致编译到这里报错。在终端执行下面的语句临时将TEMPORARY_DISABLE_PATH_RESTRICTIONS设置为false即可。
export TEMPORARY_DISABLE_PATH_RESTRICTIONS=false
2022-08-09 13:27:22 - build_image_standalone.py - INFO : Script Version : 1.2
2022-08-09 13:27:22 - build_image_standalone.py - INFO : Starting up builds merge..
2022-08-09 13:27:22 - build_image_standalone.py - INFO : QSSI build path = /home/sun/sata/home/sun/project/AOSP/QSSI
2022-08-09 13:27:22 - build_image_standalone.py - INFO : Target build path = /home/sun/sata/home/sun/project/AOSP/VENDOR
2022-08-09 13:27:22 - build_image_standalone.py - INFO : Merged build path = /home/sun/sata/home/sun/project/AOSP/VENDOR
2022-08-09 13:27:22 - build_image_standalone.py - INFO : Free Space available on /tmp = 15.3445320129G
2022-08-09 13:27:22 - build_image_standalone.py - ERROR : Not enough free space available on /tmp, aborting, min free space required = 24G !!
2022-08-09 13:27:22 - build_image_standalone.py - ERROR : Free up /tmp manually, and/or Increase it using: sudo mount -o remount,size=24G tmpfs /tmp
2022-08-09 13:27:22 - build_image_standalone.py - ERROR : Or Alternatively, Use --no_tmp option while triggering build_image_standalone, to not use /tmp if it is a low RAM machine
(1) 问题分析:
上面的build_image_standalone.py正常会调用vendor下的build.sh脚本中的打包功能。这期间检查用于存放临时文件的/tmp目录,发现只剩下16G左右,少于最低24G空间。
sun@sun-pc:~$ df -h
文件系统 容量 已用 可用 已用% 挂载点
udev 16G 0 16G 0% /dev
tmpfs 3.2G 4.1M 3.2G 1% /run
/dev/nvme1n1p3 47G 29G 16G 66% / #分区的时候只分了47G给根目录,剩下的空间仅有16G,所以/tmp最大只能申请到16G
...
(2) 解决方法:
上面报错的地方已经提供了两个解决方法,下面说明一下
● 方法一(不建议)
如果内存空间够大,可以将tmpfs挂载到/tmp上。
sudo mount -t tmpfs -o size=24G tmpfs /tmp
注:tmpfs是一种基于内存的文件系统,android系统打包期间产生的临时文件还是比较大的,这样会占用内存,导致ubuntu系统卡顿。这里倒是可以在磁盘剩余空间上再做一个分区出来,挂载到/tmp上使用。
● 方法二
直接在调用build_image_standalone.py的时候添加–no_tmp
选项即可,这样产生的临时文件都会被放到项目根目录下的tmp目录中,打包完成后此tmp目录会被清理。
function packagesupper()
{
cd ${ROOT_DIR}/../..
python VENDOR/vendor/qcom/opensource/core-utils/build/build_image_standalone.py \
--image super \
--qssi_build_path QSSI \
--target_build_path VENDOR \
--merged_build_path VENDOR \
--target_lunch xxx \
--output_ota \
--skip_qiifa \
--no_tmp #添加--no_tmp选项
return 0
}
[ 32% 1301/3980] Lex: aidl <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
Aborted (core dumped)
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
(1) 问题分析:
● bash执行命令:
prebuilts/misc/linux-x86/flex/flex-2.5.39 -o out/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll
flex-2.5.39是个词汇分析器,上述命令成功后,会将aidl_language_l.ll翻译为aidl_language_l.cpp。
● 提示语句:
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? ‘cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))’ ???
可以看到flex-2.5.39在加载locale.c的时候,locale.c中有语句乱码,这个其实就是当前系统的字符集不能对这条语句正确解码。(locale.c我也没找到在哪里,有知道的同学可以告诉我一下谢谢。)
(2) 解决方法:
既然是字符集的问题,直接使用下面命令去除本地化配置,再次编译即可。
export LC_ALL=C 或者 export LC_ALL=POSIX
有关本地化配置的知识后续有时间会进行整理。
FAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin stop-server 2>&1 || (exit 0) ) && (prebuilts/sdk/tools/jack-admin kill-server 2>&1 || (exit 0) ) && (prebuilts/sdk/tools/jack-admin uninstall-server 2>&1 || (exit 0) ) && (prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 2>&1 || (exit 0) ) && (mkdir -p \"out/dist/logs/jack/\" ) && (JACK_SERVER_VM_ARGUMENTS=\"-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Dcom.android.jack.server.log.file=/home/sun/code/8953_7120/out/dist/logs/jack/jack-server-%u-%g.log\" prebuilts/sdk/tools/jack-admin start-server 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA 2>&1 || exit 0 ) && (prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE || exit 47; prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA || exit 47 )"
Writing client settings in /home/sun/.jack-settings
Stopping background server
No Jack server running. Try 'jack-admin start-server'
Killing background server
No Jack server to kill
Jack server in "/home/sun/.jack-server" not found
Installing jack server in "/home/sun/.jack-server"
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /home/sun/.jack-server/server.jks -destkeystore /home/sun/.jack-server/server.jks -deststoretype pkcs12".
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /home/sun/.jack-server/client.jks -destkeystore /home/sun/.jack-server/client.jks -deststoretype pkcs12".
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Dcom.android.jack.server.log.file=/home/sun/code/8953_7120/out/dist/logs/jack/jack-server-%u-%g.log -Xmx4096m -cp /home/sun/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log
SSL error when connecting to the Jack server. Try 'jack-diagnose'
SSL error when connecting to the Jack server. Try 'jack-diagnose'
(1) 问题分析:
这里报错信息特别多而且乱,为了简化分析,将bash命令拆成下面这些命令,然后分别执行看一下结果:
● 停止 jack server进程
sun@sun-pc:~/code$ prebuilts/sdk/tools/jack-admin stop-server Stopping background server SSL error when connecting to the Jack server. Try 'jack-diagnose' |
● kill掉 jack server进程
sun@sun-pc:~/code$ prebuilts/sdk/tools/jack-admin kill-server Killing background server |
● 卸载并重新安装 jack server,jack-server默认安装路径/home/sun/.jack-server
sun@sun-pc:~/code$ prebuilts/sdk/tools/jack-admin uninstall-server Removing jack server from "/home/sun/.jack-server" sun@sun-pc:~/code$ prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar Installing jack server in "/home/sun/.jack-server" Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /home/sun/.jack-server/server.jks -destkeystore /home/sun/.jack-server/server.jks -deststoretype pkcs12". Warning: The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore /home/sun/.jack-server/client.jks -destkeystore /home/sun/.jack-server/client.jks -deststoretype pkcs12". |
● 创建 jack存储log的目录
\" 这个是转义双引号,特意用红字体标注出来了
sun@sun-pc:~/code$ mkdir -p \"out/dist/logs/jack/\" |
● 开启 jack server
sun@sun-pc:~/code$ JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Dcom.android.jack.server.log.file=/home/sun/code/8953_7120/out/dist/logs/jack/jack-server-%u-%g.log" prebuilts/sdk/tools/jack-admin start-server Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Dcom.android.jack.server.log.file=/home/sun/code/8953_7120/out/dist/logs/jack/jack-server-%u-%g.log -Xmx4096m -cp /home/sun/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher Jack server failed to (re)start, try 'jack-diagnose' or see Jack server log |
这条命令语句里又包含了两个命令:
# jack server的虚拟内存参数,jack-admin脚本默认定义了这个变量,这里多添加了一个log路径
JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Dcom.android.jack.server.log.file=/home/sun/code/8953_7120/out/dist/logs/jack/jack-server-%u-%g.log"
# 开启jack server进程,需要用到上面的参数
prebuilts/sdk/tools/jack-admin start-server
为什么没有分开执行?
是因为JACK_SERVER_VM_ARGUMENTS
这里用=
进行赋值的,这种方式无法被子shell继承使用。也就是说如果和jack-admin
脚本分开执行,jack-admin脚本将无法获得JACK_SERVER_VM_ARGUMENTS的值,所以这里两句话放在一起执行才行。
当然分开执行也行,只需要在赋值操作前加上export,即export JACK_SERVER_VM_ARGUMENTS=xxx
,这样就可以被子shell继承使用了。
● jack server升级
没有涉及本次报错,暂不分析
prebuilts/sdk/tools/jack-admin update server prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 4.8.ALPHA
prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-2.28.RELEASE.jar 2.28.RELEASE
prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-3.36.CANDIDATE.jar 3.36.CANDIDATE
prebuilts/sdk/tools/jack-admin update jack prebuilts/sdk/tools/jacks/jack-4.7.BETA.jar 4.7.BETA
(2) 解决方法:
这个先说答案,分析过程等有时间再补。
sudo gedit /etc/java-8-openjdk/security/java.security
然后将 jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4 … 里边的TLSv1, TLSv1.1删除即可。
/home/sun/code/android/kernel/msm-5.4/scripts/extract-cert.c:21:10: fatal error: 'openssl/bio.h' file not found
解决方法:
安装libssl-dev即可
sudo apt install libssl-dev
vendor/qcom/proprietary/mm-still/ipl/Android.mk:16: *** 配方在第一个目标前开始。 停止。
解决方法:
如下所示,本来15行最后面没有反斜杠( \ ),加上反斜杠就可以了。
12 libmmipl_cflags := -g -O3 \
13 $(CPU)
14 -Dlrintf=_ffix_r \
15 -D__alignx\(x\)=__attribute__\(\(__aligned__\(x\)\)\) \
16 -D_POSIX_SOURCE \
17 -DPOSIX_C_SOURCE=199506L \
make: *** No rule to make target 'frameworks/base/api/current.txt', needed by 'out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp'. Stop.
解决方法:
1.提示"No rule to make target xxx",大部分情况就是这个文件不存在。
2.提示没有规则去编译目标"frameworks/base/api/current.txt",而这个编译是被"out/target/common/obj/PACKAGING/checkpublicapi-current-timestamp"所需要的。这个一看就是检查android api用的,我们直接执行make update-api
就可以生成这个所需要的current.txt。
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6//x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/third_party_libvpx_libvpx_obj_int_extract_arm_host_gyp_intermediates/third_party/libvpx/source/libvpx/build/make/obj_int_extract.o: unsupported reloc 43 against global symbol stderr external/chromium_org/third_party/libvpx/source/libvpx/build/make/obj_int_extract.c:31: error: unsupported reloc 43 clang: error: linker command failed with exit code 1 (use -v to see invocation) |
问题分析:
结合上面三部分的错误信息,链接器在链接.o
文件时候报错unsupported reloc 43
。
我们回想一下编译的四个步骤:预处理,编译,汇编,链接。链接是属于编译的最后步骤,只是将所有.o文件链接成可执行文件,并没有什么特殊的语法检查的作用,所以我们可以把这个有问题的链接器替换掉。
解决方法:
使用/usr/bin/ld.gold替换有问题的ld
cp /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld