i wish to make a agentx file with 3 files

there are fan.c, log.c and exam.c

first i made a Makefile

this is a my Makefile for agentx


1. Makefile

========================================================================================

#
# Warning: you may need more libraries than are included here on the
# build line.  The agent frequently needs various libraries in order
# to compile pieces of it, but is OS dependent and we can't list all
# the combinations here.  Instead, look at the libraries that were
# used when linking the snmpd master agent and copy those to this
# file.
#
PROJDIR = /home/sychoi
INSTDIR = $(PROJDIR)/rootfs/usr/sbin
SNMPINC = /home/sychoi/install/usr
CC=gcc
STRIP=ppc_82xx-strip

OBJS += agentx.o
OBJS += fan.o
OBJS += log.o
OBJS += exam.o

TARGETS = agentx

LIBS=$(PROJDIR)/lib/libnexcmd/libnexcmd.a -lpthread

CFLAGS = -I. -I$(PROJDIR)/include/libnexcmd -I$(PROJDIR)/include
CFLAGS += -O2 -Dlinux -I. -I$(SNMPINC)/include
BUILDLIBS = -L$(SNMPINC)/lib -lnetsnmp -lcrypto -lm
BUILDAGENTLIBS = -L$(SNMPINC)/lib -lnetsnmpmibs -lnetsnmpagent -lnetsnmphelpers -lnetsnmp -ldl -lcrypto -lm

# shared library flags (assumes gcc)
DLFLAGS=-fPIC -shared -lpthread

all: $(TARGETS)

agentx: $(OBJS)
        $(CC) -o agentx $(OBJS) $(LIBS) $(BUILDLIBS) $(BUILDAGENTLIBS)
        $(STRIP) agentx

install:
        cp -a agentx $(INSTDIR)

clean:
        rm -f $(OBJS) $(TARGETS)
===========================================================================================


but i ran the Makefile... i had a several errors...

errors bleow...


===========================================================================================

