Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Officeyutong opened this issue Feb 26, 2024 · 9 comments · Fixed by #294
Closed

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

Officeyutong opened this issue Feb 26, 2024 · 9 comments · Fixed by #294
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Officeyutong
Copy link
Contributor

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 Officeyutong added enhancement New feature or request gsoc labels Feb 26, 2024
@yunwei37 yunwei37 added good first issue Good for newcomers help wanted Extra attention is needed and removed gsoc labels Feb 26, 2024
@sinduku
Copy link

sinduku commented Mar 4, 2024

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

@yunwei37
Copy link
Member

yunwei37 commented Mar 4, 2024

OK! Thanks!

@Officeyutong
Copy link
Contributor Author

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

Hi, how's going on now?

@hp77-creator
Copy link
Contributor

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

@Officeyutong
Copy link
Contributor Author

Reference

Sure!

@hp77-creator
Copy link
Contributor

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?

@Officeyutong
Copy link
Contributor Author

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

@hp77-creator
Copy link
Contributor

hp77-creator commented Apr 9, 2024

@Officeyutong
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
4 participants