Compile check_dummy on linux
Posted: Thu Dec 13, 2012 10:14 am
I am attempting to write my own plugin. As part of the exercise I want to compile the check_dummy plugin to make sure I can at least compile this. I am using cmake to create the make file. I have included the directories to the .h files supplied. When I run make I get the following
[100%] Building C object CMakeFiles/test-dummy.dir/check_dummy.c.o
In file included from /home/user-name/oracle/check_dummy.c:36:
/downloads/nagios-plugins-1.4.16/plugins/utils.h:39: error: ‘STATE_CRITICAL’ undeclared here (not in a function)
/downloads/nagios-plugins-1.4.16/plugins/utils.h:40: error: ‘DEFAULT_SOCKET_TIMEOUT’ undeclared here (not in a function)
/downloads/nagios-plugins-1.4.16/plugins/utils.h:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timeout_alarm_handler’
/downloads/nagios-plugins-1.4.16/plugins/utils.h:71: warning: ‘struct timezone’ declared inside parameter list
/downloads/nagios-plugins-1.4.16/plugins/utils.h:71: warning: its scope is only this definition or declaration, which is probably not what you want
/home/user-name/oracle/check_dummy.c: In function ‘main’:
/home/user-name/oracle/check_dummy.c:45: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:45: error: (Each undeclared identifier is reported only once
/home/user-name/oracle/check_dummy.c:45: error: for each function it appears in.)
/home/user-name/oracle/check_dummy.c:47: error: ‘LC_ALL’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:48: error: ‘PACKAGE’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:48: error: ‘LOCALEDIR’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:52: warning: passing argument 1 of ‘usage4’ makes pointer from integer without a cast
/data/SAN-VOL3/downloads/nagios-plugins-1.4.16/plugins/utils.h:91: note: expected ‘const char *’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:54: error: ‘NP_VERSION’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:55: warning: incompatible implicit declaration of built-in function ‘exit’
/home/user-name/oracle/check_dummy.c:55: error: ‘STATE_OK’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:59: warning: incompatible implicit declaration of built-in function ‘exit’
/home/user-name/oracle/check_dummy.c:62: warning: passing argument 1 of ‘usage4’ makes pointer from integer without a cast
/data/SAN-VOL3/downloads/nagios-plugins-1.4.16/plugins/utils.h:91: note: expected ‘const char *’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:68: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:70: error: ‘STATE_WARNING’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:71: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:74: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:77: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:80: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:82: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c: In function ‘print_help’:
/home/user-name/oracle/check_dummy.c:99: error: ‘NP_VERSION’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:112: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:114: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
make[2]: *** [CMakeFiles/test-dummy.dir/check_dummy.c.o] Error 1
make[1]: *** [CMakeFiles/test-dummy.dir/all] Error 2
make: *** [all] Error 2
I suspect I ma missing a library or something. Any ideas on what is missing?
[100%] Building C object CMakeFiles/test-dummy.dir/check_dummy.c.o
In file included from /home/user-name/oracle/check_dummy.c:36:
/downloads/nagios-plugins-1.4.16/plugins/utils.h:39: error: ‘STATE_CRITICAL’ undeclared here (not in a function)
/downloads/nagios-plugins-1.4.16/plugins/utils.h:40: error: ‘DEFAULT_SOCKET_TIMEOUT’ undeclared here (not in a function)
/downloads/nagios-plugins-1.4.16/plugins/utils.h:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timeout_alarm_handler’
/downloads/nagios-plugins-1.4.16/plugins/utils.h:71: warning: ‘struct timezone’ declared inside parameter list
/downloads/nagios-plugins-1.4.16/plugins/utils.h:71: warning: its scope is only this definition or declaration, which is probably not what you want
/home/user-name/oracle/check_dummy.c: In function ‘main’:
/home/user-name/oracle/check_dummy.c:45: error: ‘STATE_UNKNOWN’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:45: error: (Each undeclared identifier is reported only once
/home/user-name/oracle/check_dummy.c:45: error: for each function it appears in.)
/home/user-name/oracle/check_dummy.c:47: error: ‘LC_ALL’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:48: error: ‘PACKAGE’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:48: error: ‘LOCALEDIR’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:52: warning: passing argument 1 of ‘usage4’ makes pointer from integer without a cast
/data/SAN-VOL3/downloads/nagios-plugins-1.4.16/plugins/utils.h:91: note: expected ‘const char *’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:54: error: ‘NP_VERSION’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:55: warning: incompatible implicit declaration of built-in function ‘exit’
/home/user-name/oracle/check_dummy.c:55: error: ‘STATE_OK’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:59: warning: incompatible implicit declaration of built-in function ‘exit’
/home/user-name/oracle/check_dummy.c:62: warning: passing argument 1 of ‘usage4’ makes pointer from integer without a cast
/data/SAN-VOL3/downloads/nagios-plugins-1.4.16/plugins/utils.h:91: note: expected ‘const char *’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:68: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:70: error: ‘STATE_WARNING’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:71: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:74: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:77: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:80: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:82: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c: In function ‘print_help’:
/home/user-name/oracle/check_dummy.c:99: error: ‘NP_VERSION’ undeclared (first use in this function)
/home/user-name/oracle/check_dummy.c:112: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
/home/user-name/oracle/check_dummy.c:114: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast
/usr/include/stdio.h:361: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
make[2]: *** [CMakeFiles/test-dummy.dir/check_dummy.c.o] Error 1
make[1]: *** [CMakeFiles/test-dummy.dir/all] Error 2
make: *** [all] Error 2
I suspect I ma missing a library or something. Any ideas on what is missing?