[r...@localhost net-snmp-5.3.2]# make
gcc -I. -I/home/sychoi/include/libnexcmd -I/home/sychoi/include -O2 -Dlinux -I. -I/home/sychoi/install/usr/include   -c -o agentx.o agentx.c
gcc -I. -I/home/sychoi/include/libnexcmd -I/home/sychoi/include -O2 -Dlinux -I. -I/home/sychoi/install/usr/include   -c -o fan.o fan.c
gcc -I. -I/home/sychoi/include/libnexcmd -I/home/sychoi/include -O2 -Dlinux -I. -I/home/sychoi/install/usr/include   -c -o log.o log.c
gcc -I. -I/home/sychoi/include/libnexcmd -I/home/sychoi/include -O2 -Dlinux -I. -I/home/sychoi/install/usr/include   -c -o exam.o exam.c
gcc -o agentx agentx.o fan.o log.o exam.o /home/sychoi/lib/libnexcmd/libnexcmd.a -lpthread -L/home/sychoi/install/usr/lib -lnetsnmp -lcrypto -lm  -L/home/sychoi/install/usr/lib -lnetsnmpmibs -lnetsnmpagent -lnetsnmphelpers -lnetsnmp -ldl -lcrypto -lm
fan.o: In function `handle_Fm2rpms':
fan.c:(.text+0x0): multiple definition of `handle_Fm2rpms'
agentx.o:agentx.c:(.text+0x2190): first defined here
fan.o: In function `handle_fm1rpms':
fan.c:(.text+0x70): multiple definition of `handle_fm1rpms'
agentx.o:agentx.c:(.text+0x2200): first defined here
fan.o: In function `handle_currentfanspeed':
fan.c:(.text+0xd0): multiple definition of `handle_currentfanspeed'
agentx.o:agentx.c:(.text+0x20): first defined here
fan.o: In function `handle_currenttemperature':
fan.c:(.text+0x130): multiple definition of `handle_currenttemperature'
agentx.o:agentx.c:(.text+0x80): first defined here
fan.o: In function `handle_autofanspeed':
fan.c:(.text+0x190): multiple definition of `handle_autofanspeed'
agentx.o:agentx.c:(.text+0x18a0): first defined here
fan.o: In function `handle_targettemperature':
fan.c:(.text+0x300): multiple definition of `handle_targettemperature'
agentx.o:agentx.c:(.text+0x1a10): first defined here
fan.o: In function `init_fan':
fan.c:(.text+0x4a0): multiple definition of `init_fan'
agentx.o:agentx.c:(.text+0x1fe0): first defined here
log.o: In function `handle_pmeup':
log.c:(.text+0x0): multiple definition of `handle_pmeup'
agentx.o:agentx.c:(.text+0x8d0): first defined here
log.o: In function `handle_pmedown':
log.c:(.text+0x170): multiple definition of `handle_pmedown'
agentx.o:agentx.c:(.text+0xa40): first defined here
log.o: In function `handle_portup':
log.c:(.text+0x2e0): multiple definition of `handle_portup'
agentx.o:agentx.c:(.text+0xbb0): first defined here
log.o: In function `handle_portdown':
log.c:(.text+0x450): multiple definition of `handle_portdown'
agentx.o:agentx.c:(.text+0xd20): first defined here
log.o: In function `handle_moduleinsert':
log.c:(.text+0x5c0): multiple definition of `handle_moduleinsert'
agentx.o:agentx.c:(.text+0xe90): first defined here
log.o: In function `handle_modulefail':
log.c:(.text+0x730): multiple definition of `handle_modulefail'
agentx.o:agentx.c:(.text+0x1000): first defined here
log.o: In function `handle_fanrecover':
log.c:(.text+0x8a0): multiple definition of `handle_fanrecover'
agentx.o:agentx.c:(.text+0x1170): first defined here
log.o: In function `handle_fanfail':
log.c:(.text+0xa10): multiple definition of `handle_fanfail'
agentx.o:agentx.c:(.text+0x12e0): first defined here
log.o: In function `handle_severity':
log.c:(.text+0xb80): multiple definition of `handle_severity'
agentx.o:agentx.c:(.text+0x1450): first defined here
log.o: In function `handle_facility':
log.c:(.text+0xcf0): multiple definition of `handle_facility'
agentx.o:agentx.c:(.text+0x15c0): first defined here
log.o: In function `handle_server':
log.c:(.text+0xe60): multiple definition of `handle_server'
agentx.o:agentx.c:(.text+0x1730): first defined here
log.o: In function `handle_ip':
log.c:(.text+0xfd0): multiple definition of `handle_ip'
agentx.o:agentx.c:(.text+0x1bb0): first defined here
log.o: In function `init_log':
log.c:(.text+0x1220): multiple definition of `init_log'
agentx.o:agentx.c:(.text+0x1e00): first defined here
exam.o: In function `getname':
exam.c:(.text+0x0): multiple definition of `getname'
agentx.o:agentx.c:(.text+0x0): first defined here
exam.o:(.data+0x0): multiple definition of `fname'
agentx.o:(.data+0x0): first defined here
exam.o: In function `examNEXTable_removeEntry':
exam.c:(.text+0x10): multiple definition of `examNEXTable_removeEntry'
agentx.o:agentx.c:(.text+0xe0): first defined here
exam.o: In function `examNEXTable_createEntry':
exam.c:(.text+0x40): multiple definition of `examNEXTable_createEntry'
agentx.o:agentx.c:(.text+0x110): first defined here
exam.o: In function `examNEXTable_handler':
exam.c:(.text+0x140): multiple definition of `examNEXTable_handler'
agentx.o:agentx.c:(.text+0x210): first defined here
exam.o: In function `firstvals':
exam.c:(.text+0x6d0): multiple definition of `firstvals'
agentx.o:agentx.c:(.text+0x7a0): first defined here
exam.o: In function `initialize_table_examNEXTable':
exam.c:(.text+0x740): multiple definition of `initialize_table_examNEXTable'
agentx.o:agentx.c:(.text+0x810): first defined here
exam.o: In function `init_exam':
exam.c:(.text+0x7f0): multiple definition of `init_exam'

agentx.o:agentx.c:(.text+0x8c0): first defined here


I did't understand this line blew.....really...

/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.so when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.a when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.so when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.a when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpmibs.so when searching for -lnetsnmpmibs
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpmibs.a when searching for -lnetsnmpmibs
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpmibs.so when searching for -lnetsnmpmibs
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpmibs.a when searching for -lnetsnmpmibs
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpagent.so when searching for -lnetsnmpagent
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpagent.a when searching for -lnetsnmpagent
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpagent.so when searching for -lnetsnmpagent
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmpagent.a when searching for -lnetsnmpagent
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmphelpers.so when searching for -lnetsnmphelpers
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmphelpers.a when searching for -lnetsnmphelpers
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmphelpers.so when searching for -lnetsnmphelpers
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmphelpers.a when searching for -lnetsnmphelpers
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.so when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.a when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.so when searching for -lnetsnmp
/usr/bin/ld: skipping incompatible /home/sychoi/install/usr/lib/libnetsnmp.a when searching for -lnetsnmp
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `headerFree'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbNextIterator'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbOpen'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbClose'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `headerGetEntry'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmGetPath'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `headerLink'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbFreeIterator'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbInitIterator'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmReadConfigFiles'
/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../libnetsnmpmibs.so: undefined reference to `rpmdbGetIteratorOffset'
collect2: ld returned 1 exit status

make: *** [agentx] 오류 1

===========================================================================================

i execute "ldconfig" command .....but nothing changed...

how can i fix this problem....

please let me know about it...

i 'll wait for your advise

thank you...









미아찾기 캠페인
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to