[FEATURE] Add ability to package all-in-one static library
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
hi @Officeyutong @yunwei37 would like to take a crack at this, could you please assign this to me
OK! Thanks!
hi @Officeyutong @yunwei37 would like to take a crack at this, could you please assign this to me
Hi, how's going on now?
Folks, Can I try this? @Officeyutong @yunwei37 ?
Reference
Sure!
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?
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_librarylevel since we have multiple sub-directories and libraries or should it be just at thevmorruntimelevel?
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
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
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