Re: Building boost for 64-bit on AIX [shared_ptr & single threading]

Patrik Jonsson wrote:
Rene Rivera wrote:
Well that's a single threaded library, it would have "threading-multi" in the path if it was multi threaded.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
It's likely that something other than Boost requires pthread. Could you find out what that is? It could be libstdc++, or something else..
It seems to be that boost/greg_month.hpp includes boost/shared_ptr.hpp, which uses boost/detail/shared_count.hpp which uses /boost/detail/lightweight_mutex.hpp. The pthread symbols are in greg_month.o, so it looks like that library won't work without threads or else something's supposed to turn threads off but isn't working...
Hmm... The only fix for this I can come up with is to add "<define>BOOST_LWM_USE_SPINLOCK", or probably more safely add "<linkflags>-pthread" to the BUILD. The current code, what's going to be 1.33, is rather different and is likely not to rely on pthreads on your platform. I think it uses native assembly in the GCC+PPC case. But more generally I would think that it should not generate *any* locking code when doing a single threaded build. I'm CC'ing the Boost list in the hope someone else can better resolve the problem. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

On Thu, May 26, 2005 at 03:10:56PM -0500, Rene Rivera wrote:
Patrik Jonsson wrote:
Rene Rivera wrote:
Well that's a single threaded library, it would have "threading-multi" in the path if it was multi threaded.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
It's likely that something other than Boost requires pthread. Could you find out what that is? It could be libstdc++, or something else..
[...] But more generally I would think that it should not generate *any* locking code when doing a single threaded build.
What happens if you build with BOOST_DISABLE_THREADS explicitly defined? Maybe the problem discussed in GCC PR#11953 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953> exists on AIX as well? (It's only a wil guess since (a) I haven't seen the thread Rene's posting belongs to and(b) I don't have access to an AIX system.) The effect of PR#11953 under Linux is similar to what you report: The standard library defines _REENTRANT in some header included by shared_ptr.hpp which makes the smart_ptr library require some pthread symbols - even if you do a single threaded build. AFAIK the only workaround is to define BOOST_DISABLE_THREADS. Regards Christoph -- http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html

Christoph Ludwig wrote:
On Thu, May 26, 2005 at 03:10:56PM -0500, Rene Rivera wrote:
Patrik Jonsson wrote:
Rene Rivera wrote:
Well that's a single threaded library, it would have "threading-multi" in the path if it was multi threaded.
ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_unlock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_lock ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_init ld: 0711-317 ERROR: Undefined symbol: .pthread_mutex_destroy
It's likely that something other than Boost requires pthread. Could you find out what that is? It could be libstdc++, or something else..
[...]
But more generally I would think that it should not generate *any* locking code when doing a single threaded build.
What happens if you build with BOOST_DISABLE_THREADS explicitly defined? Maybe the problem discussed in GCC PR#11953 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953> exists on AIX as well? (It's only a wil guess since (a) I haven't seen the thread Rene's posting belongs to and(b) I don't have access to an AIX system.)
It's a thread from the user list. But I quoted basically all of it.
The effect of PR#11953 under Linux is similar to what you report: The standard library defines _REENTRANT in some header included by shared_ptr.hpp which makes the smart_ptr library require some pthread symbols - even if you do a single threaded build. AFAIK the only workaround is to define BOOST_DISABLE_THREADS.
OK, read that PR. It certainly does look like the problem. Peter already suggested, in the user list, that using BOOST_DISABLE_THREADS is the way to "fix" it. Thanks :-) -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
participants (2)
-
Christoph Ludwig
-
Rene Rivera