Compiling nagios plugins in AIX

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Compiling nagios plugins in AIX

Post by rajasegar »

AIX 6.1
Nagios plugins 2.0.1

Can you please advice what are the environment variables to set to compile in AIX?
Seem to get some conflict errors during make

Code: Select all

ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: .memmove
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
ld: 0711-224 WARNING: Duplicate symbol: .bcopy
ld: 0711-224 WARNING: Duplicate symbol: .memmove
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
        gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I..  -I.. -I../lib -I../gl -I../intl  -I/usr/include/ldap  -I/usr/include  -D_THREAD_SAFE -DNP_VERSION='"2.0.1"' -g -O2 -MT check_ssh.o -MD -MP -MF .deps/check_ssh.Tpo -c -o check_ssh.o check_ssh.c
        mv -f .deps/check_ssh.Tpo .deps/check_ssh.Po
        /bin/sh ../libtool --tag=CC    --mode=link gcc -DNP_VERSION='"2.0.1"' -g -O2   -L. -o check_ssh check_ssh.o libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a  -lnsl -lpthread -ldl
libtool: link: gcc -DNP_VERSION=\"2.0.1\" -g -O2 -o check_ssh check_ssh.o  -L. libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lpthread -ldl
        gcc -DLOCALEDIR=\"/usr/local/nagios/share/locale\" -DHAVE_CONFIG_H -I. -I..  -I.. -I../lib -I../gl -I../intl  -I/usr/include/ldap  -I/usr/include  -D_THREAD_SAFE -DNP_VERSION='"2.0.1"' -g -O2 -MT check_tcp.o -MD -MP -MF .deps/check_tcp.Tpo -c -o check_tcp.o check_tcp.c
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:512:12: error: conflicting types for 'fgetpos64'
 extern int fgetpos64(FILE *, fpos64_t *);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:311:12: note: previous declaration of 'fgetpos64' was here
 extern int fgetpos(FILE *__restrict__, fpos_t *__restrict__);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:515:12: error: conflicting types for 'fseeko64'
 extern int fseeko64(FILE *, off64_t, int);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:455:12: note: previous declaration of 'fseeko64' was here
 extern int fseeko(FILE *, off_t, int);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:516:12: error: conflicting types for 'fsetpos64'
 extern int fsetpos64(FILE *, const fpos64_t *);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:313:12: note: previous declaration of 'fsetpos64' was here
 extern int fsetpos(FILE *, const fpos_t *);
            ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:517:16: error: conflicting types for 'ftello64'
 extern off64_t ftello64(FILE *);
                ^
In file included from ../gl/stdio.h:43:0,
                 from common.h:40,
                 from check_tcp.c:37:
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.2/include-fixed/stdio.h:456:14: note: previous declaration of 'ftello64' was here
 extern off_t ftello(FILE *);
              ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:171:16: error: conflicting types for 'lseek64'
 extern off64_t lseek64(int, off64_t, int);
                ^
/usr/include/unistd.h:169:14: note: previous declaration of 'lseek64' was here
 extern off_t lseek(int, off_t, int);
              ^
In file included from /usr/include/unistd.h:746:0,
                 from ../gl/unistd.h:27,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/sys/lockf.h:64:13: error: conflicting types for 'lockf64'
  extern int lockf64 (int, int, off64_t);
             ^
/usr/include/sys/lockf.h:62:13: note: previous declaration of 'lockf64' was here
  extern int lockf (int, int, off_t);
             ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:809:14: error: conflicting types for 'ftruncate64'
  extern int  ftruncate64(int, off64_t);
              ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:807:14: note: previous declaration of 'ftruncate64' was here
  extern int  ftruncate(int, off_t);
              ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:845:14: error: conflicting types for 'truncate64'
  extern int  truncate64(const char *, off64_t);
              ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:843:14: note: previous declaration of 'truncate64' was here
  extern int  truncate(const char *, off_t);
              ^
In file included from ../gl/unistd.h:27:0,
                 from common.h:51,
                 from check_tcp.c:37:
/usr/include/unistd.h:862:18: error: conflicting types for 'pread64'
  extern ssize_t  pread64(int, void *, size_t, off64_t);
                  ^
/usr/include/unistd.h:859:18: note: previous declaration of 'pread64' was here
  extern ssize_t  pread(int, void *, size_t, off_t);
                  ^
/usr/include/unistd.h:863:18: error: conflicting types for 'pwrite64'
  extern ssize_t  pwrite64(int, const void *, size_t, off64_t);
                  ^
/usr/include/unistd.h:860:18: note: previous declaration of 'pwrite64' was here
  extern ssize_t  pwrite(int, const void *, size_t, off_t);
                  ^
