OSSEC 2.8 build on Solaris 10 (Sparc) - "./Makeall all" fails

1,130 views
Skip to first unread message

stephen.bryant2

unread,
Jul 28, 2014, 9:39:25 AM7/28/14
to ossec...@googlegroups.com
OSSEC 2.7.1 agent built fine on Solaris 10, but when I tried OSSEC 2.8 I got the following:
 - Running the Makefile
./Makeall: test: argument expected
*** Error code 1
The following command caused the error:
/bin/sh ./Makeall all
make: Fatal error: Command failed for target `all'
 Error 0x5.
 Building error. Unable to finish the installation.

Running Makeall in debug I got the following:
# sh -x Makeall all
 [ . . . ]
+ [ -e /usr/include/openssl/opensslconf.h ]
Makeall: test: argument expected
 
According to the man pages for "test", The "-a" and "-e" flags are not availabel in Solaris "sh", which is why there are tests such as the following:
    ls ./Config.OS >/dev/null 2>&1
    if [ ! $? = 0 ]; then
        echo "" > Config.OS
    fi
 
As a work-around, I edited ossec-2.8/src/Makefile and replaced all  instances of "/bin/sh" with "/usr/xpg4/bin/sh" which can cope with all flages for "test".
 
In ossec-2.7.1/srce/Makeall, the corresponding test for OpenSSL is as follows, which works on Solaris 10:
    # Checking for OpenSSLconf.h
    ls /usr/include/openssl/opensslconf.h > /dev/null 2>&1
    if [ $? = 0 ]; then
        echo "DEXTRA=-DUSE_OPENSSL" >> Config.OS
        echo "OPENSSLCMD=-lssl -lcrypto" >> Config.OS
    fi
 
Apart from the change testing for OpenSSL, the new test for "libmagic" in OSSEC 2.8 will also trip up Solars 10 builds...

awidde...@hotmail.com

unread,
Jul 30, 2014, 11:52:42 AM7/30/14
to ossec...@googlegroups.com
Thanks for the detailed information. This is helpful. I don't think many of the contributors really have access to Solaris machines to do a whole lot of testing so things like this often get missed. Would you mind posting this as an issue on github? That way it can get addressed as someone has time. Even better would be submitting a pull request to fix issues.

didscodan

unread,
Aug 7, 2014, 5:21:51 PM8/7/14
to ossec...@googlegroups.com
Hello,
We just applied this fix to our Solaris 10 box and it still fails after replacing all /bin/sh with /bin/xpg4/bin/sh in the Makefile...  here is the output:

5- Installing the system
 - Running the Makefile

 *** Making zlib (by Jean-loup Gailly and Mark Adler)  ***
cd zlib-1.2.8/; ./configure; make libz.a;
Checking for gcc...
Checking for shared library support...
Building shared library libz.so.1.2.8 with gcc.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... No.
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  adler32.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  crc32.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  deflate.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  infback.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  inffast.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  inflate.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  inftrees.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  trees.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  zutil.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  compress.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  uncompr.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  gzclose.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  gzlib.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  gzread.c
gcc -O3  -D_LARGEFILE64_SOURCE=1  -c  gzwrite.c
ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
cp -pr zlib-1.2.8/libz.a .
cp -pr zlib-1.2.8/zlib.h zlib-1.2.8/zconf.h ../headers/


 *** Making cJSON (by Dave Gamble)  ***
cc -g -Wall -I../../ -I../../headers  -DDEFAULTDIR=\"/var/ossec\" -DCLIENT  -DSOLARIS -DHIGHFIRST      -DARGV0=\"cJSON\" -DOSSECHIDS -c cJSON.c
/usr/ucb/cc:  language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target `libcJSON.a'
Current working directory /tmp/ossec-hids-2.8/src/external/cJSON

Error Making cJSON

*** Error code 1
The following command caused the error:
/usr/xpg4/bin/sh ./Makeall all

