[naemon-dev] successfully compiled naemon on AIX7.2
André Born
andre at x-byte.ch
Thu Jan 16 16:56:32 CET 2020
Hi,
naemon on linux works great, thanks for all that.
we are running some AIX hosts so we compiled naemon for AIX.
it took a long time and hard debugging until we got it running on AIX without dumping all the time.
i want to give back our findings to the community.
i hope you will check the patches and let it be integrated, so other can run naemon on AIX…
Using Prereqs:
gcc-8.1.0-2.ppc
m4-1.4.17-1.ppc
automake-1.16.1-1.noarch
Compile NAEMON on AIX7.2 (naemon-core version 1.1.0)
touch src/getopt.h
Patch: lib/runcmd.c
61c61
< #ifdef OPEN_MAX
---
> #if defined(OPEN_MAX) && !defined(RLIMIT_NOFILE)
lib/nsock.c patchen:
84c84
< if (listen(sock, 3) < 0) {
---
> if (listen(sock, 50) < 0) {
Patch: src/naemon/naemon.c
162c162
< c = getopt(argc, argv, "+hVvdspuxTW");
---
> c = getopt(argc, argv, "+hVvdspuxTW:");
Patch: src/naemon/workers.c
503c503,505
< WCOREDUMP(wpres.wait_status) ? " (core dumped)" : "",
---
> //14/05/2018 For some reason this WCOREDUMP macro is not implemented in AIX
> //WCOREDUMP(wpres.wait_status) ? " (core dumped)" : "",
> " (worker possibly core dumped?)",
655c657
< char * argvec[] = {naemon_binary_path, "--worker", qh_socket_path, NULL};
---
> char * argvec[] = {naemon_binary_path, "-W", qh_socket_path, NULL};
Configure 32bit:
PATH=$PATH:/usr/local/bin
export PKG_CONFIG_PATH=/opt/freeware/lib/pkgconfig
./configure --prefix= --localstatedir=/var/lib/naemon --with-lockfile=/var/lib/naemon --with-logdir=/var/log 'CPPFLAGS=-D_LINUX_SOURCE_COMPAT'
Configure 64bit:
PATH=$PATH:/usr/local/bin
export PKG_CONFIG_PATH=/opt/freeware/lib/pkgconfig
./configure CC="gcc" CFLAGS="-maix64 -mminimal-toc" CXX="g++" CXXFLAGS="-maix64 -mminimal-toc" NM="nm -X64" AR="ar -X64" LDFLAGS="-maix64" EXTLDFLAGS="-maix64" --prefix= --localstatedir=/var/lib/naemon --with-lockfile=/var/lib/naemon --with-logdir=/var/log 'CPPFLAGS=-D_LINUX_SOURCE_COMPAT'
Patch: Makefile
1057c1057
< src_naemon_naemon_LDFLAGS = -rdynamic
---
> src_naemon_naemon_LDFLAGS =
1059c1059
< LDADD = libnaemon.la <http://libnaemon.la/> $(GLIB_LIBS) -lm -ldl
---
> LDADD = libnaemon.la <http://libnaemon.la/> -lg $(GLIB_LIBS) -lm -ldl
1064c1064
< libnaemon_la_LIBADD = $(GLIB_LIBS)
---
> libnaemon_la_LIBADD = -lg $(GLIB_LIBS) -lm
Compile:
gmake
gmake install
NSCA for AIX:
Patch src/nsca.c
diff nsca-2.9.2/src/nsca.c nsca-2.9.2.orig/src/nsca.c
< #include <stdarg.h>
81,112d79
< int asprintf(char **ret, const char *format, ...)
< {
< va_list ap;
<
< *ret = NULL; /* Ensure value can be passed to free() */
<
< va_start(ap, format);
< int count = vsnprintf(NULL, 0, format, ap);
< va_end(ap);
<
< if (count >= 0)
< {
< char* buffer = malloc(count + 1);
< if (buffer == NULL)
< return -1;
<
< va_start(ap, format);
< count = vsnprintf(buffer, count + 1, format, ap);
< va_end(ap);
<
< if (count < 0)
< {
< free(buffer);
< return count;
< }
< *ret = buffer;
< }
<
< return count;
< }
<
<
613c580
< log_facility=LOG_LOCAL0;
---
> log_facility=LOG_FTP;
Configure & Compile:
./configure --with-nsca-user=naemon --with-nsca-grp=naemon --with-mcrypt-lib=/usr/local/lib --with-mcrypt-inc=/usr/local/include --with-libmcrypt-prefix=/usr/local\
CPPFLAGS=-D_LINUX_SOURCE_COMPAT 'LDFLAGS=-L/opt/freeware/lib -L/usr/local/lib -L/usr/local/lib -lmcrypt'
gmake clean
gmake all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/naemon-dev/attachments/20200116/a28baabc/attachment-0001.html>
More information about the Naemon-dev
mailing list