/usr/include/unistd.h:942:17: error: conflicting types for 'fclear64'
  extern off64_t fclear64(int, off64_t);
                 ^
/usr/include/unistd.h:939:15: note: previous declaration of 'fclear64' was here
  extern off_t fclear(int, off_t);
               ^
/usr/include/unistd.h:943:13: error: conflicting types for 'fsync_range64'
  extern int fsync_range64(int, int, off64_t, off64_t);
             ^
/usr/include/unistd.h:940:13: note: previous declaration of 'fsync_range64' was here
  extern int fsync_range(int, int, off_t, off_t);
             ^
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 2.


Stop.
bash-4.2#

I have installed all the required gcc libraries
-rw-------    1 nagios   nagios     18087017 Jan 09 10:42 gcc-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios      6571520 Jan 09 10:41 gcc-c++-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios      5866258 Jan 09 10:42 gcc-cpp-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios      9934241 Jan 09 10:42 gcc-gfortran-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios      1518681 Jan 09 10:54 gmp-5.1.3-1.aix5.1.ppc.rpm
-rw-------    1 nagios   nagios       186807 Jan 09 10:53 gmp-devel-5.1.3-1.aix5.1.ppc.rpm
-rw-------    1 nagios   nagios       886300 Jan 09 10:42 libgcc-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios       517814 Jan 09 10:42 libgomp-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios       414917 Jan 09 10:53 libmpc-1.0.1-2.aix5.1.ppc.rpm
-rw-------    1 nagios   nagios        30653 Jan 09 10:53 libmpc-devel-1.0.1-2.aix5.1.ppc.rpm
-rw-------    1 nagios   nagios     10022361 Jan 09 10:42 libstdc++-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios      2667103 Jan 09 10:42 libstdc++-devel-4.8.2-1.aix6.1.ppc.rpm
-rw-------    1 nagios   nagios       801716 Jan 09 10:53 mpfr-3.1.2-1.aix5.1.ppc.rpm
-rw-------    1 nagios   nagios        68407 Jan 09 10:53 mpfr-devel-3.1.2-1.aix5.1.ppc.rpm
Thanks
Last edited by tmcdonald on Thu Aug 07, 2014 9:04 am, edited 2 times in total.
Reason: [code] wraps save scroll wheels :)
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Compiling nagios plugins in AIX

Post by abrist »

I will look into this when I get a chance. As we don't have an AIX box to test on, we may have to rely on conjecture and your (and others) attempts to resolve the issue. My initial suspicion is that your platform needs to have config.h included first (judging from a quick google). I opened up an issue on github, though it may be a bit before I get a chance to really dig into this.
https://github.com/nagios-plugins/nagio ... /issues/40
Did you have issues with previous nagios-plugins sources as well?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Compiling nagios plugins in AIX

Post by emislivec »

rajasegar,

Can you put this check_tcp.c in nagios-plugins-2.0.1/plugins/check_tcp.c and compile again?

If check_tcp compiles, the build might fail next on negate.c
If that happens, put the attached negate.c in nagios-plugins-2.0.1/plugins/negate.c and compile again.

Please let us know if these changes fix the problems. There may be other problems after these.
You do not have the required permissions to view the files attached to this post.
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: Compiling nagios plugins in AIX

Post by rajasegar »

abrist wrote:I will look into this when I get a chance. As we don't have an AIX box to test on, we may have to rely on conjecture and your (and others) attempts to resolve the issue. My initial suspicion is that your platform needs to have config.h included first (judging from a quick google). I opened up an issue on github, though it may be a bit before I get a chance to really dig into this.
https://github.com/nagios-plugins/nagio ... /issues/40
Did you have issues with previous nagios-plugins sources as well?
Thanks for the assistance.
Same make with nagios-plugins 1.5.1. I am not entirely sure now if it is the same errors.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: Compiling nagios plugins in AIX

Post by rajasegar »

emislivec wrote:rajasegar,

Can you put this check_tcp.c in nagios-plugins-2.0.1/plugins/check_tcp.c and compile again?

If check_tcp compiles, the build might fail next on negate.c
If that happens, put the attached negate.c in nagios-plugins-2.0.1/plugins/negate.c and compile again.

Please let us know if these changes fix the problems. There may be other problems after these.
Prediction correct about more problems

Code: Select all

check_ldap.c:38:18: fatal error: lber.h: No such file or directory
 #include <lber.h>
                  ^
compilation terminated.
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 2.


Stop.
Solved the issue above by installing openldap-devel-2.4.23-0.3.aix5.1.ppc.rpm

