Title
#core
puffycid

puffycid

06/10/2021, 4:55 AM
Hi all, im trying to take stab at implementing https://github.com/osquery/osquery/issues/7054 (adding LIEF as dependency). Is there any documentation I can reference to adding a dependency to osquery? Unfortunately, my cmakelist skills are pretty limited 😢. im currently looking at how other dependencies are structured. Ive so far added it as a submodule, created Findlief.cmake and libraries/cmake/source/lief/CMakeLists.txt. Base on other libraries it looks like the next steps are to add/list the cpp files that need to be compile? Is a high level documentation somewhere (ex: previous PR or something else) that explains the steps needed to add a dependency? LIEF uses CMakeList (https://lief.quarkslab.com//doc/latest/installation.html#cmake-integration, https://lief.quarkslab.com//doc/latest/compilation.html) so I think it should be kind of straight forward to add? If there is no/limited documentation are there any existing osquery libraries/cmakelist that would be good to review to figure out how its working (currently reviewing ssdeep cmakelist) or any external generic cmakelist references that could assist? I already have most the code needed to use the library (planning to adapt most from https://github.com/puffyCid/lief-osquery). So the only outstanding tasks are just adding the cmakelist dependency and tests I can share what I have here or I can open a draft pr with what I currently have (so far just cmakelist.txt and Findlief.cmake) if that would help?
a

alessandrogario

06/10/2021, 8:49 AM
All the deps (with few exceptions such as OpenSSL) have been imported with new CMake written from scratch to make sure the build is reproducible and that the build settings for each library are correctly inherited from the osquery ones
8:50 AM
This is true regardless of the original build system used by the library
8:51 AM
I think there are some small deps (such as zlib) that can be used as an example on how to do this
8:52 AM
but there is really not a tutorial on this, some libraries are more complex than others and do a lot of things during the configuration or the build step (like generating source files on the fly)
puffycid

puffycid

06/14/2021, 1:08 AM
Thanks for the replies! I was able to get a cmakelist created and got the dependency added I opened a draft PR for feedback, comments and some review (cmakelist review)https://github.com/osquery/osquery/pull/7160