Update steps to install prerequisites on all platforms

- Remove Python 2 as a prerequisite

- Add missing instructions when install Git for Windows

- Correct and move the paragraph about symbolic links permission earlier.
  The "Enable symbolic link" check available during the Git for Windows
  installing procedure doesn't enable the policy, but instead asks git
  to create real symlinks when cloning, which is still something
  we want.
This commit is contained in:
Stefano Bonicatti 2019-11-28 01:22:10 +01:00 committed by Alessandro Gario
parent 706874c3d3
commit a30c67da30

View File

@ -6,7 +6,7 @@ The supported compilers are: the osquery toolchain (LLVM/Clang 8.0.1) on Linux,
# Building with CMake
Git (>= 2.14.0), CMake (>= 3.14.6), Python 2, and Python 3 are required to build. The rest of the dependencies are downloaded by CMake.
Git (>= 2.14.0), CMake (>= 3.14.6), Python 3 are required to build. The rest of the dependencies are downloaded by CMake.
The default build type is `RelWithDebInfo` (optimizations active + debug symbols) and can be changed in the CMake configure phase by setting the `CMAKE_BUILD_TYPE` flag to `Release` or `Debug`.
@ -22,7 +22,7 @@ The root folder is assumed to be `/home/<user>`.
```bash
# Install the prerequisites
sudo apt install --no-install-recommends git python python3 bison flex make
sudo apt install --no-install-recommends git python3 bison flex make
# Download and install the osquery toolchain
wget https://github.com/osquery/osquery-toolchain/releases/download/1.0.0/osquery-toolchain-1.0.0.tar.xz
@ -54,7 +54,7 @@ Please ensure [Homebrew](https://brew.sh/) has been installed, first. Then do th
```bash
# Install prerequisites
xcode-select --install
brew install git cmake python@2 python
brew install git cmake python
```
**Step 2: Download and build**
@ -88,13 +88,14 @@ Note: It may be easier to install these prerequisites using [Chocolatey](https:/
- Visual Studio 2019 (2 options)
1. [Visual Studio 2019 Build Tools Installer](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16) (without Visual Studio): In the installer choose the "C++ build tools" workload, then on the right, under "Optional", select "MSVC v141 - VS 2017 C++", "MSVC v142 - VS 2017 C++", and "Windows 10 SDK".
2. [Visual Studio 2019 Community Installer](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16): In the installer choose the "Desktop development with C++" workload, then on the right, under "Optional", select "MSVC v141 - VS 2017 C++", "MSVC v142 - VS 2017 C++", and "Windows 10 SDK".
- [Git for Windows](https://github.com/git-for-windows/git/releases/latest) (or equivalent)
- [Python 2](https://www.python.org/downloads/windows/), specifically the 64-bit version.
- [Git for Windows](https://github.com/git-for-windows/git/releases/latest): Select "checkout as-is, commit as-is". Later check "Enable symbolic links" support.
- [Python 3](https://www.python.org/downloads/windows/), specifically the 64-bit version.
- [Wix Toolset](https://wixtoolset.org/releases/)
- [Strawberry Perl](http://strawberryperl.com/) for the OpenSSL formula. It is recommended to install it to the default destination path.
- [7-Zip](https://www.7-zip.org/) if building the Chocolatey package.
The use of an Administrator shell is recommended because the build process creates symbolic links. These [require a special permission to create on Windows](https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links), and the simplest solution is to build as Administrator. If you wish, you can instead assign just the `SeCreateSymbolicLinkPrivilege` permission to the user account. The setting can be found in "Local Security Policy" under Security Settings, Local Policies, User Rights Assignment. The user then has to log out and back in for the policy change to apply.
**Step 2: Download and build**
```PowerShell
@ -111,8 +112,6 @@ cmake -G "Visual Studio 16 2019" -A x64 -T v141 ..
cmake --build . --config RelWithDebInfo -j10 # Number of projects to build in parallel
```
The use of an Administrator shell is recommended because the build process creates symbolic links. These [require a special permission to create on Windows](https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links), and the simplest solution is to build as Administrator. If you wish, you can instead assign just the `SeCreateSymbolicLinkPrivilege` permission to the user account. The setting can be found in "Local Security Policy" under Security Settings, Local Policies, User Rights Assignment. There is also an opportunity while installing Git for Windows from the official installer (unselected by default) to enable this permission for a specific user, who then has to log out and back in for the policy change to apply.
## Testing
To build with tests active, add `-DOSQUERY_BUILD_TESTS=ON` to the osquery configure phase, then build the project. CTest will be used to run the tests and give a report.