在 AOSP 编译第三方软件 xcb,编译
libxcb-dri2.soexterna/X11/xcb/libxcb/src/
Android.mk 内容如下
```
include $(CLEAR_VARS)
LOCAL_MODULE := libxcb-dri2
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_SRC_FILES = dri2.c
LOCAL_MODULE_TARGET_ARCH := x86_64
LOCAL_SHARED_LIBRARIES := libXauth libXdmcp libxcb
LOCAL_CFLAGS := -DHAVE_CONFIG_H
LOCAL_HEADER_LIBRARIES := xorgproto_headers
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/xcb
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_MODULE_TAGS := optional eng debug tests
include $(BUILD_SHARED_LIBRARY)
```
生成 so 的位置如下
```
╭─iam070@leap /data/aosp/out/target
╰─$ find -name "libxcb-dri2*" 127 ↵
./product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates
./product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates/LINKED/
libxcb-dri2.so ./product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates/PACKED/
libxcb-dri2.so ./product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates/
libxcb-dri2.so ./product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates/libxcb-dri2.so.toc
./product/generic_x86_64/system/lib64/
libxcb-dri2.so./product/generic_x86_64/obj_x86/SHARED_LIBRARIES/libxcb-dri2_intermediates
./product/generic_x86_64/symbols/system/lib64/
libxcb-dri2.so```
我在另外一个组件里调用
libxcb-dri2.so ,却提示找不到
libxcb-dri2.soexternal/x86_64_gralloc/
Android.mk```
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_HEADER_LIBRARIES := \
xorgproto_headers \
libX11_headers \
libhardware_headers \
libxcb_headers
LOCAL_SHARED_LIBRARIES := liblog libcutils libX11 libxcb libxcb-dri2
LOCAL_SRC_FILES := \
gralloc.cpp \
framebuffer.cpp
LOCAL_MODULE_TARGET_ARCH := x86_64
LOCAL_MODULE := gralloc_exe
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -DEXEC_TEST -Wno-missing-field-initializers
include $(BUILD_EXECUTABLE)
```
编译错误提示为
```
clang.real: error: no such file or directory: 'out/target/product/generic_x86_64/obj/lib/
libxcb-dri2.so'
```
现在看问题如下
//BUILD_SHARED_LIBRARIES
libxcb-dri2.so 的时候放置的路径是
out/target/product/generic_x86_64/obj/SHARED_LIBRARIES/libxcb-dri2_intermediates/
libxcb-dri2.so out/target/product/generic_x86_64/system/lib64/
libxcb-dri2.so// 而在 BUILD_EXECUTABLE 的时候,选找的是
out/target/product/generic_x86_64/obj/lib/
libxcb-dri2.so```
手动复制是可以解决编译问题,需要怎么配置才能找到正确的路径呢?自己看了一下 AOSP 的 build 脚本,没找到哪个设置项可以让 so 生成到 out/target/product/generic_x86_64/obj/lib/(这个路径下放置的都是 AOSP 系统组建的 so 文件)
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/512314
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.