title: Error : undefined reference
body: <p>I am using linux-mint 11 and trying to install 'sendip' tool from project purple on my machine.</p>
  
  <p>I don't know much about makefile and linux internals.</p>
  
  <p>but when trying to install it,getting these errors.Please help me with the issue.</p>
  
  <p>What is most important to me this time is to get this tool installed on my machine as soon as possible.</p>
  
  <p>It is installed perfectly on red hat machine without giving any eroor.</p>
  
  <p>I searched on internet and found many solutions but none of them is working out even some looks irrelevent to me but on the safe side I tried them all ...</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Error :</p>
  
  <pre><code>  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
  </code></pre>
  
  <p>MakeFile Contents :</p>
  
  <pre><code>#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 &gt;sendip.1
  
   sendip.spec:   sendip.spec.in VERSION
          echo -n '%define ver ' &gt;sendip.spec
          cat VERSION &gt;&gt;sendip.spec
          cat sendip.spec.in &gt;&gt;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
  </code></pre>