make: Fatal error: Command failed for target `all'

 Error 0x5.
 Building error. Unable to finish the installation.



Thanks for any help or insight you can provide.

stephen.bryant2

unread,
Aug 8, 2014, 3:36:35 AM8/8/14
to ossec...@googlegroups.com
Sorry! - forgot another thing ...
 
Some of the "make" files use a variable "CC" to determine the C compiler to use - if not set, it defaults to "/usr/ucb/cc", which of course didn't exist on my Solaris installation.
 
I wanted to use "/usr/local/bin/gcc", so I did the following to set the variable before compiling:
CC=/usr/local/bin/gcc; export CC

dan (ddp)

unread,
Aug 8, 2014, 7:53:32 AM8/8/14
to ossec...@googlegroups.com
Try installing that.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ossec-list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ossec-list+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Bernt Jernberg

unread,
Sep 1, 2015, 10:48:01 AM9/1/15
to ossec-list
Hi,

Try this:

Installing 2.8.2 in Solaris 10 SPARC with default compiler:

/usr/sfw/bin/gtar zxf ossec-hids-2.8.2.tar.gz

cd ossec-hids-2.8.2/src

perl -pi -e "s/\/bin\/sh/\/bin\/bash/" src/Makeall src/Makefile

export CC=gcc

./install.sh


Bernt Jernberg

Bernt Jernberg

unread,
Sep 1, 2015, 11:09:39 AM9/1/15
to ossec-list

Or better:

/usr/sfw/bin/gtar zxf ossec-hids-2.8.2.tar.gz

cd ossec-hids-2.8.2

perl -pi -e "s/\/bin\/sh/\/bin\/bash/" src/Makeall src/Makefile

export CC=/usr/sfw/bin/gcc

./install.sh


Bernt Jernberg


do...@udel.edu

unread,
Sep 1, 2015, 11:54:18 AM9/1/15
to ossec...@googlegroups.com, Bernt Jernberg
Bernt Jernberg <bernt.j...@gmail.com> said:
>
>Or better:
>
>/usr/sfw/bin/gtar zxf ossec-hids-2.8.2.tar.gz
>
>cd ossec-hids-2.8.2
>
>perl -pi -e "s/\/bin\/sh/\/bin\/bash/" src/Makeall src/Makefile
>
>export CC=/usr/sfw/bin/gcc

Watch out. That export only works if you're already in bash. The
default solaris 10 /bin/sh won't accept this syntax.

>
>./install.sh
>
>
>Bernt Jernberg
>
>--
>
>---
>You received this message because you are subscribed to the Google Groups "o
>ssec-list" group.
>To unsubscribe from this group and stop receiving emails from it, send an em
>ail to ossec-list+...@googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.
>
>------=_Part_4890_679855998.1441119830364
>Content-Type: text/html; charset=UTF-8
>
><div dir="ltr"><br>Or better:<br><br>
>
><p>/usr/sfw/bin/gtar zxf ossec-hids-2.8.2.tar.gz</p><p>cd
>ossec-hids-2.8.2</p><p>perl -pi -e &quot;s/\/bin\/sh/\/bin\/bash/&quot;
>src/Makeall src/Makefile</p><p>export CC=/usr/sfw/bin/gcc</p><p>./install.sh
></p><p><br></p><p>Bernt Jernberg<br></p><br></div>
>
><p></p>
>
>-- <br />
><br />
>--- <br />
>You received this message because you are subscribed to the Google Groups &q
>uot;ossec-list&quot; group.<br />
>To unsubscribe from this group and stop receiving emails from it, send an em
>ail to <a href="mailto:ossec-list+...@googlegroups.com">ossec-list+u
>nsubs...@googlegroups.com</a>.<br />
>For more options, visit <a href="https://groups.google.com/d/optout">https:/
>/groups.google.com/d/optout</a>.<br />
>
>------=_Part_4890_679855998.1441119830364--
>------=_Part_4889_858871223.1441119830364--

Cheers,
Doke

Bernt Jernberg

unread,
Sep 1, 2015, 12:02:04 PM9/1/15
to do...@udel.edu, ossec...@googlegroups.com
    Watch out.  That export only works if you're already in bash.  The
default solaris 10 /bin/sh won't accept this syntax.


You are correct. I have changed to bash for all users.

Bernt

Aj Navarro

unread,
Sep 28, 2016, 12:39:46 PM9/28/16
to ossec-list
Do you have an example that how the makeall file is edited.
 
I have OSSEC 2.8.3. and send the next line:
 
# Setting SunOS path
if [ "X$OS" = "XSunOS" ]; then
    PATH=$PATH:/usr/ccs/bin:/usr/xpg4/bin:/opt/csw/gcc3/bin:/opt/csw/bin:/usr/sfw/bin
    export  PATH
fi
 
And when I run  sh -x Makeall all
ARGV=all
+ [ Xall = X ]
+ [ Xall = Xsetmaxagents ]
CJSONV=external/cJSON/
LUAV=external/lua/
LUA_PLAT=posix
+ uname -m
MACH=sun4v
+ uname
OS=SunOS
+ cat ./VERSION
VERSION=v2.8.3
MSG=
LIBS=os_xml os_regex os_net os_crypto
SOURCES=shared config
BINARIES=os_maild os_dbd os_csyslogd agentlessd os_execd analysisd logcollector remoted client-agent addagent util rootcheck syscheckd monitord os_auth
ROOTCHECKBIN=rootcheck
DIRECTORIES=
+ [ XSunOS = XSunOS ]
PATH=/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/xpg4/bin:/opt/csw/gcc3/bin:/opt/csw/bin:/usr/sfw/bin
+ export PATH
+ [ Xall = Xall -o Xall = Xtest -o Xall = Xrootcheck -o Xall = Xlibs ]
+ ls ./Config.OS
+ [ ! 0 = 0 ]

dan (ddp)

unread,
Sep 29, 2016, 10:05:43 AM9/29/16
to ossec...@googlegroups.com
Not positive, but it looks like your `sh` doesn't like the "[ -e
/usr/include/openssl/opensslconf.h ]" bit.
Check the shell's man page to see what the correct format should be
for that line.

>
>
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ossec-list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ossec-list+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages