[uClinux-dev] Extending snmp agent problem

Guotii dhyf at zj165.com
Sun Oct 9 10:09:47 EDT 2005


Hi all,
	There are some ways to compile user's MIB modules in snmpagent.Now I use the way of creating dynamic modules for the net-snmp agent.Modules C source Code and header are devicecontrol.c and devicecontrol.h.
	So I use:
	gcc -g -I/usr/local/include -c -o devicecontrol.o devicecontrol.c
	gcc -g -fPIC -shared -o devicecontrol.so devicecontrol.o

	And in the snmpd.conf add the following line:
	dlmod devicecontrol /usr/src/net-snmp/agent/mibgroup/devicecontrol.so
	
	ok,when I use snmpget and snmpset,Both work very well.
	But I need to compile it to Arm+uClinux system,so I use arm-elf-gcc:
	arm-elf-gcc -g -I/usr/local/include -c -o devicecontrol.o devicecontrol.c    /this step is no problem
	arm-elf-gcc -g -fPIC -shared -o devicecontrol.so devicecontrol.o
	But this step cann't pass to compile,the error is following:

[root at localhost mibgroup]# arm-elf-gcc -I/usr/local/include -c -o devicecontrol.o devicecontrol.c
[root at localhost mibgroup]# arm-elf-gcc -fPIC -shared -o devicecontrol.so devicecontrol.o
/usr/local/arm-elf/lib/crt0.o(.text+0x10): In function `_start':
: undefined reference to `__uClibc_main'
/usr/local/arm-elf/lib/crt0.o(.text+0x14): In function `_start':
: undefined reference to `abort'
devicecontrol.o(.text+0x30): In function `init_devicecontrol':
: undefined reference to `register_mib'
devicecontrol.o(.text+0x40): In function `init_devicecontrol':
: undefined reference to `snmp_get_do_debugging'
devicecontrol.o(.text+0x68): In function `init_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0x84): In function `init_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0x94): In function `init_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0xa4): In function `init_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0xd8): In function `init_devicecontrol':
: undefined reference to `strdup'
devicecontrol.o(.text+0xf0): In function `init_devicecontrol':
: undefined reference to `strlen'
devicecontrol.o(.text+0x104): In function `init_devicecontrol':
: undefined reference to `time'
devicecontrol.o(.text+0x14c): In function `var_devicecontrol':
: undefined reference to `snmp_get_do_debugging'
devicecontrol.o(.text+0x174): In function `var_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0x190): In function `var_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0x19c): In function `var_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0x1a8): In function `var_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0x1d4): In function `var_devicecontrol':
: undefined reference to `header_generic'
devicecontrol.o(.text+0x260): In function `var_devicecontrol':
: undefined reference to `strlen'
devicecontrol.o(.text+0x27c): In function `var_devicecontrol':
: undefined reference to `strlen'
devicecontrol.o(.text+0x318): In function `var_devicecontrol':
: undefined reference to `snmp_get_do_debugging'
devicecontrol.o(.text+0x340): In function `var_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0x35c): In function `var_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0x374): In function `var_devicecontrol':
: undefined reference to `debugmsgtoken'
devicecontrol.o(.text+0x38c): In function `var_devicecontrol':
: undefined reference to `debugmsg'
devicecontrol.o(.text+0x43c): In function `write_nearrecycle':
: undefined reference to `fprintf'
devicecontrol.o(.text+0x46c): In function `write_nearrecycle':
: undefined reference to `malloc'
devicecontrol.o(.text+0x4d4): In function `write_nearrecycle':
: undefined reference to `memcpy'
devicecontrol.o(.text+0x560): In function `write_nearrecycle':
: undefined reference to `free'
devicecontrol.o(.text+0x58c): In function `write_nearrecycle':
: undefined reference to `time'
devicecontrol.o(.text+0x5b8): In function `write_nearrecycle':
: undefined reference to `free'
devicecontrol.o(.text+0x5e0): In function `write_nearrecycle':
: undefined reference to `free'
devicecontrol.o(.text+0x5fc): In function `write_nearrecycle':
: undefined reference to `stderr'
collect2: ld returned 1 exit status


	So what the reason may be ? Anyone can help me? Thank you !

regards.
				 
        Guotii
        dhyf at zj165.com
          2005-10-09



More information about the uClinux-dev mailing list