[Bro-Dev] Building bro 2.6 with static broker/caf libraries
Philippe Antoine
p.antoine at catenacyber.fr
Thu Dec 6 11:15:06 PST 2018
In case it is helpful, here is the script I used to build all static bro (without any shared libraries)
```
cd bro
mkdir buildcaf
cd buildcaf
cmake -DCAF_NO_UNIT_TESTS=1 -DCAF_NO_EXAMPLES=1 -DCAF_BUILD_STATIC_ONLY=1 ../aux/broker/3rdparty/caf/
make
make install || true
cd ..
mkdir build
cd build
cmake -DDISABLE_PYTHON_BINDINGS=1 -DENABLE_STATIC_ONLY=1 -DCAF_ROOT_DIR=../buildcaf ..
make
make install
```
It needed also a small patch to bro, which comes afterwards
```
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 452f2834c..c8039f8da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -268,7 +268,11 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake DESTINATION share/bro
## Recurse on sub-directories
add_subdirectory(aux/broker)
-set(brodeps ${brodeps} broker)
+if (ENABLE_STATIC_ONLY)
+ set(brodeps ${brodeps} broker_static)
+else ()
+ set(brodeps ${brodeps} broker)
+endif ()
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/aux/broker
${CMAKE_CURRENT_BINARY_DIR}/aux/broker)
include_directories(BEFORE ${CAF_INCLUDE_DIR_CORE})
```
> Le 6 déc. 2018 à 19:25, Johanna Amann <johanna at icir.org> a écrit :
>
> Hi Craig,
>
> I pushed another commit to the branch that passes --build-static-only through
> to CAF; if you just want the patch for that it is available at
> https://github.com/zeek/broker/commit/bf03a4246113c72d10530cc0c2729a3fa6f0b046.
>
> (Note that repositories are currently being migrated; if you pull it from
> somewhere make sure that you actually have that commit in the branch)
>
> Johanna
>
> On Thu, Dec 06, 2018 at 07:01:25AM -0800, Johanna Amann wrote:
>> Hi Craig,
>>
>> I actually recently started working on this, however I am did not quite
>> look at what you want.
>>
>> There already is a branch called topic/johanna/static, which now makes
>> --build-static(-only) work for broker whan CAF is built statically - it
>> does not yet pass the static flags through to broker; I actually wanted to
>> take a look at that today.
>>
>> I will let you know when I make progress there :)
>>
>> Johanna
>>
>> On Wed, Dec 05, 2018 at 07:03:06PM -0800, Craig Leres wrote:
>>> I've read up on cmake variable scope but I can't figure out how to build
>>> bro with static libraries. The bro-bundled caf already has
>>> CAF_BUILD_STATIC_ONLY which I'm pretty sure works but I'm unable to turn
>>> it on when building caf as part of a bro build.
>>>
>>> For example I'd like is to optionally (i.e. from a -D argument to cmake
>>> itself) be able to turn on CAF_BUILD_STATIC_ONLY for
>>> aux/broker/3rdparty/caf/CMakeLists.txt but nothing I've tried in the top
>>> level CMakeLists.txt is seen when the caf CMakeLists.txt is being evaluated.
>>>
>>> (I'm working on updating the FreeBSD port to 2.6 and can't install
>>> things like libcaf_io.so in /usr/local/lib because they conflict with
>>> libraries potentially installed by the devel/caf port.)
>>>
>>> Craig
>>> _______________________________________________
>>> bro-dev mailing list
>>> bro-dev at bro.org
>>> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
>>>
>> _______________________________________________
>> bro-dev mailing list
>> bro-dev at bro.org
>> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
>>
> _______________________________________________
> bro-dev mailing list
> bro-dev at bro.org
> http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.icsi.berkeley.edu/pipermail/bro-dev/attachments/20181206/60e57617/attachment-0001.html
More information about the bro-dev
mailing list