Menu

undefined reference to nmap_sql_add_port...

Discussion
mcolgin
2004-09-15
2013-03-14
  • mcolgin

    mcolgin - 2004-09-15

    nmap-sql was recently featured in my favorite magazine Linux Journal:
    http://www.linuxjournal.com/modules.php?op=modload&name=NS-lj-issues/issue126&file=index

    However, I'm having troubles getting it to compile from either the "nmap-3.48-with-sql-0.0.3.tar.gz" or by applying the patches to the original 3.48 source code published at "http://download.insecure.org/nmap/dist/?M=D"

    When attempting to compile "nmap-3.48-with-sql-0.0.3.tar.gz" an error is generated at compile time reading:
    /tmp/un/nmap-3.48/output.cc:407: undefined reference to `nmap_sql_add_port(sql_options*)'
    collect2: ld returned 1 exit status

    I've included a few lines previous to this message in an attempt to provide more information:

    Compiling nmap
    rm -f nmap
    g++ -Llibpcap-possiblymodified  -Lnbase -Lnsock/src/  -o nmap main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o output.o scan_engine.o timing.o charpool.o services.o protocols.o nmap_rpc.o portlist.o NmapOps.o TargetGroup.o Target.o FingerPrintResults.o service_scan.o NmapOutputTable.o  -lm  -lnbase -lnsock -lpcre -lpcap
    nmap.o(.text+0x1fb3): In function `nmap_main(int, char**)':
    /tmp/un/nmap-3.48/nmap.cc:1148: undefined reference to `nmap_sql_update_runlist(sql_options*)'
    nmap.o(.text+0x2078):/tmp/un/nmap-3.48/nmap.cc:1114: undefined reference to `nmap_sql_update_hoststats(sql_options*)'
    nmap.o(.text+0x2084):/tmp/un/nmap-3.48/nmap.cc:1115: undefined reference to `nmap_sql_update_target(sql_options*)'
    nmap.o(.text+0x2114):/tmp/un/nmap-3.48/nmap.cc:1085: undefined reference to `nmap_sql_validate_target_id(sql_options*)'
    nmap.o(.text+0x213d):/tmp/un/nmap-3.48/nmap.cc:1096: undefined reference to `nmap_sql_add_targetid(sql_options*)'
    nmap.o(.text+0x214f):/tmp/un/nmap-3.48/nmap.cc:1095: undefined reference to `nmap_sql_validate_target_id(sql_options*)'
    nmap.o(.text+0x2b8f):/tmp/un/nmap-3.48/nmap.cc:727: undefined reference to `nmap_sql_initialize(sql_options*)'
    output.o(.text+0xda6): In function `printportoutput(Target*, PortList*)':
    /tmp/un/nmap-3.48/output.cc:407: undefined reference to `nmap_sql_add_port(sql_options*)'
    collect2: ld returned 1 exit status
    make: *** [nmap] Error 1
    [

     
    • mcolgin

      mcolgin - 2004-09-22

      Solution: You didn't follow the instructions in README.sql dummy...

      Performing the following steps will make sure the header/source files are found and object files are linked correctly:

      - add -I/usr/include/mysql to the INCLS line
      - add -L/usr/lib/mysql -lmysqlclient -lz to the LDFLAGS line
      - add -lmysqlclient to the LIBS line
      - add common.cc my_td.cc nmap-sql.cc to the SRCS line
      - add common.o my_td.o nmap-sql.o to the OBJS line
      - add common.h nmap-sql.h to the DEPS line

       

Log in to post a comment.