[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug c++/26966]  New: linking of C++ app fail on OpenBSD 3.9 due POSIX threading unresolved symbols
From:       "kgardas at objectsecurity dot com" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2006-03-31 20:57:18
Message-ID: bug-26966-6105 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

Hello,
I've compiled 4.2.0 GCC on OpenBSD 3.9-current. I've configured it with:

/home/karel/svn/gcc/trunk/configure
--prefix=/home/karel/usr/local/gcc-trunk-20060331 --enable-shared
--enable-threads --enable-languages=c++ --disable-checking --disable-nls

the problem is that resulting C++ compiler is not able to build simple hello
world like application, since linking fails with:

$ c++ hello.cc                                                                  
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../. \
./libstdc++.a(locale-misc-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0x65):
 In function `int std::__convert_from_v<long double>(char*, int, char const*,
long double, int* const&, int)':
/home/karel/build/obj-gcc-trunk/i386-unknown-openbsd3.9/libstdc++-v3/include/i386-unknown-openbsd3.9/bits/c++locale.h:67:
                
warning: strcpy() is almost always misused, please use strlcpy()
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../. \
./libstdc++.a(locale-misc-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RK \
Pii+0x8c):/home/karel/build/obj-gcc-trunk/i386-unknown-openbsd3.9/libstdc++-v3/include/i386-unknown-openbsd3.9/bits/c++locale.h:74:
                
warning: sprintf() is often misused, please use snprintf()
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../../libstdc++.a(cp-demangle.o)(.text+0x3703):
 In function `d_demangle':
> warning: strcat() is almost always misused, please use strlcat()
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../../libstdc++.a(locale_init.o)(.text._ZNSt6locale13_S_initializeEv+0x2a):
 In function `std::locale::_S_initialize()':
/home/karel/svn/gcc/trunk/libstdc++-v3/src/locale_init.cc:145: undefined
reference to `pthread_once'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../. \
./libstdc++.a(eh_globals.o)(.text._Z41__static_initialization_and_destruction_0ii+0x4a):
 In function `__static_initialization_and_destruction_0(int, int)':
/home/karel/svn/gcc/trunk/libstdc++-v3/libsupc++/eh_globals.cc:97: undefined
reference to `pthread_key_create'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../../libstdc++.a(eh_globals.o)(.text.__cxa_get_globals_fast+0x71):
 In function `__cxa_get_globals_fast':
/home/karel/svn/gcc/trunk/libstdc++-v3/libsupc++/eh_globals.cc:150: undefined
reference to `pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../../libstdc++.a(eh_globals.o)(.text.__cxa_get_globals+0x71):
 In function `__cxa_get_globals':
/home/karel/svn/gcc/trunk/libstdc++-v3/libsupc++/eh_globals.cc:150: undefined
reference to `pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/../../../libstdc++.a(eh_globals.o)(.text.__cxa_get_globals+0xa9):
 In function `__cxa_get_globals':
/home/karel/build/obj-gcc-trunk/i386-unknown-openbsd3.9/libstdc++-v3/include/i386-unknown-openbsd3.9/bits/gthr-default.h:542:
 undefined reference to `pthread_setspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0xcf):
 In function `fc_key_init_once':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:516: undefined reference to
`pthread_once'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0xfd):
 In function `fc_key_init':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:524: undefined reference to
`pthread_key_create'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x1ab):
 In function `_Unwind_SjLj_Unregister':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:542: undefined reference to
`pthread_setspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x292):
 In function `uw_install_context':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:542: undefined reference to
`pthread_setspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x2dc):
 In function `_Unwind_SjLj_RaiseException':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x395):
 In function `_Unwind_SjLj_Register':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x3a6):/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:542:
 undefined reference to `pthread_setspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x3ee):
 In function `_Unwind_Backtrace':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x46a):
 In function `_Unwind_SjLj_Resume_or_Rethrow':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x4cf):
 In function `_Unwind_SjLj_Resume':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
/home/karel/usr/local/gcc-trunk-20060331/lib/gcc/i386-unknown-openbsd3.9/4.2.0/libgcc.a(unwind-sjlj.o)(.text+0x536):
 In function `_Unwind_SjLj_ForcedUnwind':
/home/karel/svn/gcc/trunk/gcc/gthr-posix.h:536: undefined reference to
`pthread_getspecific'
collect2: ld returned 1 exit status

If I add -lpthread to the command-line, then everything works as expected. The
same behaviour is also presented on 4.1.0 and 4.0.3 releases.

Cheers,
Karel


-- 
           Summary: linking of C++ app fail on OpenBSD 3.9 due POSIX
                    threading unresolved symbols
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kgardas at objectsecurity dot com
 GCC build triplet: i386-unknown-openbsd3.9
  GCC host triplet: i386-unknown-openbsd3.9
GCC target triplet: i386-unknown-openbsd3.9


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26966


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic