Opened 10 years ago

Closed 9 years ago

#6918 closed Bugs (fixed)

Boost Chrono compilation failure on HP uX due to undefined pthread_getcpuclockid

Reported by: Claudio Bantaloukas <rockdreamer@…> Owned by: viboes
Milestone: Boost 1.56.0 Component: chrono
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

I'm getting the following

acc.compile.c++ bin.v2/libs/chrono/build/acc/release/address-model-64/link-static/threading-multi/thread_clock.o
"./boost/chrono/detail/inlined/posix/thread_clock.hpp", line 34: error #2020: identifier "pthread_getcpuclockid" is undefined
          pthread_getcpuclockid(pth, &clock_id);
          ^

"./boost/chrono/detail/inlined/posix/thread_clock.hpp", line 60: error #2020: identifier "pthread_getcpuclockid" is undefined
          pthread_getcpuclockid(pth, &clock_id);
          ^

2 errors detected in the compilation of "libs/chrono/src/thread_clock.cpp".

    aCC -AA -c    -DBOOST_ALL_NO_LIB=1 -DBOOST_All_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -O3 +DD64 -mt  -I"." -I"/home/ebaxct02/hudson/workspace/tff-sdk-trunk-hpux-64bit/build/src/zlib" -I"/home/ebaxct02/hudson/workspace/tff-sdk-trunk-hpux-64bit/src/bzip2" -I"/home/ebaxct02/hudson/workspace/tff-sdk-trunk-hpux-64bit/src/zlib"  -o "bin.v2/libs/chrono/build/acc/release/address-model-64/link-static/threading-multi/thread_clock.o" "libs/chrono/src/thread_clock.cpp"

...failed acc.compile.c++ bin.v2/libs/chrono/build/acc/release/address-model-64/link-static/threading-multi/thread_clock.o...

Compiler version is aCC: HP C/aC++ B3910B A.06.20 [May 13 2008]

Attachments (2)

6918.patch (514 bytes ) - added by viboes 10 years ago.
config.hpp.patch (439 bytes ) - added by artem.goncharov@… 10 years ago.
this patch helped me to get it complied and working with GCC on HP-UX

Download all attachments as: .zip

Change History (20)

comment:1 by Claudio Bantaloukas <rockdreamer@…>, 10 years ago

I have already tried adding #include <pthread.h> as per ticket #6666

comment:2 by viboes, 10 years ago

Could you tell me which defines to use to check for HP compiler/pthread library used?

comment:3 by viboes, 10 years ago

BTW,

could you try defining BOOST_CHRONO_THREAD_DISABLED?

comment:4 by viboes, 10 years ago

Status: newassigned

in reply to:  2 comment:5 by Claudio Bantaloukas <rockdreamer@…>, 10 years ago

Replying to viboes:

Could you tell me which defines to use to check for HP compiler/pthread library used?

sure, the compiler macro according to predef is __HP_aCC and the OS macro is __hpux

Testing for this combination should be equivalent for testing for HP-UX phtread implementation presence

Do note that I am currently compiling in gcc emulation mode so __GNUC__ is also defined. I know there's gcc for hp.ux but I'm unsure if it uses hp-ux pthread implementation or something else.

in reply to:  3 comment:6 by Claudio Bantaloukas <rockdreamer@…>, 10 years ago

Replying to viboes:

BTW,

could you try defining BOOST_CHRONO_THREAD_DISABLED?

sure, I added cxxflags=-DBOOST_CHRONO_THREAD_DISABLED to the bjam invocation and chrono and timer were built without errors.

What feature am I missing when this macro is defined?

comment:7 by viboes, 10 years ago

Boost.Chrono try to see if there are thread clocks using some compiler flags. For what you mention, it seams that there is no support for thread clocks on use pthread library. When you define BOOST_CHRONO_THREAD_DISABLED this inspection is disabled.

by viboes, 10 years ago

Attachment: 6918.patch added

comment:8 by viboes, 10 years ago

Could you tell me if the attached patch solves the issue?

comment:9 by viboes, 10 years ago

Milestone: To Be DeterminedBoost 1.51.0

Committed in trunk revision [79324].

Last edited 10 years ago by viboes (previous) (diff)

comment:10 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

Committed revision [79371].

Last edited 10 years ago by viboes (previous) (diff)

comment:11 by artem.goncharov@…, 10 years ago

I'm not able to compile boost 1.52 with gcc (tried 4.6.3, 4.7.2) with the same error

./boost/chrono/detail/inlined/posix/thread_clock.hpp: In static member function ‘static boost::chrono::thread_clock::time_point boost::chrono::thread_clock::now()’:
./boost/chrono/detail/inlined/posix/thread_clock.hpp:34:45: error: ‘pthread_getcpuclockid’ was not declared in this scope
./boost/chrono/detail/inlined/posix/thread_clock.hpp: In static member function ‘static boost::chrono::thread_clock::time_point boost::chrono::thread_clock::now(boost::system::error_code&)’:
./boost/chrono/detail/inlined/posix/thread_clock.hpp:60:45: error: ‘pthread_getcpuclockid’ was not declared in this scope
Last edited 10 years ago by viboes (previous) (diff)

by artem.goncharov@…, 10 years ago

Attachment: config.hpp.patch added

this patch helped me to get it complied and working with GCC on HP-UX

in reply to:  11 comment:12 by viboes, 10 years ago

Replying to artem.goncharov@…:

I'm not able to compile boost 1.52 with gcc (tried 4.6.3, 4.7.2) with the same error

./boost/chrono/detail/inlined/posix/thread_clock.hpp: In static member function ‘static boost::chrono::thread_clock::time_point boost::chrono::thread_clock::now()’:
./boost/chrono/detail/inlined/posix/thread_clock.hpp:34:45: error: ‘pthread_getcpuclockid’ was not declared in this scope
./boost/chrono/detail/inlined/posix/thread_clock.hpp: In static member function ‘static boost::chrono::thread_clock::time_point boost::chrono::thread_clock::now(boost::system::error_code&)’:
./boost/chrono/detail/inlined/posix/thread_clock.hpp:60:45: error: ‘pthread_getcpuclockid’ was not declared in this scope

With which platform are you getting these errors? Which PThread library are you using? Which defines could be checked to identify it?

Last edited 10 years ago by viboes (previous) (diff)

comment:13 by artem.goncharov@…, 10 years ago

GCC on the HPUX. As mentioned in the patch - the initial problem is not aCC compiler problem, but the platform itself. I have extended initial patch to disable macroses also for GCC/hpux, but might be, that it is necessary to apply fix in case of hpux platform in general.

comment:14 by anonymous, 9 years ago

I'm facing the same issue as described above;

boost 1.55 platform: hp-ux 1131 compiler: gcc 4.6.3

The described "config patch" works fine ! Was the fix reported 10 months ago lost, and not merged into the trunk ?

in reply to:  14 comment:15 by viboes, 9 years ago

Resolution: fixed
Status: closedreopened

Replying to anonymous:

I'm facing the same issue as described above;

boost 1.55 platform: hp-ux 1131 compiler: gcc 4.6.3

The described "config patch" works fine ! Was the fix reported 10 months ago lost, and not merged into the trunk ?

I don't use to read the tickets that are already closed. artem.goncharov should had reported it by reopening the ticket or creating an additional one so that I could take care of it.

comment:16 by viboes, 9 years ago

Does the pacth of #9379 fixes this issue?

comment:18 by viboes, 9 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.