Re: agentx example gives compile errors

Pranesh Kulkarni <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CACdN3WezzSc3NFRJc1w520Mb59h9Uqc2LkUq30R4fu=X_i0nKQ@mail.gmail.com>
Hi,

the declarations for the above functions are in

#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-features.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>

which are not included properly ,

it should get automatically with

CFLAGS=-I  `net-snmpf-config --cflags`


check with this command   "net-snmp-config --cflags" on your terminal , and
check the output path with header files


In my case

$net-snmp-config --cflags
    -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux  -I. -I/usr/local/include


the header files are in current or in /usr/local/include(these header
files were in /usr/local/include)



On Wed, Oct 15, 2014 at 5:01 AM, Ali Azar <[email protected]> wrote:

> Hi all,
>
> I am trying to run the make on agentX example in this tutorial here:
> http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Subagent
>
> but when I run make on example-demon, it gives me the following error
> messages and looks like it can't link the header files properly:
>
> [root@localhost agent]# make example-demon
> gcc -fno-strict-aliasing -g -O2 -Ulinux -Dlinux=linux  -D_REENTRANT
> -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector
> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
> -I/usr/lib64/perl5/CORE   -I../include -I. -I../agent -I../agent/mibgroup
> -I../snmplib     example-demon.c   -o example-demon
> /tmp/ccAIXgYe.o: In function `main':
> /root/net-snmp-5.7.2.1/agent/example-demon.c:25: undefined reference to
> `snmp_enable_stderrlog'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:30: undefined reference to
> `netsnmp_ds_set_boolean'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:41: undefined reference to
> `init_agent'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:46: undefined reference to
> `init_nstAgentSubagentObject'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:55: undefined reference to
> `init_snmp'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:66: undefined reference to
> `snmp_log'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:72: undefined reference to
> `agent_check_and_process'
> /root/net-snmp-5.7.2.1/agent/example-demon.c:76: undefined reference to
> `snmp_shutdown'
> collect2: error: ld returned 1 exit status
> make: *** [example-demon] Error 1
>
>
> I copy the files into the net-snmp directory under agent:
> /net-snmp-5.7.2.1/agent
>
> seems like I have all the libraries as well:
> # net-snmp-config --libs
> -L/usr/local/lib -lnetsnmp -lrt -lm
>
> What is the probable cause of this?
>
> Thanks,
> Ali
>
>
> --
> Ali Eshragi
> MEng electrical & computer engineering
> University of Waterloo
>
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://p.sf.net/sfu/Zoho
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>


-- 
Thanks,
Pranesh

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.