How to link my own static library to clearkeycdm shared library

642 views
Skip to first unread message

Ravikumar Patil

unread,
Jun 29, 2016, 8:40:38 AM6/29/16
to Chromium-dev
Hi,

I have a static library (e.g libabc.a). I want to link this static library with libclearkeycdm.so?
Please help me with changes required in the gyp files and which is the right place to keep my static library.

Thanks
-Ravi

Ravikumar Patil

unread,
Jun 29, 2016, 8:42:07 AM6/29/16
to Chromium-dev
I am trying this on linux...

Ravikumar Patil

unread,
Jun 29, 2016, 9:24:08 AM6/29/16
to Chromium-dev
I tried to link the static lib libClientSDK.a with libclearkeycdm.so by modifying media/cdm/ppapi/BUILD.gn as follows 

shared_library("clearkeydm") {
  sources = [
    "cdm_file_io_test.cc",
    "cdm_file_io_test.h",
    ...
  ]

  # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

  defines = [ "CDM_IMPLEMENTATION" ]

  deps = [
    ":ClientSDK",
    "//base",
    "//build/config/sanitizers:deps",
    "//media",  # For media::AudioTimestampHelper
    "//media:shared_memory_support",  # For media::AudioBus.
    "//url",
  ]

Build command: ninja -C out/Default/ clearkeycdmadapter
I am getting following build Error: 
[1/1] Regenerating ninja files
FAILED: /home/ravipatil/Project/Chromium/sm/buildtools/linux64/gn --root=/home/ravipatil/Project/Chromium/sm -q gen //out/Default/
ERROR Unresolved dependencies.
//media/cdm/ppapi:smhncdm(//build/toolchain/linux:clang_x64)
  needs //media/cdm/ppapi:OpusClientSDK(//build/toolchain/linux:clang_x64)

Need help to resolve this issue and get static library linked to clearkeycdm.

Thanks
-Ravi

John Rummell

unread,
Jun 29, 2016, 4:12:25 PM6/29/16
to ravikm...@gmail.com, Chromium-dev
To add libraries you need to specify ldflags (https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/reference.md#ldflags_Flags-passed-to-the-linker). No idea of the exact format, but there are existing uses in Chromium that you can follow.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Ravikumar Patil

unread,
Jun 30, 2016, 5:19:23 AM6/30/16
to Chromium-dev, ravikm...@gmail.com
Hi John,

Thanks for your quick response. Could you please point me to some instance in chromium when it has links to external static libs...

-Ravi
Reply all
Reply to author
Forward
0 new messages