eunomia-bpf / bpftime

Userspace eBPF runtime for fast Uprobe & Syscall hook & Extensions with LLVM JIT
https://eunomia.dev/bpftime/
MIT License
693 stars 68 forks source link

[FEATURE] Simplify the dependence for runtime #231

Open yunwei37 opened 4 months ago

yunwei37 commented 4 months ago

Is your feature request related to a problem? Please describe.

Currently, if I want to use runtime as a library, I need to write a lot of link commands:


LDFLAGS =   -L$(ROOTDIR)/build-bpftime/bpftime/runtime  \
            -L$(ROOTDIR)/build-bpftime \
            -L$(ROOTDIR)/build-bpftime/bpftime/vm \
            -L$(ROOTDIR)/build-bpftime/bpftime/third_party/spdlog \
            -L$(ROOTDIR)/build-bpftime/bpftime/FridaGum-prefix/src/FridaGum/ \
            -L$(ROOTDIR)/build-bpftime/bpftime/attach/base_attach_impl \
            -L$(ROOTDIR)/build-bpftime/bpftime/attach/frida_uprobe_attach_impl \
            -L$(ROOTDIR)/build-bpftime/bpftime/attach/syscall_trace_attach_impl \
            -lruntime \
            -lpthread -lm -ldl -lconfig -lnuma -lgcov -lstdc++ -lruntime \
            -lbpftime_base_attach_impl \
            -lbpftime_frida_uprobe_attach_impl \
            -lbpftime_syscall_trace_attach_impl \
            -lvm-bpf -lspdlogd -lbpf \
            -lfrida-gum -lpthread -lm -ldl -lz -lelf 

This is not user-friendly and should be simplified.

Describe the solution you'd like

It would be better if the libruntime.a can be used just like:

LDFLAGS =   -L$(ROOTDIR)/build-bpftime/bpftime/runtime  \
            -lruntime
Officeyutong commented 4 months ago

Please use cmake. Cmake will handle the link stage automatically and you don't need to manually specify all indirect dependencies.

Officeyutong commented 4 months ago

It's also impossible to link a single library, since libraries you linked contain both static and dynamic libraries

Officeyutong commented 4 months ago

Please use cmake. Cmake will handle the link stage automatically and you don't need to manually specify all indirect dependencies.

See https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#id25 for details

Officeyutong commented 3 months ago

Related to #232

Building all dependencies into a single static library should solve this issue

hp77-creator commented 3 months ago

Hi @Officeyutong #232 only concerns with static libraries, for dynamic libraries we will still need to link them right?

Officeyutong commented 3 months ago

Hi @Officeyutong #232 only concerns with static libraries, for dynamic libraries we will still need to link them right?

Yes