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

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"
}

panhuohuo

发表于 2024-12-24 15:35  IP属地: 广东省广州市

回复 海天一色: deveco studio 编辑器怎么改, 默认不带这个文件, 官方编辑器编译也是黑盒

【1 条回复】

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

返回顶部