Boost logo

Boost Users :

From: Michael Haubenwallner (michael.haubenwallner_at_[hidden])
Date: 2005-09-10 00:43:07


damn, forget it, my fault, sorry:

as i said, i built boost with -pthread.
But the application using boost was built without -pthread.
Then i added "std::" to the localtime_r/gmtime_r calls in c_time.hpp.
So, the error-message that localtime_r/gmtime_r are not found in
namespace 'std' is incorrect. The error-message i got first was:

/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp:52: error: `
   localtime_r' undeclared (first use this function)

Then i had to add '-pthread' to my application-build, and it worked.

Can't say if a missing '-pthread' flag at application side should be handled
in boost when boost is built with '-pthread'.

~haubi

Michael Haubenwallner wrote:
> Hi,
>
> There's a problem on HP-UX (especially hppa2.0w-hp-hpux11.11) with gcc-3.3.6,
> where localtime_r and gmtime_r are not in namespace std.
>
> boost-1.33 itself is built with "<cxxflags>-pthread/<linkflags>-pthread"
>
> $ cat xx.cc
> #include <boost/date_time/posix_time/posix_time_system.hpp>
>
> $ g++ -pthread xx.cc
> In file included from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/date_clock_device.hpp:12,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/gregorian/gregorian_types.hpp:26,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/posix_time/posix_time_config.hpp:14,
> from /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/posix_time/posix_time_system.hpp:13,
> from xx.cc:1:
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp: In
> static member function `static tm* boost::date_time::c_time::localtime(const
> time_t*, tm*)':
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp:56: error: `
> localtime_r' undeclared in namespace `std'
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp: In
> static member function `static tm* boost::date_time::c_time::gmtime(const
> time_t*, tm*)':
> /tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/boost/include/boost/date_time/c_time.hpp:64: error: `
> gmtime_r' undeclared in namespace `std'
> $
>
> $ gcc -v
> Reading specs from /mnt/toolsjunk/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.6/specs
> Configured with: /mnt/toolsjunk/snapshot/src/sasrvb/toolsbox-3.5.0.16rc.20050904/buildroot/gcc/gcc-3.3.6/configure --with-gnu-as --with-as=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX/hppa2.0w-hp-hpux11.11/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix --with-local-prefix=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX --disable-nls --prefix=/tools/snapshot/toolsbox-3.5.0.16rc.20050904/HP-UX
> Thread model: posix
> gcc version 3.3.6
>
> Two maybe interesting notes:
>
> 1)
> /usr/include/time.h only declares localtime_r/gmtime_r if '-pthread'
> compiler-flag is used (and therefore _REENTRANT is defined).
>
> 2)
> gcc-shipped <ctime> does not pull localtime_r/gmtime_r into namespace std
>
> Thanks!
>
> ~haubi

-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:michael.haubenwallner_at_[hidden]  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net