Chris Bartlett
Chris Bartlett

Reputation: 199

boost log with boost 1.48 on OSX 10.7.2

I pulled the latest BOOST log from https://boost-log.svn.sourceforge.net/svnroot/boost-log/trunk/ and tried building it against my current BOOST install (1.47) on osx lion (10.7.2) and it complained that it needed boost 1.48.

So I pulled down and built BOOST 1.48 which all went fine. I then updated my BOOST install , and ran bootstrap like this:

/bootstrap.sh --with-libraries=log --prefix=/usr/local 
    --includedir=/usr/local/include --libdir=/usr/local/lib

all fine at this point. Now however, when I run:

sudo ./b2

I get the following errors:

...found 2606 targets...
...updating 9 targets...
darwin.compile.c++ bin.v2/libs/log/build/darwin-4.2.1/release/threading-multi/tick_count.o
libs/log/src/tick_count.cpp:220:5: error: #error Boost.Log: POSIX timers not 
supported on your platform

"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -dynamic 
-no-cpp-    precomp -gdwarf-2 -fexceptions -fPIC  -DBOOST_ALL_NO_LIB=1
DBOOST_DATE_TIME_DYN_LINK=1 - DBOOST_FILESYSTEM_DYN_LINK=1 
-DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_DLL - DBOOST_LOG_USE_NATIVE_SYSLOG=1 
-DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_POSIX - DBOOST_THREAD_USE_DLL=1 -
DDATE_TIME_INLINE -DNDEBUG  -I"." -c -o  "bin.v2/libs/log/build/darwin-4.2.1/release/threading-multi/tick_count.o"  "libs/log/src/tick_count.cpp"

...failed darwin.compile.c++ bin.v2/libs/log/build/darwin-4.2.1/release/threading-multi/tick_count.o...
...skipped <pbin.v2/libs/log/build/darwin-4.2.1/release/threading-multi>libboost_log.dylib for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/threading-multi>tick_count.o...
...skipped <pstage/lib>libboost_log.dylib for lack of <pbin.v2/libs/log/build/darwin- 4.2.1/release/threading-multi>libboost_log.dylib...
...skipped <pbin.v2/libs/log/build/darwin-4.2.1/release/threading-multi>libboost_log_setup.dylib for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/threading-multi>libboost_log.dylib...
...skipped <pstage/lib>libboost_log_setup.dylib for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/threading-multi>libboost_log_setup.dylib...
darwin.compile.c++ bin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi/tick_count.o
libs/log/src/tick_count.cpp:220:5: error: #error Boost.Log: POSIX timers not supported on  your platform

"g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -no-cpp-precomp -gdwarf-2 -fexceptions  -DBOOST_ALL_NO_LIB=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_NATIVE_SYSLOG=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG  -I"." -c -o "bin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi/tick_count.o" "libs/log/src/tick_count.cpp"

...failed darwin.compile.c++ bin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi/tick_count.o...
...skipped <pbin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi>libboost_log.a(clean) for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi>tick_count.o...
...skipped <pbin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi>libboost_log.a for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi>tick_count.o...
...skipped <pstage/lib>libboost_log.a for lack of <pbin.v2/libs/log/build/darwin-4.2.1/release/link-static/threading-multi>libboost_log.a...
...failed updating 2 targets...
...skipped 7 targets...

I looked at the BOOST log install stuff and there are a few directives but nothing obvious about this. Anyone give me a few clues about this? I'm finding nothing in stack overflow or on the web which does make me think i'm missing something. The posix timers not being supported is a pretty definitive message...

thanks in advance.

Upvotes: 3

Views: 1728

Answers (2)

mavam
mavam

Reputation: 12552

This issue has been fixed in r655.

The problem is that Darwin does not feature the POSIX extension which provides clock_gettime(). However, Darwin does have a high-resolution monotic clock available in mach/mach_time.h called mach_absolute_time(). As of r655, Boost Log uses this function on Mac OS.

If you want to install the most recent Boost version without any pain, plus enjoy the benefits of C++11, check out my custom Portfile. For example, it allows you to install Boost as follows:

sudo port install boost +cxx11 +log +debug +no_single

where the +log variant pulls the most recent SVN version.

Upvotes: 2

alanxz
alanxz

Reputation: 2026

Briefly looking at the code it appears boost-log wasn't written to support Mac OS X which does not have an an implementation of Posix timers.

Upvotes: 1

Related Questions