2019独角兽企业重金招聘Python工程师标准>>>

现象:原生android9.0 sdk,system/core/libusbhost是usb模块用来和驱动通信的模块,在调试时希望能输出log到logcat,打开调试开关重新编译代码,报“undefined reference to '__android_log_print'”错误

FAILED: out/soong/.intermediates/system/core/libusbhost/libusbhost/linux_glibc_x86_64_shared/libusbhost.so
prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++  @out/soong/.intermediates/system/core/libusbhost/libusbhost/linux_glibc_x86_64_shared/libusbhost.so.rsp out/soong/.intermediates/external/compiler-rt/libcompiler_rt-extras/linux_glibc_x86_64_static/libcompiler_rt-extras.a out/soong/.intermediates/external/libcxx/libc++/linux_glibc_x86_64_shared/libc++.so  -o out/soong/.intermediates/system/core/libusbhost/libusbhost/linux_glibc_x86_64_shared/libusbhost.so -shared -Wl,-soname,libusbhost.so -target x86_64-linux-gnu -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin  -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--no-undefined-version --gcc-toolchain=prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8 --sysroot prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot -m64 -Bprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/lib/gcc/x86_64-linux/4.8 -Lprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/lib/gcc/x86_64-linux/4.8 -Lprebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/lib64 -ldl -lpthread -lm -lrt -Wl,-rpath,\$ORIGIN/../lib64 -Wl,-rpath,\$ORIGIN/lib64  -nodefaultlibs -lgcc_s -lgcc -lc -lgcc_s -lgcc
system/core/libusbhost/usbhost.c:211: error: undefined reference to '__android_log_print'
system/core/libusbhost/usbhost.c:278: error: undefined reference to '__android_log_print'
system/core/libusbhost/usbhost.c:301: error: undefined reference to '__android_log_print'
system/core/libusbhost/usbhost.c:305: error: undefined reference to '__android_log_print'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
[ 16% 97/605] Construct recovery from boot
ninja: build stopped: subcommand failed.
11:04:39 ninja failed with: exit status 1

问题原因:

此问题的根本原因是,编译系统在链接时找不到相应的函数实现体,与头文件缺失无关,即函数实现体所在的liblog库无法被找到

解决办法:修改Android.bp,将liblog共享库声明放在target外面,暂不清楚放target里边为什么会链接不到

diff --git a/libusbhost/Android.bp b/libusbhost/Android.bp
old mode 100644
new mode 100755
index fc6f305..43076eb
--- a/libusbhost/Android.bp
+++ b/libusbhost/Android.bp
@@ -24,13 +24,16 @@ cc_library {srcs: ["usbhost.c"],cflags: ["-Werror"],export_include_dirs: ["include"],
+    shared_libs: [
+       "liblog",
+    ],target: {android: {cflags: ["-g","-DUSE_LIBLOG",],
-            shared_libs: ["liblog"],
+            //shared_libs: ["liblog"],},darwin: {enabled: false,

转载于:https://my.oschina.net/u/3750358/blog/3049783

【android9.0】system/core下的usbhost模块无法输出log到logcat相关推荐

  1. Android9.0版本Vold服务源码分析

    Vold: Volume Daemon,用于管理和控制Android平台外部存储设备的后台进程,这些管理和控制,包括SD卡的插拔事件检测/SD卡挂载/卸载/格式化等. 9.0以前framework j ...

  2. Ubuntu20.4 Android-9.0.0_r46源码下载编译

    Ubuntu20.4 Android-9.0.0_r46源码下载编译调试 安装Ubuntu虚拟机 ubuntu镜像下载地址: https://ubuntu.com/download 官网下载地址较慢可 ...

  3. android输出log,Android开发 Release情况下也能输出log

    一般我们开发程序都是在debug模式下开发,打log很方便,什么log.v.log.d.log.i都热别好使,但是到了要发布时我们通常要打release版包,在release版下做测试也是必需的,为了 ...

  4. Android9.0 Wifi模块Framework层分析

    Android9.0 Wifi Module 一.WifiService的启动 ​ Wifi Service是在SystemServer的startOtherServices中启动的.在其构造函数中主 ...

  5. .Net Core 之 图形验证码 本文介绍.Net Core下用第三方ZKWeb.System.Drawing实现验证码功能。...

    本文介绍.Net Core下用第三方ZKWeb.System.Drawing实现验证码功能. 通过测试的系统: Windows 8.1 64bit Ubuntu Server 16.04 LTS 64 ...

  6. System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes”

    "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Y ...

  7. .netFramewo 4.0软件报 未能加载文件或程序集“System.Core, Version=2.0.5.0错误处理

    前一段时间开发了一个软件,在部分用户电脑报错: 未能加载文件或程序集"System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToke ...

  8. android9.0系统下,如何保活

    android9.0系统下,讨论如何延长APP退到后台的保活/复活时间 一.7.0及以上不存在真正意义的保活. 二.盘点目前在9.0上,可能有效的"白色手段"保活手段(这里不讨论黑 ...

  9. Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5

    java 中调外部工具   做word转pdf ,没有生成pdf, log中出现 [开始转换文档... finish [WINWORD] convert. Could not load file or ...

最新文章

  1. WIndows via C/C++ 学习(12)权限上下文
  2. Flume 1.6 遇Emoji表情发生截断丢失数据问题分析
  3. 【洛谷P4169】天使玩偶/SJY摆棋子【CDQ分治】
  4. nginx.conf添加lua.conf配置
  5. (二十六)深度学习目标检测:Fast-RCNN
  6. 谷歌收购DNNresearch能获得什么?
  7. 前端面试官经验总结 | 前端面试小技巧
  8. 手游发展迅猛,渠道要搭建移动游戏生态圈才有出路
  9. 阿里云国际站怎么注册?
  10. python画图库-matplotlib
  11. [曲苑杂谈]mac\windows phpstorm快捷键
  12. 安全管家安卓_安卓手机自带的管家好,还是另外获取的管家好呢?这4点你要知道...
  13. 31.SAP MII产品介绍(06)功能详解(04)数据服务和系统资源
  14. 程序员的最高境界(转)
  15. 拥有谷歌100万股原始股,奥尼尔每年能够得到多少分红?
  16. 西门子6SE70交流变频器的详细介绍
  17. mc服务器常用指令_mc服务器常用指令
  18. 小程序源码:好玩的表情包机器人-多玩法安装简单
  19. 年前HCIA笔记的总结
  20. pythonselenium教学视频_从零开始学Selenium自动化测试(基于Python·视频教学版)

热门文章

  1. Codeforces #264 (Div. 2) D. Gargari and Permutations
  2. 关于自动寻径和图、邻接表的学习和启发
  3. 利用返回引用来操作结构体
  4. windows server 2003上安装mysql的问题
  5. VB读取INI配置文件各方资料整合
  6. 新一代数据中心设计技术研讨会
  7. ActionScript 3.0 Step By Step系列(一):工欲其善,先利其器(Flex Builder)
  8. Vista OS 中添加网络中的非Vista OS共享的打印机
  9. BUGKU 密码题:这不是摩斯密码
  10. 用二项逻辑斯蒂回归解决二分类问题