编译libdisplay_gfx.z.so,该库依赖闭源库xxx.so, 但是libdisplay_gfx.z.so的NEEDED字段包含了xxx.so的路径信息,该如何配置gn脚本把这个路径信息去掉?

海天一色 显示全部楼层 发表于 2024-10-9 16:03:44
如题,readelf -d libdisplay_gfx.z.so,期望的结果是

(NEEDED)             共享库:[xxx.so]

但是实际结果是:

(NEEDED)             共享库:[obj/device/soc/xxx/xxxx/hardware/xxxx/lib64/xxx.so]


使用的是4.1-release版本

您尚未登录,无法参与评论,登录后可以:
参与开源共建问题交流
认同或收藏高质量问答
获取积分成为开源共建先驱

精彩评论2

fengyunrenwu

沙发 发表于 2024-10-12 14:53:20
正常链接动态库带路径和rpath是正常的,如果想不带路径,需要重新编译被依赖的共享库,指定该共享库的library,不存在library name。

海天一色

板凳 发表于 2024-10-14 11:14:50
我直接用ldflags来指定依赖的共享库就没问题了
ohos_shared_library("libdisplay_buffer_vdi_impl") {
  sources = [
     "src/display_gralloc/display_buffer_vdi_impl.cpp",
     "src/display_gralloc/display_gralloc_gbm.cpp"
  ]
  
  include_dirs = [
    "./src/display_gralloc",
    "//drivers/peripheral/base",
    "//drivers/interface/display/composer/hdifd_parcelable",
    "//drivers/interface/display/buffer",
    "//drivers/peripheral/display/utils/include",
    "//drivers/peripheral/display/buffer/hdi_service/include",
  ]

  output_name = "libdisplay_buffer_vdi_impl"
  cflags = ["-Wno-macro-redefined"]
  #deps = [ "//device/soc/xxxx/xxxx/hardware/xxx:libxxx" ]   #原来写法
  ldflags = [ "-L../../device/soc/xxx/edge10/hardware/xxx/lib64", "-lxxx" ]   #修改后写法

  external_deps = [
    "c_utils:utils",
    "drivers_interface_display:display_buffer_idl_headers",
    "drivers_interface_display:display_composer_idl_headers",
    "hdf_core:libhdf_utils",
    "hilog:libhilog",
    "ipc:ipc_single",
  ]

  install_enable = true
  install_images = [ chipset_base_dir ]
  subsystem_name = "xxxx"
  part_name = "xxx"
}

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部