boost-1.33, [date_time]: missing std::localtime_r/gmtime_r
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
On Fri, 09 Sep 2005 14:44:00 +0200, 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
$ 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
c_time.hpp is the only place where localtime_r and gmtime_r are used. Neither instance is preceded by a std::. Looking back through previous versions of c_time.hpp, also shows no usage preceded by a std::. I attempted your example and am unable to duplicate your error. I would suggest you check your copy of c_time.hpp against the one found in cvs (found here) http://tinyurl.com/9jrd2 Bart
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
$ 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@salomon.at http://www.salomon.at No HTML/MIME please, see http://expita.com/nomime.html
On Sat, 10 Sep 2005 07:43:07 +0200, Michael Haubenwallner wrote
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'.
Looks like we might need to do some work on the platform config for hpux.
Basically, if BOOST_HAS_THREADS is set date-time 'assumes' the platform has
the _r functions available. Looking at the config for hpux it looks like it
doesn't really setup BOOST_HAD_THREADS correctly. Looks like maybe the
config/platform/hpux.hpp should include the posix_features.hpp file like
solarias does. So you might try adding
#include
participants (3)
-
Bart
-
Jeff Garland
-
Michael Haubenwallner