V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iam070
V2EX  ›  Android

AOSP 编译第三方 so 供其他组件使用,提示找不到相关 so

  •  
  •   iam070 · 2018-11-28 14:06:24 +08:00 · 9488 次点击
    这是一个创建于 2192 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在 AOSP 编译第三方软件 xcb,编译 libxcb-dri2.so
    externa/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.so
    external/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 文件)
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4129 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 05:30 · PVG 13:30 · LAX 21:30 · JFK 00:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.