forked from syslog-ng/syslog-ng.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hofi <hofione@gmail.com>
- Loading branch information
Showing
3 changed files
with
322 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,309 @@ | ||
--- | ||
title: Building on FreeBSD | ||
short_title: FreeBSD | ||
description: >- | ||
We hope our product can be useful for FreeBSD users as well who want to increase the security of their system through reliable logging. | ||
id: dev-platform-build-freebsd | ||
--- | ||
|
||
## Introduction | ||
|
||
At present we are not supporting FreeBSD {{ site.product.short_name }} on our [[official repository|gh-syslog-ng]] on GitHub. However, you can compile {{ site.product.short_name }} yourself following this guide. | ||
|
||
**Note:** The guide is tested on X86_64/amd64 FreeBSD 14 and 13, we do our bests to keep it update, but your actual system may require additional steps or slightly different settings. | ||
{: .notice} | ||
|
||
## Compiling from source | ||
|
||
Like every project {{ site.product.short_name }} also uses different libraries and build-systems (a.k.a dependencies) that must be installed for compiling and running properly. | ||
|
||
### Dependencies | ||
|
||
The above mentioned dependencies can be satisfied by compiling every-each libs and tools manually, but it might be preferred to do it the easy way. We used the official FreeBSD Ports to install the dependencies. | ||
|
||
#### Using FreeBSD Ports | ||
|
||
1. Perform FreeBSD Ports update if you have not done it yet. | ||
1. The following packages should be installed for {{ site.product.short_name }}ng | ||
* autoconf | ||
* autoconf-archive | ||
* automake | ||
* bison | ||
* cmake | ||
* flex | ||
* gperf | ||
* glib | ||
* ivykis - See [bellow](#packages-note)! | ||
* json-c | ||
* libtool | ||
* pcre2 | ||
* pkg-config | ||
1. The extra modules would require the following | ||
* gradle | ||
* grpc - See [bellow](#packages-note)! | ||
* hiredis | ||
* libdbi | ||
* libdbi-drivers | ||
* ~~libesmtp~~ - See [bellow](#packages-note)! | ||
* libmaxminddb | ||
* libnet | ||
* libpaho-mqtt3 | ||
* librdkafka | ||
* mongo-c-driver | ||
* net-snmp | ||
* python3 | ||
* rabbitmq-c | ||
* riemann-c-client | ||
1. Extra development tools you might require | ||
* criterion | ||
* gcc14 - See [bellow](#packages-note)! | ||
|
||
**Hint:** If you have [[{{ site.product.short_name }} installed already via FreeBSD Ports, as a reference, you can check the dependencies of the installed version using `brew deps syslog-ng` | ||
{: .notice--info} | ||
|
||
This is how it might look like if you start from the ground: | ||
|
||
```shell | ||
|
||
sudo pkg update | ||
sudo pkg upgrade | ||
|
||
sudo pkg install \ | ||
autoconf \ | ||
autoconf-archive \ | ||
automake \ | ||
bison \ | ||
# Optional, a better replacement of autotools making system | ||
cmake \ | ||
flex \ | ||
glib \ | ||
# Optional, if you use the internal ivykis source of {{ site.product.short_name }} for building | ||
ivykis \ | ||
json-c \ | ||
libtool \ | ||
pcre2 \ | ||
pkg-config \ | ||
# Optional {{ site.product.short_name }} module dependencies | ||
gradle \ | ||
grpc \ | ||
hiredis \ | ||
libdbi | ||
# FreeBSD Ports does not have this lib yet | ||
# libesmtp | ||
libmaxminddb \ | ||
libnet \ | ||
libpaho-mqtt3 \ | ||
librdkafka \ | ||
mongo-c-driver \ | ||
net-snmp \ | ||
python3 \ | ||
rabbitmq-c \ | ||
riemann-c-client \ | ||
# Optional, needed for unit testing | ||
criterion \ | ||
# Optional, clang now should compile all modules nicely and it is the oficially supported compiler on macOS | ||
gcc14 | ||
``` | ||
|
||
<div id="packages-note"></div> | ||
> **Note:** | ||
> | ||
> * libesmtp - FreeBSD Ports does not have libesmtp package support yet, but you can build it yourself from source or use the MacPorts version | ||
> * gcc - see at [compiler selection](#select-the-compiler) | ||
> * grpc - | ||
> * actual state of supported features, and the required dependencies can also be found [[here|dev-macos-mod-sup-status]]. | ||
{: .notice} | ||
|
||
### Preparations | ||
|
||
In general there is no need to setup a custom environment on FreeBSD, but just for sure you can add the following modifications to force the building process to use the FreeBSD Ports installed packages. | ||
|
||
```shell | ||
export BSDPORTS_PREFIX=/usr/local | ||
|
||
export BSDPORTS_REPOSITORY=${BSDPORTS_PREFIX} | ||
export MANPATH=${BSDPORTS_PREFIX}/share/man:$MANPATH | ||
export INFOPATH=${BSDPORTS_PREFIX}/share/info:$INFOPATH | ||
``` | ||
|
||
```shell | ||
export PATH=${BSDPORTS_PREFIX}/bin:${BSDPORTS_PREFIX}/sbin:${PATH} | ||
``` | ||
|
||
```shell | ||
PKGCONF_PATH=$(pkgconf --variable pc_path pkgconf) | ||
export PKG_CONFIG_PATH=${PKGCONF_PATH}:$PKG_CONFIG_PATH | ||
``` | ||
|
||
```shell | ||
export CFLAGS="-I${BSDPORTS_PREFIX}/include/ ${CFLAGS}" | ||
export CXXFLAGS="${CFLAGS} ${CXXFLAGS}" | ||
export LDFLAGS="-L${BSDPORTS_PREFIX}/lib ${LDFLAGS}" | ||
``` | ||
|
||
**Note:** It could also happen that you must provide here further library inlcude and lib paths | ||
{: .notice} | ||
|
||
### Getting the source | ||
|
||
To get the latest master from {{ site.product.short_name }} git you can use | ||
|
||
```shell | ||
cd YOUR_PREFERRED_WORKING_DIR # Replace `YOUR_PREFERRED_WORKING_DIR` with your actual preferred working dir | ||
git clone https://github.com/syslog-ng/syslog-ng . | ||
``` | ||
|
||
### Select the compiler | ||
|
||
Latest version of {{ site.product.short_name }} [has dropped support of gcc](https://github.com/syslog-ng/syslog-ng/pull/4897), so now the platform default llvm/clang must be used to complie the source.\ | ||
`gcc` still might compile {{ site.product.short_name }} and most of its modules, but there is no guarantie and support of it anymore (HINT: you can turn off any problematic module via its feature switch) | ||
|
||
To make sure clang is used you can use (optional): | ||
|
||
```shell | ||
export CC=clang | ||
export CXX=clang++ | ||
``` | ||
|
||
For gcc (optional): | ||
|
||
```shell | ||
export CC=gcc # More precisly, the full path of ypur installed gcc compiler | ||
export CXX=g++ # More precisly, the full path of ypur installed g++ compiler | ||
``` | ||
|
||
### Configuration | ||
|
||
> **Note:** | ||
> | ||
> * for various reasons not all modules can always be configured, built and used on all macOS versions and architectures | ||
> * for using all the available modules you might have to install further dependencies as mentioned above | ||
{: .notice} | ||
|
||
For more details please see the [[actual state of supported features|dev-macos-mod-sup-status]], and the required [dependencies](#dependencies). | ||
|
||
#### Using cmake | ||
|
||
If you have all the above mentioned dependencies installed, for the full (currently supported) feature set you can simply use | ||
|
||
```shell | ||
cmake --install-prefix /full_path_of_your/installdir -B build . -Wno-dev -DIVYKIS_SOURCE=system --fresh | ||
``` | ||
|
||
At the end of the configure step you should see the module list will be used during the compilation and installation steps, it should look like this | ||
|
||
```shell | ||
----------------------------------- | ||
syslog-ng Open Source Edition 4.8.0.148.g71a2e4c.dirty configured | ||
----------------------------------- | ||
BUILD_TESTING On | ||
CMAKE_BUILD_TYPE Release | ||
CMAKE_CXX_COMPILER clang++ [] - /Applications/Development/Xcode/15.4/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ | ||
CMAKE_C_COMPILER clang [Apple clang version 15.0.0 (clang-1500.3.9.4)] - /Applications/Development/Xcode/15.4/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang | ||
CMAKE_OBJC_COMPILER clang [Apple clang version 15.0.0 (clang-1500.3.9.4)] - /usr/bin/clang | ||
FORCE_CLASSIC_LINKING Off | ||
----------------------------------- | ||
ENABLE_AFAMQP On | ||
ENABLE_AFSMTP On | ||
ENABLE_AFSNMP On | ||
ENABLE_AFUSER On | ||
ENABLE_APPMODEL On | ||
ENABLE_AZURE_AUTH_HEADER On | ||
ENABLE_CLOUD_AUTH On | ||
ENABLE_CLOUD_AUTH_CURL On | ||
ENABLE_CPP On | ||
ENABLE_CURL On | ||
ENABLE_DARWIN_OSL On | ||
ENABLE_EBPF Off | ||
ENABLE_EXAMPLE_MODULES On | ||
ENABLE_EXTRA_WARNINGS On | ||
ENABLE_GEOIP2 On | ||
ENABLE_GETENT On | ||
ENABLE_GRPC On | ||
ENABLE_HOOK_COMMANDS On | ||
ENABLE_IPV6 On | ||
ENABLE_JAVA Off | ||
ENABLE_JAVA_MODULES Off | ||
ENABLE_JOURNALD Off | ||
ENABLE_JSON On | ||
ENABLE_KAFKA On | ||
ENABLE_MAP_VALUE_PAIRS On | ||
ENABLE_MONGODB On | ||
ENABLE_MQTT On | ||
ENABLE_NATIVE On | ||
ENABLE_OBJC On | ||
ENABLE_OPENBSD_SYS_DRIVER Off | ||
ENABLE_PACCT Off | ||
ENABLE_PYTHON On | ||
ENABLE_PYTHON_MODULES On | ||
ENABLE_REDIS On | ||
ENABLE_RIEMANN On | ||
ENABLE_SQL On | ||
ENABLE_STARDATE On | ||
ENABLE_STOMP On | ||
ENABLE_SUN_STREAMS Off | ||
ENABLE_XML On | ||
----------------------------------- | ||
``` | ||
|
||
The modules have the `ENABLE_XXX On` status in the list will be compiled and installed. As you installed the required dependencies earlier there is no need to specify the modules you want to enable, the configuretion step will auto enable the modules that have all the dependencies, Of course, you can disable a given module directly if you do not need it (e.g. `-DENABLE_KAFKA=OFF` will disable the kafka modules). | ||
|
||
For trying force enable a given module you can use e.g. `-DENABLE_KAFKA=OFF` that will always try to search for all the module dependencies and stop the configuration if any of it is missing. | ||
This command will try to force enable all the supported macOS modules (that can be used to validate if your dependecy list was installed correctly) | ||
|
||
```shell | ||
cmake --install-prefix /full_path_of_your/installdir -B build . -Wno-dev -DIVYKIS_SOURCE=system --fresh -DENABLE_GETENT=ON -DENABLE_HOOK_COMMANDS=ON -DENABLE_IPV6=ON -DENABLE_MAP_VALUE_PAIRS=ON -DENABLE_NATIVE=ON -DENABLE_STARDATE=ON -DENABLE_STOMP=ON -DENABLE_XML=ON -DENABLE_AFAMQP=ON -DENABLE_AFSMTP=ON -DENABLE_AFSNMP=ON -DENABLE_AFUSER=ON -DENABLE_APPMODEL=ON -DENABLE_AZURE_AUTH_HEADER=ON -DENABLE_CLOUD_AUTH==ON -DENABLE_CLOUD_AUTH_CURL=ON -DENABLE_CPP=ON -DENABLE_CURL=ON -DENABLE_DARWIN_OSL=ON -DENABLE_EXAMPLE_MODULES=ON -DENABLE_GEOIP2=ON -DENABLE_GRPC=ON -DENABLE_JAVA=ON -DENABLE_JAVA_MODULES=ON -DENABLE_JSON=ON -DENABLE_KAFKA=ON -DENABLE_MONGODB=ON -DENABLE_MQTT=ON -DENABLE_PYTHON=ON -DENABLE_PYTHON_MODULES=ON -DENABLE_REDIS=ON -DENABLE_RIEMANN=ON -DENABLE_SQL=ON | ||
``` | ||
|
||
<!--- | ||
TODO: once the ENABLE_ALL_MODULES implemented for cmake as well add an example of the usage of it with these required module disablings | ||
-DENABLE_ALL_MODULES=ON -DENABLE_EBPF=OFF -DENABLE_JOURNALD=OFF -DENABLE_OPENBSD_SYS_DRIVER=OFF -DENABLE_SUN_STREAMS=OFF -DENABLE_PACCT=OFF | ||
---> | ||
|
||
### Compile and install | ||
|
||
```shell | ||
# autotools | ||
|
||
# add AM_DEFAULT_VERBOSITY=1 before -j4 option for detailed compilation logging | ||
make -j4 | ||
make install | ||
|
||
# or, in a single line | ||
# make -j4 install | ||
``` | ||
|
||
```shell | ||
#cmake | ||
|
||
# add -v as well for detailed compilation logging | ||
cmake --build build/. --target install -j4 | ||
``` | ||
|
||
### Testing | ||
|
||
In order to run the tests, you have to install first the Criterion testing framework (e.g: `sudo pkg install criterion`), and re-[configure](#configuration) the build with testing enabled (`--enable-tests` or `-DBUILD_TESTING=ON`). After that use the command below: | ||
|
||
```shell | ||
# autotools | ||
|
||
make check -j4 | ||
``` | ||
|
||
```shell | ||
# cmake | ||
|
||
cmake --build build/. --target check -j4 | ||
``` | ||
|
||
**Note:** For more read [[testing|dev-testing]] guide. | ||
{: .notice} | ||
|
||
### Run | ||
|
||
```markdown | ||
`/full_path_of_your/installdir`/syslog-ng -F | ||
``` | ||
|
||
**Note:** For more information read the [[run first|dev-run-first]] guide and the {{ site.product.short_name }} [[documentation|adm-guide]] | ||
{: .notice} |