Commit Graph

45 Commits

Author SHA1 Message Date
Stefano Bonicatti
ed03df0df8 Make Boost winapi available to all platforms (#6166) 2020-01-12 01:35:26 -05:00
Teddy Reed
80ed884273
build: Pin Linux builds to use libc++ (#6158) 2020-01-03 19:57:09 -05:00
Stefano Bonicatti
668a1d86e6 CMake: Future proof Python finding mechanism (#6120)
CMake 3.16 doesn't set Python3_EXECUTABLE as cache variable anymore,
it has changed to _Python3_EXECUTABLE which is for internal use.
The module returns Python3_EXECUTABLE as a local variable,
so we share that value through a new custom cache variable,
OSQUERY_PYTHON_EXECUTABLE.
2019-12-11 22:32:08 -05:00
Stefano Bonicatti
7922cd78aa Fix possible xxhash collision between zstd and rdkafka (#6101)
Both libraries use the xxhash library,
compiling its source files directly.
The version they use though it's different so to avoid the linker
resolve the collision by removing one of the two implementations,
we prefix the functions with the respective library name.

Moreover we make the xxhash API private, by declaring the static
so that any unused function is not included anymore in the binary
and only the used one are present.
2019-12-07 20:52:34 -05:00
Stefano Bonicatti
e7cef1a906 Prepare CMake and Python framework for Python tests
test_base.py received several fixes and now supports and requires
a custom folder where to find the config files that the tests need.
It has been also updated to use Python 3.

Fixed the gen_api function in genapi.py missing the path to the spec
file when evaluating blacklisted tables.

Co-Authored-By: SS <sahil.suneja@trailofbits.com>
2019-12-07 20:51:09 -05:00
Stefano Bonicatti
8e6fefb47a CMake: explicitly enable ASM_MASM language on Windows (#6065)
This is needed by some third party libraries and
when using Ninja on Windows.
CMake complains that it cannot find the internal variable
for CMAKE_ASM_MASM_COMPILE_OBJECT if it's not active for the whole
project.
2019-11-23 00:14:56 -05:00
Stefano Bonicatti
5315d4be8e CMake: Workaround Thrift symlink issue on Windows (#6060)
CMake doesn't support reading and therefore copying Windows symlinks.
A recent update to Thrift creates a symlink in its tutorial folder,
which makes the copy after patch process fail.
As a workaround we avoid copying the tutorial folder,
since we don't care about it anyway.
2019-11-19 12:52:23 -05:00
Daniel Zabari
0fa5751c60 added warning and turned off shallow for git version less than 2.14 (#6055)
added warning and turned off shallow for git version less than 2.14
2019-11-19 11:24:47 -05:00
Ted Reed
59dc17266b libraries: Add rocksdb to source_migration 2019-11-15 15:19:48 -05:00
Ted Reed
0dccb51087 libraries: Add ROCKSDB_LITE to public definitions 2019-11-15 15:19:48 -05:00
Ted Reed
c61c56f159 libraries: Reduce rocksdb sources
Several source files are not exporting any symbols.
2019-11-15 15:19:48 -05:00
Alessandro Gario
2e2e9032b8
Update SQLite from version 3.29.0-3 to 3.30.1-1 (#6020) 2019-11-12 18:33:01 +01:00
Ted Reed
76720bea2f libraries: Add thrift to source_migration
This commit adds scope_exit and typeof boost subprojects.
These are dependencies of Window's thrift library.
2019-11-12 08:15:53 -05:00
Teddy Reed
6486e6800e libraries: Add boost and icu to source_migration 2019-11-12 08:15:53 -05:00
Stefano Bonicatti
e571f1aa5a Don't always link to all AWS libraries (#6032)
While in the end the osqueryd binary will require almost all libraries
built and linked, having each intermediate library depend on the whole
set of AWS libraries might result in higher compiling time.
Especially since on some platforms not all libraries are used.

This should speed up the compilation speed on Windows.
2019-11-11 09:52:21 -05:00
Ted Reed
0d4372ed48 libraries: Add lzma and libxml2 to source_migration 2019-11-11 08:35:33 -05:00
Teddy Reed
5c2ecd2047 libraries: Add googletest to source_migration 2019-11-11 08:35:33 -05:00
Teddy Reed
15a2071eaa libraries: Add zstd to source_migration 2019-11-11 08:35:33 -05:00
Teddy Reed
40314421f5 libraries: Add bzip2 to source_migration 2019-11-11 08:35:33 -05:00
Teddy Reed
5b411d7a74 libraries: Add zlib to source_migration 2019-11-11 08:35:33 -05:00
Teddy Reed
58ea43f536
libraries: Add libmagic to source_migration (#6023) 2019-11-09 13:49:33 -05:00
Zachary Wasserman
3ece9e9ef7 Migrate glog and gflags to source build on macOS and Windows (#5902)
Note that glog and gflags must be migrated at the same time, otherwise
linker errors are generated on macOS.
2019-11-08 23:06:09 -05:00
Stefano Bonicatti
b857409cad Fix build with Ninja on Windows (#6007) 2019-11-06 19:07:04 -05:00
Alessandro Gario
7fee358178 CMake: Update the OpenSSL formula (#5976) 2019-11-01 21:25:14 -04:00
Zachary Wasserman
7e18771f16 Migrate glibc from "facebook" dependencies (#5900) 2019-10-31 19:08:09 -04:00
Stefano Bonicatti
d2e976168d
Restore correct commit of the RapidJSON submodule (#5961) 2019-10-29 02:15:42 +01:00
Nick Anderson
b9bdcf40ce
tests: enabling certificates table sanity checks (#5914) 2019-10-27 20:45:14 -07:00
Alessandro Gario
41fb4efba1
CMake: Migrate macOS and Windows to the OpenSSL formula (#5928) 2019-10-26 14:03:31 +02:00
Teddy Reed
43357d43a3
libraries: Update RapidJSON to master 1a825d24 (#5913) 2019-10-21 22:41:49 -04:00
Zachary Wasserman
0bf2245396 Migrate rapidjson to source build on macOS and Windows (#5899) 2019-10-18 20:05:22 -04:00
kumarak
9346926030 Restore extension SDK support to osquery 4.x (#5851)
CMake utility functions(generateOsqueryExtensionGroup,addOsqueryExtensioni{Ex},
addOsqueryModule) to add extensions.

Updates the boost library submodules needed for extensions build.

Use cache variable(OSQUERY_EXTENSION_GROUP_NAME) for the grouping of extensions
and fix the linkage with osquery interface library.
2019-10-18 18:45:20 -04:00
Stefano Bonicatti
3ad7f65a0d Support source and build directory to be on different filesystems (#5907)
Instead of moving a patched submodule from source to build directory,
we copy it and then hard reset the submodule to its original HEAD.

Minor message change when a library fails to be imported.
2019-10-18 18:25:05 -04:00
Zachary Wasserman
30a7507c95
Fix shallow clone support for libraries in recent git versions (#5897)
Enables the v2 protocol which allows the repositories to be shallow
cloned without error.
2019-10-17 21:19:24 -07:00
Zachary Wasserman
c0876408fc Migrate AWS SDK CPP dependency to source build on macOS and Windows (#5889) 2019-10-16 16:20:22 -04:00
Stefano Bonicatti
7d1d486c1e Fix git command not found after first configure (#5880)
During the first configuration, the git command is searched
when submodules are initialized and it's then saved into a cache variable.
If though we delete the build folder and run configure again,
the submodules won't be initialized again, so the git command
won't be cached and visible to CMake.
Therefore we need to search for it each time.

Cleanup dead/deprecated code.
2019-10-11 23:31:31 +02:00
Alessandro Gario
225bbaf992
Integrate cppcheck and clang-tidy within the CMake project (#5730) 2019-10-08 18:17:11 +02:00
adhamehab
657932cd2c Upgrade Python tools to Python3 (#5846) 2019-10-05 10:30:10 -04:00
Stefano Bonicatti
457150c94c CMake: Improve submodule patching system (#5850)
Keep patched source in the build directory instead of the source.

A new variable with the format OSQUERY_<submodule name>_ROOT_DIR
is set to the directory of where the submodule is, in case it's patched.

A new option PATCH has been added to importSourceModule
to let the patching system know that the submodule has to be patched
and which is the main submodule folder.
2019-10-01 17:47:10 -04:00
Zachary Wasserman
5cec1f4331
Upgrade SQLite to 3.29.0 on macOS and Windows (#5810)
Mitigates recent CVEs in SQLite. It was already this version on Linux.

Establish a pattern for migrating source dependency builds to macOS and Windows.
2019-09-18 15:49:27 -07:00
Alessandro Gario
b3a9342783
CMake: The AWS library was not correctly enabling OpenSSL support (#5799) 2019-09-12 20:01:46 +02:00
Stefano Bonicatti
66601db099 Fix OpenSSL build when no system ar is installed (#5782)
OpenSSL should use the ar binary provided by the custom toolchain.
Also updated the docker image to avoid installing binutils and hiding the
issue.
2019-09-09 19:19:20 -04:00
Teddy Reed
be28d9c8de
libraries: Add patch to thrift to ignore EINTR (#5776) 2019-09-08 17:41:26 -04:00
Stefano Bonicatti
0b2cd791d3 Linux custom toolchain integration (#5759)
- Always link to libc++abi.a, dl and rt.
- Add OSQUERY_TOOLCHAIN_SYSROOT option which should contain
  the path to the sysroot where the portable compiler and its libraries are in.
- Fix OpenSSL build with custom toolchain.
- Always include the custom toolchain cmake.
  Unfortunately system name detection is done when project() is called
  which is also when compiler detection is done, and we need the compiler
  to be set before that, so we always include the cmake file.
- Do not use getrandom syscall in Boost, for glibc < 2.25 support.
- Remove usage of secure_getenv and getauxval in librpm.
- Update CI to use the toolchain.
- Reflect changes in the docs.
2019-09-06 19:51:25 -04:00
Stefano Bonicatti
f6ed617394
Uniform and update CMake version to 3.14.6 (#5756)
The new version contains a fix for the FindBison module.
The docs have been updated too.
2019-09-06 22:12:13 +02:00
Alessandro Gario
6481b34e23
Refactor third-party libraries to build from source on Linux (#5706)
Add a way to compile third-party libraries from source instead of downloading prebuilt ones.
Each library source code is downloaded with git into a submodule at configure time,
in response to the find_package(library_name) CMake call,
except for OpenSSL where the official source archive is used.
Each submodule is attached to a release tag on its own upstream repository.
All the libraries are built using CMake directly, except for OpenSSL which uses a formula system,
which permits to build libraries with a separate build system
when there's no easy way to integrate it directly with CMake.

This new dependency system determines which library is fetched from where using the concept of "layers".
Currently we have three of them: source, formula, facebook,
where the last layer represents the pre-built libraries.
The provided order will be used when looking for libraries.

A system to patch submodule source code has been added and it's currently used with googletest, libudev and util-linux.
Patches should be put under libraries/cmake/source/<library name>/patches/<submodule>,
where <submodule> is often one and is "src", but in other cases, like AWS,
there are multiple with a more specific name.
If for whatever reason the submodule cloning or the patching fails,
the submodule has to be unregistered and its folder should be cleared.
This should be achievable with "git submodule deinit -f <submodule path>"

Following some other changes on existing functionality:

- Changed the CMake variable BUILD_TESTING to OSQUERY_BUILD_TESTS
  to avoid enabling tests on third party libraries.
  Due to an issue with glog the BUILD_TESTING variable
  will be always forced to OFF.
- Moved compiler and linker flags to their own file cmake/flags.cmake
- Moved all the third-party CMakeLists.txt used for pre-built libraries under libraries/cmake/facebook
- Added the --exclude-folders option to tools/format-check.py and tools/git-clang-format.py,
  so that it's possible to ignore any third party library source code.
- The format and format_check target use the new --exclude-folders option
  to exclude libraries/cmake/source from formatting.
- The test and osquery binaries are properly compiled with PIE (osquery/osquery#5611)

Co-authored-by: Stefano Bonicatti <stefano.bonicatti@gmail.com>
Co-authored-by: Teddy Reed <teddy@casualhacking.io>
2019-08-30 16:25:19 +02:00