bpftime icon indicating copy to clipboard operation
bpftime copied to clipboard

[FEATURE] Add ability to package all-in-one static library

Open Officeyutong opened this issue 1 year ago • 9 comments

Add ability to package all bpftime static library archives into a single archive.

Reference: https://github.com/WasmEdge/WasmEdge/blob/f5cf26c66e4bbb9bca00497fce5c814aac7d56fa/lib/api/CMakeLists.txt#L39

Hint:

  • use ${CMAKE_AR} to unarchive each individual to temporary directory, then use ar to repack them into a single archive
  • libbpf and spdlog and other dependencies are also needed

Officeyutong avatar Feb 26 '24 15:02 Officeyutong

hi @Officeyutong @yunwei37 would like to take a crack at this, could you please assign this to me

sinduku avatar Mar 04 '24 17:03 sinduku

OK! Thanks!

yunwei37 avatar Mar 04 '24 18:03 yunwei37

hi @Officeyutong @yunwei37 would like to take a crack at this, could you please assign this to me

Hi, how's going on now?

Officeyutong avatar Mar 28 '24 11:03 Officeyutong

Folks, Can I try this? @Officeyutong @yunwei37 ?

hp77-creator avatar Apr 02 '24 15:04 hp77-creator

Reference

Sure!

Officeyutong avatar Apr 02 '24 18:04 Officeyutong

hey @Officeyutong need a bit of guidance here, I checked out the function created in the CMake file that you linked in the first comment, I just have a question, where shall we make the archives? should it be at each add_library level since we have multiple sub-directories and libraries or should it be just at the vm or runtime level?

hp77-creator avatar Apr 07 '24 12:04 hp77-creator

hey @Officeyutong need a bit of guidance here, I checked out the function created in the CMake file that you linked in the first comment, I just have a question, where shall we make the archives? should it be at each add_library level since we have multiple sub-directories and libraries or should it be just at the vm or runtime level?

The purpose is to pack an archive so that if a user want to use bpftime, he just need to link that archive and the standard library. So we need to pack the following libraries:

  • All static libraries defined in bpftime, such as runtime, vm-bpf, frida_uprobe_attach_impl, and so on. Note that if we disable a certain feature through cmake options and leaded some libraries not defined, these libraries shouldn't be packed (such as if we disabled bpftime verifier, then we shouldn't pack bpftime-verifier)
  • Dependencies of the above libraries, except standard library. For example, frida, spdlog

Officeyutong avatar Apr 07 '24 16:04 Officeyutong

So, we should also have an option to package these libraries or should we mandate it? Like this: https://github.com/WasmEdge/WasmEdge/blob/f5cf26c66e4bbb9bca00497fce5c814aac7d56fa/lib/api/CMakeLists.txt#L144 https://github.com/WasmEdge/WasmEdge/blob/f5cf26c66e4bbb9bca00497fce5c814aac7d56fa/lib/api/CMakeLists.txt#L159

hp77-creator avatar Apr 09 '24 03:04 hp77-creator

So, we should also have an option to package these libraries or should we mandate it? Like this: https://github.com/WasmEdge/WasmEdge/blob/f5cf26c66e4bbb9bca00497fce5c814aac7d56fa/lib/api/CMakeLists.txt#L144 https://github.com/WasmEdge/WasmEdge/blob/f5cf26c66e4bbb9bca00497fce5c814aac7d56fa/lib/api/CMakeLists.txt#L159

We should have an option like BPFTIME_BUILD_STATIC_LIB, if enabled, a target named bpftime_static should be added, which includes all object files that we need

Officeyutong avatar Apr 09 '24 10:04 Officeyutong