FreeBSD Install Issue

137 views
Skip to first unread message

Dave Stoddard

unread,
Oct 14, 2016, 10:53:47 PM10/14/16
to Wazuh mailing list
I just pulled down the latest WAZUH sources and compiled them on a fresh install of FreeBSD 10.3.  The installation was done as an OSSEC server. When the install script got to compile the file src/remoted/secure.c, it failed due to a missing <sys/epoll.h> (which is a Linux include file that is not found on FreeBSD).

The code is setup so that if __MACH__ is not defined, the system is assumed to be Linux and the sys/epoll.h code is used. Unfortunately, FreeBSD does not define the __MACH__ macro either, which is why the compiler error happens. However, FreeBSD does define __FreeBSD__ as a macro that is available at all times. This allowed me to get around the compile time error by adding the following code to the top of the program (just after the comment block):

#ifdef __FreeBSD__
#define __MACH__ 1
#endif

With this change, when src/remoted/secure.c is compiled, the __MACH__ macro gets defined properly on FreeBSD systems and the compiler error that was triggered by the missing <sys/epoll.h> header no longer occurs. You might want to add this small change to the code base.  Thank you.  Best,

Dave Stoddard
Network Alarm Corporation

Dave Stoddard

unread,
Oct 14, 2016, 11:34:39 PM10/14/16
to Wazuh mailing list
I remembered one more thing I needed to change to get the system to build correctly on FreeBSD. If you use GeoIP (by enabling it in src/Makefile), and you install the correct GeoIP port (cd /usr/ports/net/GeoIP ; make install), the Makefile must be modified to add /usr/local/include to the CFLAGS macro, and /usr/local/lib to the OSSEC_LDFLAGS macro.  This is a simple two line change to the Makefile to support FreeBSD systems. Around line 77 in the src/Makefile you will see the definitions broken out for FreeBSD -- simply modify that section to look like this:

ifeq (${uname_S},FreeBSD)
                DEFINES+=-DFreeBSD
                OSSEC_LDFLAGS+=-pthread
                LUA_PLAT=freebsd
                CFLAGS+=-I/usr/local/include
                OSSEC_LDFLAGS+=-L/usr/local/lib
else

GeoIP will find all of its libraries and the install.sh script will run to the end without issues.  Best,

Dave Stoddard
Network Alarm Corporation

Victor Fernandez

unread,
Oct 17, 2016, 8:14:39 AM10/17/16
to Wazuh mailing list
Hello Dave,

thank you very much for your posts, they will add much value to rout project. Both changes have been committed into our Master branch, with mention to you.

Kind regards,
Víctor.
Reply all
Reply to author
Forward
0 new messages