make: link errors due to missing symbols

Help
2007-11-21
2013-04-22
  • David Nielsen
    David Nielsen
    2007-11-21

    Hello,
         I am trying to build brlcad 7.10.2 and have a make error linking htester.
    -------------------------------
    /bin/bash ../../libtool --silent --mode=link gcc  -pipe -fno-strict-aliasing -fn
    o-common -g -O3   -L/usr/local/lib -pipe -fno-strict-aliasing -fno-common -g -O3
    -o htester  htester.o libbu.la  ../../src/libbu/libbu.la -L../../src/other/tcl/
    unix -ltcl8.5 -ldl -lm ../../src/other/libpng/libpng.la -lm -lmalloc -lthread
    ld: warning: file ../../src/libbu/.libs/libbu.so: linked to ./.libs/libbu.so: at
    tempted multiple inclusion of file
    Undefined                       first referenced
    symbol                             in file
    htond                               htester.o
    ntohd                               htester.o
    ld: fatal: Symbol referencing errors. No output written to .libs/htester
    collect2: ld returned 1 exit status
    -------------------------------

         The htond and ntohd symbols are both present in htond.o and libbu.a. The
    libbu.so.19.0.1 binary doesn't appear to contain the htond or ntohd symbols.

    src/libbu/.libs> nm libbu.so.19.0.1 | grep htond
    src/libbu/.libs> nm libbu.a | grep htond
    [65]    |         0|       0|NOTY |GLOB |0    |UNDEF  |htond
    libbu.a[htond.o]:
    [13]    |         0|      73|FUNC |GLOB |0    |1      |htond
    [1]     |         0|       0|FILE |LOCL |0    |ABS    |htond.c
    [161]   |         0|       0|NOTY |GLOB |0    |UNDEF  |htond

         I'm building on Solaris 10 x86.
    > head -1 /etc/release
                            Solaris 10 11/06 s10x_u3wos_10 X86
    > libtool --version
    ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)

         Does anyone know why the the htond and ntohd symbols are missing from the
    shared object?

         To make some progress, a temporary workaround is used. I replaced the
    libbu.la in the htester link line with htond.o.
    -------------------------------
    src/libbu> /bin/bash ../../libto
    ^Mol --silent --mode=link gcc  -pipe -fno-strict-aliasing -fno-common -g -O3
    -L/ ^Musr/local/lib -pipe -fno-strict-aliasing -fno-common -g -O3 -o htester 
    htester.o htond.o -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm ../../src/other/
    libpng/li ^Hbpng.la -lm -lmalloc -lthread

         This fixes the immediate problem for htester but make fails later due to
    missing symbols again. This time it includes libbu, librt, and maybe some others
    (I didn't take the time to locate all of them).

    -------------------------------
    /bin/bash ../../libtool --silent --mode=link gcc  -pipe -fno-strict-aliasing -fno-common -g -O3   -L/usr/local/lib -pipe -fno-strict-aliasing -fno-common -g -O3 -o comb  comb.o librt.la ../../src/libbn/libbn.la ../../src/libbu/libbu.la -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm ../../src/other/libpng/libpng.la -lm -lmalloc -lthread -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm -lm ../../src/libbu/libbu.la -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm ../../src/other/libpng/libpng.la -lm -lmalloc -lthread -lc -lm ../../src/libsysv/libsysv.la  -lstdc++ -lz  ../../src/libbn/libbn.la ../../src/libbu/libbu.la -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm ../../src/other/libpng/libpng.la -lm -lmalloc -lthread -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm -lm  ../../src/libbu/libbu.la -L../../src/other/tcl/unix -ltcl8.5 -ldl -lm ../../src/other/libpng/libpng.la -lm -lmalloc -lthread  ../../src/libsysv/libsysv.la
    Undefined                       first referenced
    symbol                             in file
    bu_mem_barriercheck                 comb.o
    db_dirbuild                         comb.o
    rt_db_free_internal                 comb.o
    rt_pr_tree_str                      comb.o
    rt_pr_tree_vls                      comb.o
    bu_vls_init                         comb.o
    bu_vls_free                         comb.o
    bu_vls_addr                         comb.o
    db_lookup                           comb.o
    bu_log                              comb.o
    rt_uniresource                      comb.o
    rt_pr_tree                          comb.o
    bu_badmagic                         comb.o
    rt_db_get_internal                  comb.o
    bu_free                             comb.o
    db_open                             comb.o
    bu_debug                            comb.o
    db_ck_v4gift_tree                   comb.o
    rt_init_resource                    comb.o
    ld: fatal: Symbol referencing errors. No output written to .libs/comb
    collect2: ld returned 1 exit status

     
    • Sean Morrison
      Sean Morrison
      2007-11-23

      That's a new one to me.  Sounds like either a libtool bug or some mix of using gcc to compile and sunwspro to link perhaps, or simply the wrong flags to the linker line.  Two things to try would be to compile everything static and/or to rebuild the libtool script.  Compiling static will usually result in a massive build, but it should work.  Use the --disable-shared option to configure to force static compilation.  To recreate the libtool script, I'd suggest checking out the latest sources from BRL-CAD CVS ( instead of using the 7.10.2 source tarball ) as a starting point -- but regardless, the script will be rebuilt if you run ./autogen.sh before running the ./configure script.

      For what it's worth, we just posted a 7.10.4 binary for Solaris (32bit, Sparc).

      Cheers!
      Sean

       
    • I am also encountering this problem with the latest version of BRLCAD (7.12.0).

      I am trying to compile under Solaris 10 u4 x86.

      GNU gcc 3.4.3
      GNU gmake
      Solaris as, ld

      Has anyone managed to get BRLCAD compiled under Solaris 10 x86?