From: <nob...@an...> - 2009-07-27 02:30:30
|
Hi Matt, When static linking, the pthread stuff is due to the undefined pthread symbols in librt.a and libgcc_eh.a. make[4]: Entering directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/ipc/pipeio' cc -Wall -static -Wall -I../../../../include pipeio.c -L../../../../lib -lltp -lrt -o pipeio /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `cleanup': (.text+0xa): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `aio_suspend64': (.text+0x137): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `aio_suspend64': (.text+0x289): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `aio_suspend64': (.text+0x2e2): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `aio_suspend64': (.text+0x38e): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_suspend.o): In function `cleanup': (.text+0x97): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(lio_listio.o): In function `lio_listio_internal': (.text+0x5c): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(lio_listio.o): In function `lio_listio_internal': (.text+0x278): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(lio_listio.o): In function `lio_listio_internal': (.text+0x296): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(lio_listio.o): In function `lio_listio_internal': (.text+0x2d5): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(lio_listio.o): In function `lio_listio_internal': (.text+0x30f): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_notify.o): In function `__aio_notify_only': (.text+0x9c): undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_notify.o): In function `__aio_notify_only': (.text+0xc4): undefined reference to `pthread_attr_init' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_notify.o): In function `__aio_notify_only': (.text+0xd1): undefined reference to `pthread_attr_setdetachstate' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `aio_init': (.text+0x10a): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x191): undefined reference to `pthread_self' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x1a9): undefined reference to `pthread_getschedparam' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x1c6): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x2f5): undefined reference to `pthread_cond_signal' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x30a): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x3c4): undefined reference to `pthread_attr_init' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x3d1): undefined reference to `pthread_attr_setdetachstate' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x3de): undefined reference to `pthread_attr_setstacksize' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x414): undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x433): undefined reference to `pthread_attr_destroy' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `__aio_enqueue_request': (.text+0x58a): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x768): undefined reference to `pthread_self' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x77d): undefined reference to `pthread_getschedparam' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x7d6): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x8ad): undefined reference to `pthread_cond_signal' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x8b7): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0x903): undefined reference to `pthread_setschedparam' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xa9e): undefined reference to `pthread_attr_init' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xaab): undefined reference to `pthread_attr_setdetachstate' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xabf): undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xb65): undefined reference to `pthread_cond_timedwait' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xb8d): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `handle_fildes_io': (.text+0xbae): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(aio_misc.o): In function `aio_init': (.text+0x12c): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases': (.text+0x42): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases': (.text+0xbd): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE': (.text+0x157d): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE': (.text+0x15d1): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases': (.text+0x177c): undefined reference to `pthread_mutex_lock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases': (.text+0x1800): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases': (.text+0x61): undefined reference to `pthread_mutex_unlock' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases': (.text+0xdc): undefined reference to `pthread_mutex_unlock' collect2: ld returned 1 exit status make[4]: *** [pipeio] Error 1 make[4]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/ipc/pipeio' make[3]: *** [all] Error 2 make[3]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/ipc' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases' make: *** [all] Error 2 Also same here. make[4]: Entering directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/containers/pidns' cc -Wall -static -Wall -I../../../../include -I../libclone pidns30.c -L../../../../lib -L../libclone ../libclone/libclone.a -lltp -lrt -o pidns30 /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `mq_notify': (.text+0x8b): undefined reference to `pthread_once' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `change_sigmask': (.text+0x1ee): undefined reference to `pthread_sigmask' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x2b9): undefined reference to `pthread_barrier_init' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x379): undefined reference to `pthread_attr_init' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x386): undefined reference to `pthread_attr_setdetachstate' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x393): undefined reference to `pthread_attr_setstacksize' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x3b6): undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x3c5): undefined reference to `pthread_attr_destroy' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x3f6): undefined reference to `pthread_sigmask' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x406): undefined reference to `pthread_atfork' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `init_mq_netlink': (.text+0x417): undefined reference to `pthread_cancel' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `helper_thread': (.text+0x489): undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `helper_thread': (.text+0x497): undefined reference to `pthread_barrier_wait' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `notification_function': (.text+0x4bb): undefined reference to `pthread_barrier_wait' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `notification_function': (.text+0x4c0): undefined reference to `pthread_self' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../lib64/librt.a(mq_notify.o): In function `notification_function': (.text+0x4c8): undefined reference to `pthread_detach' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2.o): In function `uw_init_context_1': (.text+0x20a2): undefined reference to `pthread_cancel' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2.o): In function `uw_init_context_1': (.text+0x20b8): undefined reference to `pthread_once' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_bases': (.text+0x33): undefined reference to `pthread_cancel' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__register_frame_info_table_bases': (.text+0xae): undefined reference to `pthread_cancel' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `_Unwind_Find_FDE': (.text+0x156c): undefined reference to `pthread_cancel' /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/libgcc_eh.a(unwind-dw2-fde-glibc.o): In function `__deregister_frame_info_bases': (.text+0x176b): undefined reference to `pthread_cancel' collect2: ld returned 1 exit status make[4]: *** [pidns30] Error 1 make[4]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/containers/pidns' make[3]: *** [all] Error 2 make[3]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel/containers' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases/kernel' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/nobuhiro/git_repo/os/ltp/testcases' make: *** [all] Error 2 Thanks. Nobuhiro -----Original Message----- From: Matt Helsley [mailto:mat...@us...] Sent: Saturday, July 25, 2009 2:25 AM To: Shawn Hsin-Hung Lin(林信宏) Cc: ltp...@li... Subject: Re: [LTP] [PATCH] Fixed static build which needs to link thepthread library in pidns and pipeio. On Wed, Jul 22, 2009 at 10:22:05PM +0800, nobuhiro wrote: > > Signed-off-by: nobuhiro <nob...@an...> > --- > testcases/kernel/containers/pidns/Makefile | 2 +- > testcases/kernel/ipc/pipeio/Makefile | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/testcases/kernel/containers/pidns/Makefile > b/testcases/kernel/containers/pidns/Makefile > index 4886d58..14f49da 100644 > --- a/testcases/kernel/containers/pidns/Makefile > +++ b/testcases/kernel/containers/pidns/Makefile > @@ -20,7 +20,7 @@ > > CFLAGS += -Wall > CPPFLAGS += -I../../../../include -I../libclone -LDLIBS += > -L../../../../lib -L../libclone ../libclone/libclone.a -lltp -lrt > +LDLIBS += -L../../../../lib -L../libclone ../libclone/libclone.a > +-lltp -lrt -lpthread I'm not sure this is correct. I just did a CVS update and grepped for "pthread". I don't see a single use of pthreads in there. What output suggested all of these tests need to link to pthreads? Could you at least stick that in the changelog? > > SRCS := $(wildcard *.c) > TARGETS := $(SRCS:%.c=%) > diff --git a/testcases/kernel/ipc/pipeio/Makefile > b/testcases/kernel/ipc/pipeio/Makefile > index afd3e8d..d2a1d5f 100644 > --- a/testcases/kernel/ipc/pipeio/Makefile > +++ b/testcases/kernel/ipc/pipeio/Makefile > @@ -22,7 +22,7 @@ > ########################################################################### > CFLAGS += -Wall > CPPFLAGS += -I../../../../include > -LDLIBS += -L../../../../lib -lltp -lrt > +LDLIBS += -L../../../../lib -lltp -lrt -lpthread Same here. Cheers, -Matt Helsley |