Opened 5 years ago

Closed 5 years ago

#13155 closed Bugs (fixed)

log doesn't build on a system with pthreads

Reported by: maxim.kartashev@… Owned by: viboes
Milestone: Boost 1.65.0 Component: thread
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:

Description

On Oracle Linux 7.3: sun.compile.c++ bin.v2/libs/log/build/sun/release/stdlib-sun-stlport/threading-m ulti/severity_level.o "./boost/thread/pthread/thread_data.hpp", line 53: Error: The function "getpages ize" must have a prototype. 1 Error(s) detected.

    "CC" -compat=5 -features=zla -library=stlport4 -xO4 -mt -erroff=%none -m64 -KPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_DYN_LINK=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_DATE_TIME_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_DLL -DBOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_WITHOUT_DEBUG_OUTPUT -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_DLL=1 -DDATE_TIME_INLINE -DNDEBUG -D_XOPEN_SOURCE=600 -D__STDC_CONSTANT_MACROS -D__typeof__=__typeof__ -I"." -I"libs/log/src" -c -o "bin.v2/libs/log/build/sun/release/stdlib-sun-stlport/threading-multi/severity_level.o" "libs/log/src/severity_level.cpp"

Log requests _XOPEN_SOURCE=600 (meaning the POSIX.1-2001 specification), yet at the same time, this removes the getpagesize() declaration (see getpagesize(2): "In SUSv2 the getpagesize() call is labeled LEGACY, and in POSIX.1-2001 it has been dropped").

This patch should fix the problem:

diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread
index 836e692..7bf360d 100644
--- a/include/boost/thread/pthread/thread_data.hpp
+++ b/include/boost/thread/pthread/thread_data.hpp
@@ -50,7 +50,7 @@ namespace boost
         // stack
         void set_stack_size(std::size_t size) BOOST_NOEXCEPT {
           if (size==0) return;
-          std::size_t page_size = getpagesize();
+          std::size_t page_size = ::sysconf( _SC_PAGESIZE);
 #ifdef PTHREAD_STACK_MIN
           if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
 #endif

Change History (4)

comment:3 by viboes, 5 years ago

Milestone: To Be DeterminedBoost 1.65.0
Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:4 by viboes, 5 years ago

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