sendip compile problem

Hi all:

I am trying to compile sendip application (one of freebsd ports) in FreeBSD 7.0. But it comes with the following errors.
Code:
/usr/lib/crt1.o(.txt+0x85): in function '-start':
: undefined reference to 'main'
The main function is in sendip.c. The Makefile is as follows:
Code:
INSTALL = 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)
GLOBALOBJS= csum.o compact.o

all:	$(GLOBALOBJS) 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"

sendip.1:	./help2man $(PROGS) $(PROTOS) 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 $(GLOBALOBJS)
			$(CC) -o $@ $(CFLAGS) $(LIBCFLAGS) $+

.PHONY:	clean install

clean:
			rm -f *.o *~ *.so $(PROTOS) $(PROGS) core gmon.out

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)

Can anyone help me about this?

Thank you very much.
Max
 
It seems to compile/build just fine:
Code:
root@build:/usr/ports#portmaster -dg net-mgmt/sendip

===>>> Port directory: /usr/ports/net-mgmt/sendip

===>>> Gathering distinfo list for installed ports

===>>> Launching 'make checksum' for net-mgmt/sendip in background
===>>> Gathering dependency list for net-mgmt/sendip from ports
===>>> Starting recursive 'make config' check
===>>> Recursive 'make config' check complete for net-mgmt/sendip

===>>> Starting build for net-mgmt/sendip <<<===

===>>> The 'make config' check found no dependencies to update

===>  Cleaning for sendip-2.5_1

===>>> Waiting on fetch & checksum for net-mgmt/sendip <<<===
===>  Vulnerability check disabled, database not found
=> sendip-2.5.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://www.earth.li/projectpurple/files/.


===>  Vulnerability check disabled, database not found
===>  Extracting for sendip-2.5_1
=> MD5 Checksum OK for sendip-2.5.tar.gz.
=> SHA256 Checksum OK for sendip-2.5.tar.gz.
===>   sendip-2.5_1 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Patching for sendip-2.5_1
===>   sendip-2.5_1 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Applying FreeBSD patches for sendip-2.5_1
===>   sendip-2.5_1 depends on executable: gmake - found
===>   sendip-2.5_1 depends on file: /usr/local/bin/perl5.8.9 - found
===>  Configuring for sendip-2.5_1
===>  Building for sendip-2.5_1
cc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o csum.o csum.c
cc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o compact.o compact.c
cc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o sendip.o sendip.c
cc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o gnugetopt.o gnugetopt.c
cc -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\"   -c -o gnugetopt1.o gnugetopt1.c
sh -c "if [ `uname` = Linux ] ; then \
cc -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 \
cc -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 \
cc -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"
cc -o ipv4.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared ipv4.c csum.o compact.o
cc -o ipv6.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared ipv6.c csum.o compact.o
cc -o icmp.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared icmp.c csum.o compact.o
cc -o tcp.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared tcp.c csum.o compact.o
cc -o udp.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared udp.c csum.o compact.o
cc -o rip.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared rip.c csum.o compact.o
cc -o ripng.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared ripng.c csum.o compact.o
cc -o ntp.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared ntp.c csum.o compact.o
cc -o bgp.so -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align -DSENDIP_LIBS=\"/usr/local/lib/sendip\" -shared bgp.c csum.o compact.o
./help2man -n "Send arbitrary IP packets" -N >sendip.1
echo -n '%define ver ' >sendip.spec
cat VERSION >>sendip.spec
cat sendip.spec.in >>sendip.spec
===>  Installing for sendip-2.5_1
===>   Generating temporary packing list
===>  Checking if net-mgmt/sendip already installed
[ -d /usr/local/lib/sendip ] || mkdir -p /usr/local/lib/sendip
[ -d /usr/local/bin ] || mkdir -p /usr/local/bin
[ -d /usr/local/man/man1 ] || mkdir -p /usr/local/man/man1
install -m 755 sendip /usr/local/bin
install -m 644 sendip.1 /usr/local/man/man1
install -m 755 ipv4.so ipv6.so icmp.so tcp.so udp.so rip.so ripng.so ntp.so bgp.so /usr/local/lib/sendip
===>   Compressing manual pages for sendip-2.5_1
===>   Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===>   Registering installation for sendip-2.5_1
===>>> Creating a package for new version sendip-2.5_1
 ===>>> Package saved to /usr/ports/packages/All

===>  Cleaning for sendip-2.5_1

Terminated
Terminated
===>>> Installation of net-mgmt/sendip (sendip-2.5_1) complete

root@build:/usr/ports#
 
Port compiles fine. How are you installing it? With a 'make install clean', 'portmaster', 'portinstall' type of command? Or are you using the distfile or a downloaded tarball in any other way? I'm asking because your Makefile is not exactly the same as the one I have in /usr/ports/net-mgmt/sendip/work/sendip-2.5 (I have ${PREFIX} stuff at the top). Either you edited it, or you're using a different one, or compiling/installing it in a non-suppoprted way.
 
Hi DutchDaemon:

I depress the tarball and using make command. I want to modify sendip so that I have to compile from source code.

I am sorry that I only copy some of the Makefile. I have not changed anything from the tarball.

Currently the problem is still there. Any suggestion?

Thank you,
Max
 
Use the port..

Code:
# cd /usr/port/net/sendip
# make extract
# make patch
Edit the source code, which you can find in the work directory and continue with
# make install clean
 
Back
Top