#26 SuSE 9.1 linux make fails - pthread problem

closed-fixed
Sean Morrison
5
2005-04-08
2005-03-21
Stefan
No

Building out of CVS fails with attached error messages.

Q: Where is the correct place to add the library link?

And are there other things to do when building on a linux box?

Thanks in advance for any hint,

/Stefan

Making all in librt
make[2]: Entering directory `/usr/local/src/brlcad/src/librt'
make all-am
make[3]: Entering directory `/usr/local/src/brlcad/src/librt'
/bin/sh ../../libtool --mode=link gcc -pipe -fno-strict-aliasing
-fno-common -fPIC -g -L/usr/X11R6/lib -pipe -fno-strict-aliasing
-fno-common -fPIC -g -o comb comb.o
librt.la ../../src/libbu/libbu.la
gcc -pipe -fno-strict-aliasing -fno-common -fPIC -g -pipe
-fno-strict-aliasing -fno-common -fPIC -g -o .libs/comb comb.o
-L/usr/X11R6/lib ./.libs/librt.so /sc/brlcad/src/libbn/.libs/libbn.so /sc/brlcad/src/libbu/.libs/libbu.so ../../src/libbu/.libs/libbu.so /sc/brlcad/src/other/libtcl/.libs/libtcl8.4.so
-ldl -lnsl -lz -lm -Wl,--rpath -Wl,/usr/brlcad/lib
/sc/brlcad/src/libbu/.libs/libbu.so: undefined reference to
`pthread_create'
/sc/brlcad/src/libbu/.libs/libbu.so: undefined reference to
`pthread_attr_setstacksize'
/sc/brlcad/src/libbu/.libs/libbu.so: undefined reference to
`pthread_join'
collect2: ld returned 1 exit status
make[3]: *** [comb] Fehler 1

Discussion

1 2 > >> (Page 1 of 2)
  • Stephen
    Stephen
    2005-03-22

    Logged In: YES
    user_id=1244195

    I confirm the pthreads linking error on Mandrake 10.1 when
    trying to link the 7.2.1 cvs .

    I do have a /usr/include/pthreads.h and /usr/include/pth.h

    I'd like a solution as I'm very curious about this package.

     
  • Sean Morrison
    Sean Morrison
    2005-03-22

    Logged In: YES
    user_id=785737

    This was very recently changed (and hopefully fixed) in the latest cvs. If
    you update and still have the pthread build problem, could you provide your
    config.log file? You can attach it to this bug report. That'll let me know
    what all failed to detect the library correctly on your system.

     
  • Sean Morrison
    Sean Morrison
    2005-03-22

    Logged In: YES
    user_id=785737

    By the way, the simple workaround for this should be to provide the
    pthread as a libs options to configure:

    ./configure --with-libs="-lpthread"
    make

     
  • Stefan
    Stefan
    2005-03-23

    Logged In: YES
    user_id=1243335

    Hello Sean,

    ./configure --with-libs="-lpthread" does take off the error
    messages and I was now able to start mged - thank you very much!

    ###########################

    The config.log says without "--with-libs...":

    ...
    configure:23313: checking for pthread_create in -lpthread
    configure:23375: result: yes
    ...
    configure:26202: checking for pthread.h
    configure:26207: result: yes
    ...
    configure:34053: checking for threading library availability
    configure:34055: result: yes
    configure:34059: checking if pthreading works
    configure:34091: gcc -o conftest -pipe
    -fno-strict-aliasing -fno-common -fPIC -g
    -I/usr/X11R6/include -I$(top_srcdir)/include
    -L/usr/X11R6/lib -pipe -fno-strict-aliasing -fno-common
    -fPIC -g conftest.c >&5
    /tmp/ccSQ0LvX.o(.text+0x37): In function `main':
    /sc/brlcad/conftest.c:182: undefined reference to
    `pthread_create'
    /tmp/ccSQ0LvX.o(.text+0x47):/sc/brlcad/conftest.c:183:
    undefined reference to `pthread_join'
    collect2: ld returned 1 exit status
    configure:34094: $? = 1
    configure: program exited with status 1
    configure: failed program was:
    | /* confdefs.h. */

     
  • Sean Morrison
    Sean Morrison
    2005-03-27

    Logged In: YES
    user_id=785737

    Thank you for the relevant config.log sections. I don't quite get why it
    failed to use -lpthread without using the --with-libs option. The test for the
    library that determines whether or not to add -lpthread actually succeeds
    (it's the first one). The last test that failed is presently unused (and just
    goes to show that the test is missing the lib dependency.

    The only thing that I can think of is that your version of the sources
    happened to be when that section of the code was actually changing quite
    a bit (which was about a week ago).. Could you try retesting with the
    latest CVS (clean new checkout without the --with-libs option) to see if the
    problem still remains?

     
  • Sean Morrison
    Sean Morrison
    2005-03-27

    • assigned_to: nobody --> brlcad
    • status: open --> pending
     
  • Stefan
    Stefan
    2005-03-28

    Logged In: YES
    user_id=1243335

    As requested, I cleaned my system and tried with a fresh copy
    out of the CVS - it failed again.

    When adding some debug info to the configure file, it looks like
    the $LIBS is empty:
    ...
    checking if pthreading works...
    #3###############################################
    CFLAGS: -pipe -fno-strict-aliasing -fno-common -fPIC -g
    #4#
    CPPFLAGS: -I/usr/X11R6/include -I$(top_srcdir)/include
    #5#
    LDLAGS: -L/usr/X11R6/lib -pipe -fno-strict-aliasing -fno-common
    -fPIC -g
    #6#
    LIBS:
    #7#
    configure:34363: "$CC -o conftest$ac_exeext $CFLAGS
    $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5"
    #8###############################################
    no
    checking for X... libraries /usr/X11R6/lib,
    headers /usr/X11R6/include

    thats the code I added to "configure" after "autogen.sh":

    ...
    rm -f conftest$ac_exeext
    echo
    echo
    "#3###############################################"
    echo "CFLAGS:" $CFLAGS
    echo "#4#"
    echo "CPPFLAGS:" $CPPFLAGS
    echo "#5#"
    echo "LDLAGS:" $LDFLAGS
    echo "#6#"
    echo "LIBS:" $LIBS
    echo "#7#"
    echo "$as_me:$LINENO: \"$ac_link\""
    echo
    "#8###############################################"
    if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
    ....

     
  • Stefan
    Stefan
    2005-03-28

    • status: pending --> open
     
  • Sean Morrison
    Sean Morrison
    2005-03-28

    Logged In: YES
    user_id=785737

    LIBS is supposed to be empty. Whether LIBTHREAD is set to anything is
    what really matters. src/libbu/Makefile.am (and hence src/libbu/Makefile)
    adds $LIBTHREAD to the libbu libs link list depending on the system.
    What is LIBTHREAD set to in the Makefile? It should be set to -lpthread
    and should get added to the libbu link line.

    By the way, that summary is already printed out in configure at the end.. :)

     
  • Sean Morrison
    Sean Morrison
    2005-04-08

    • status: open --> closed
     
1 2 > >> (Page 1 of 2)