【android9.0】system/core下的usbhost模块无法输出log到logcat
生活随笔
收集整理的這篇文章主要介紹了
【android9.0】system/core下的usbhost模块无法输出log到logcat
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
現(xiàn)象:原生android9.0 sdk,system/core/libusbhost是usb模塊用來和驅(qū)動通信的模塊,在調(diào)試時希望能輸出log到logcat,打開調(diào)試開關(guān)重新編譯代碼,報“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問題原因:
此問題的根本原因是,編譯系統(tǒng)在鏈接時找不到相應的函數(shù)實現(xiàn)體,與頭文件缺失無關(guān),即函數(shù)實現(xiàn)體所在的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,?
轉(zhuǎn)載于:https://my.oschina.net/u/3750358/blog/3049783
總結(jié)
以上是生活随笔為你收集整理的【android9.0】system/core下的usbhost模块无法输出log到logcat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 聊聊elasticsearch的Rout
- 下一篇: 新增表单控件和表单属性