But more issues followed

Code: Select all

  /bin/sh ../libtool --tag=CC    --mode=link gcc -DNP_VERSION='"2.0.1"' -g -O2   -L. -o check_dig check_dig.o libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a  -lnsl -lbsd -lpthread -ldl
libtool: link: gcc -DNP_VERSION=\"2.0.1\" -g -O2 -o check_dig check_dig.o  -L. libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lbsd -lpthread -ldl
ld: 0711-317 ERROR: Undefined symbol: .ceil
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
make: 1254-004 The error code from the last command is 1.

Stop.
make: 1254-004 The error code from the last command is 1.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
bash-4.2#
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Compiling nagios plugins in AIX

Post by abrist »

Can you port the full output from ./configure? The configure script should have linked math.h or skipped the plugin if mathlibs was not available.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: Compiling nagios plugins in AIX

Post by emislivec »

It looks like the math libs aren't being added to the link. There should be a "-lm" on the line with "-lnsl -lbsd -lpthread -ldl". This should be detected and set by ./configure. Do you have the latest updates for the build tools? IBM has released fixes for similar problems in the past.

Can you run

Code: Select all

make distclean
./configure
and rebuild?

If you are still having problems, you may need to rebuild the ./configure script. To do this you need the latest code from GitHub, which has the changes to check_dig.c and negate.c

You can download the latest snapshot from: https://github.com/nagios-plugins/nagio ... master.zip
If you're comfortable with git, you can also

Code: Select all

git clone https://github.com/nagios-plugins/nagios-plugins.git
To rebuild the ./configure script

Code: Select all

cd nagios-plugins
./tools/setup
You will need autoconf and automake installed to run ./tools/setup. After this you can run ./configure and make like before.

The output from ./tools/setup and ./configure would be helpful for troubleshooting.

Let us know how it goes.
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: Compiling nagios plugins in AIX

Post by rajasegar »

abrist wrote:Can you port the full output from ./configure? The configure script should have linked math.h or skipped the plugin if mathlibs was not available.
Here is the log file
config.zip
You do not have the required permissions to view the files attached to this post.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
rajasegar
Posts: 1018
Joined: Sun Mar 30, 2014 10:49 pm

Re: Compiling nagios plugins in AIX

Post by rajasegar »

emislivec wrote:It looks like the math libs aren't being added to the link. There should be a "-lm" on the line with "-lnsl -lbsd -lpthread -ldl". This should be detected and set by ./configure. Do you have the latest updates for the build tools? IBM has released fixes for similar problems in the past.

Can you run

Code: Select all

make distclean
./configure
and rebuild?

If you are still having problems, you may need to rebuild the ./configure script. To do this you need the latest code from GitHub, which has the changes to check_dig.c and negate.c

You can download the latest snapshot from: https://github.com/nagios-plugins/nagio ... master.zip
If you're comfortable with git, you can also

Code: Select all

git clone https://github.com/nagios-plugins/nagios-plugins.git
To rebuild the ./configure script

Code: Select all

cd nagios-plugins
./tools/setup
You will need autoconf and automake installed to run ./tools/setup. After this you can run ./configure and make like before.

The output from ./tools/setup and ./configure would be helpful for troubleshooting.

Let us know how it goes.
Did everything as instructed, however still the same error
ld: 0711-317 ERROR: Undefined symbol: .ceil
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
Makefile:1964: recipe for target 'check_dig' failed
make[2]: *** [check_dig] Error 1
make[2]: Leaving directory '/home/nagios/raja/nagios-plugins-master/plugins'
Makefile:1512: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nagios/raja/nagios-plugins-master'
Makefile:1437: recipe for target 'all' failed
make: *** [all] Error 2
bash-4.2#

bash-4.2# ./tools/setup
which: 0652-141 There is no gnumake in /opt/freeware/bin /opt/freeware/bin /usr/bin /etc /usr/sbin /usr/ucb /usr/bin/X11 /sbin /usr/java5/jre/bin /usr/java5/bin.
Found GNU Make at /opt/freeware/bin/gmake ... good.
bash-4.2#


Please see attached the latest config.log
config.zip
configure.zip
Makefile.zip
You do not have the required permissions to view the files attached to this post.
5 x Nagios 5.6.9 Enterprise Edition
RHEL 6 & 7
rrdcached & ramdisk optimisation
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Compiling nagios plugins in AIX

Post by abrist »

I will take a look at this tomorrow, though it is starting to look like you may have issues with your headers or toolchain. Where did you get the GNU toolchain from? (as they don't ship with AIX)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked