我正在使用linux-mint 11并尝试在我的机器上安装项目紫色的'sendip'工具。
我对makefile和linux internals不太了解。
但是在尝试安装时,遇到这些错误。请帮我解决这个问题。
这次对我来说最重要的是尽快在我的机器上安装此工具。
它完美地安装在红帽机器上而不会产生任何腐蚀。
我在互联网上搜索并找到了许多解决方案,但是没有一个解决方案,即使是一些看起来无关紧要的我,但在安全的一面,我尝试了所有...
1. LDFLAGS='-ldl' make install
2. sudo apt-get install glibc*
3. make CFLAGS="${CFLAGS} -ldl"
4. sudo apt-get install libjpeg62-dev
5. sudo apt-get install libdb-devel
6. sudo apt-get install libdbl
错误:
udit@udit-Notebook ~/Desktop/sendip-2.5-mec-0 $ make
for subdir in mec ; do \
cd $subdir ;\
make ;\
cd .. ;\
done
make[1]: Entering directory `/home/udit/Desktop/sendip-2.5-mec-0/mec'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/udit/Desktop/sendip-2.5-mec-0/mec'
sh -c "if [ `uname` = Linux ] ; then \
gcc -o sendip -g -rdynamic -ldl -lm -fPIC -fsigned-char -pipe -Wall -Wpointer-arith
-Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align
-DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o gnugetopt1.o compact.o ; \
elif [ `uname` = SunOS ] ; then \
gcc -o sendip -g -lsocket -lnsl -lm -ldl -fPIC -fsigned-char -pipe -Wall
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror
-g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o
gnugetopt1.o compact.o ;\
else \
gcc -o sendip -g -rdynamic -lm -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-
strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align
-DSENDIP_LIBS=\"/usr/local/lib/sendip\" sendip.o gnugetopt.o gnugetopt1.o compact.o ; \
fi"
sendip.o: In function `unload_modules':
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:211: undefined reference to `dlclose'
sendip.o: In function `load_module':
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:240: undefined reference to `dlopen'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:241: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:243: undefined reference to `dlopen'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:244: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:246: undefined reference to `dlopen'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:247: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:249: undefined reference to `dlopen'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:250: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:265: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:266: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:268: undefined reference to `dlclose'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:272: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:273: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:275: undefined reference to `dlclose'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:279: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:280: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:281: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:282: undefined reference to `dlclose'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:286: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:287: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:288: undefined reference to `dlclose'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:292: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:293: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:294: undefined reference to `dlclose'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:298: undefined reference to `dlsym'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:299: undefined reference to `dlerror'
/home/udit/Desktop/sendip-2.5-mec-0/sendip.c:300: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make: *** [sendip] Error 1
MakeFile内容:
#configureable stuff
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man1
LIBDIR ?= $(PREFIX)/lib/sendip
#For most systems, this works
INSTALL ?= install
#For Solaris, you may need
#INSTALL=/usr/ucb/install
CFLAGS= -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings \
-Wstrict-prototypes -Wnested-externs -Winline -Werror -g
-Wcast-align \
-DSENDIP_LIBS=\"$(LIBDIR)\"
#-Wcast-align causes problems on solaris, but not serious ones
LDFLAGS= -g -rdynamic -lm
#LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm
LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm -ldl
LDFLAGS_LINUX= -g -rdynamic -ldl -lm
LIBCFLAGS= -shared
CC= gcc
PROGS= sendip
BASEPROTOS= ipv4.so ipv6.so
IPPROTOS= icmp.so tcp.so udp.so
UDPPROTOS= rip.so ripng.so ntp.so
TCPPROTOS= bgp.so
PROTOS= $(BASEPROTOS) $(IPPROTOS) $(UDPPROTOS) $(TCPPROTOS)
LIBS= libsendipaux.a
LIBOBJS= csum.o compact.o protoname.o headers.o parseargs.o
SUBDIRS= mec
all: $(LIBS) subdirs sendip $(PROTOS) sendip.1 sendip.spec
#there has to be a nice way to do this
sendip: sendip.o gnugetopt.o gnugetopt1.o compact.o
sh -c "if [ `uname` = Linux ] ; then \
$(CC) -o $@ $(LDFLAGS_LINUX) $(CFLAGS) $+ ; \
elif [ `uname` = SunOS ] ; then \
$(CC) -o $@ $(LDFLAGS_SOLARIS) $(CFLAGS) $+ ;\
else \
$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $+ ; \
fi"
libsendipaux.a: $(LIBOBJS)
ar vr $@ $?
subdirs:
for subdir in $(SUBDIRS) ; do \
cd $$subdir ;\
make ;\
cd .. ;\
done
protoname.o: mec/protoname.c
$(CC) -o $@ -c -I. $(CFLAGS) $+
headers.o: mec/headers.c
$(CC) -o $@ -c -I. $(CFLAGS) $+
parseargs.o: mec/parseargs.c
$(CC) -o $@ -c -I. $(CFLAGS) $+
sendip.1: ./help2man $(PROGS) $(PROTOS) subdirs VERSION
./help2man -n "Send arbitrary IP packets" -N >sendip.1
sendip.spec: sendip.spec.in VERSION
echo -n '%define ver ' >sendip.spec
cat VERSION >>sendip.spec
cat sendip.spec.in >>sendip.spec
%.so: %.c $(LIBS)
$(CC) -o $@ $(CFLAGS) $(LIBCFLAGS) $+ $(LIBS)
.PHONY: clean install
clean:
rm -f *.o *~ *.so $(PROTOS) $(PROGS) $(LIBS) core gmon.out
for subdir in $(SUBDIRS) ; do \
cd $$subdir ;\
make clean ;\
cd .. ;\
done
veryclean:
make clean
rm -f sendip.spec sendip.1
install: all
[ -d $(LIBDIR) ] || mkdir -p $(LIBDIR)
[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
[ -d $(MANDIR) ] || mkdir -p $(MANDIR)
$(INSTALL) -m 755 $(PROGS) $(BINDIR)
$(INSTALL) -m 644 sendip.1 $(MANDIR)
$(INSTALL) -m 755 $(PROTOS) $(LIBDIR)
for subdir in $(SUBDIRS) ; do \
cd $$subdir ;\
make install ;\
cd .. ;\
done
答案 0 :(得分:4)
在Linux Mint 13和Ubuntu 12.04中遇到同样的问题。以下是我为解决此问题所做的工作:
安装gcc-4.4
sudo apt-get install gcc-4.4
在Makefile中,将'cc'设置为指向gcc-4.4。
CC = gcc-4.4
答案 1 :(得分:0)
由于您使用的是Linux,因此似乎使用了LDFLAGS_LINUX变量而不是LDFLAGS。尝试将-ldl
添加到该行。
答案 2 :(得分:0)