Opened 9 years ago

Closed 9 years ago

#8961 closed Bugs (duplicate)

Android build error: 'posix_memalign' was not declared in this scope

Reported by: james.withers@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Problem
Keywords: android posix_memalign Cc:

Description

I was compiling for Android NDK 9 and I got the following error:

gcc.compile.c++ bin.v2/libs/log/build/gcc-android4.8/release/build-no/link-static/log-api-unix/runtime-link-static/threading-multi/threadsafe_queue.o
libs/log/src/threadsafe_queue.cpp: In static member function 'static void* boost::log::v2s_mt_posix::aux::threadsafe_queue_impl::operator new(std::size_t)':
libs/log/src/threadsafe_queue.cpp:174:36: error: 'posix_memalign' was not declared in this scope
     if (posix_memalign(&p, 64, size) || !p)

I fixed the problem by changing this block in libs/log/src/threadsafe_queue.cpp from:

#if !(defined(sun) || defined(__sun)) || defined(__SunOS_5_11) || defined(__SunOS_5_12)
#define BOOST_LOG_HAS_POSIX_MEMALIGN 1
#endif

to:

#if (!defined(__ANDROID__) && !(defined(sun)) || defined(__sun)) || defined(__SunOS_5_11) || defined(__SunOS_5_12)
#define BOOST_LOG_HAS_POSIX_MEMALIGN 1
#endif

Change History (3)

comment:1 by james.withers@…, 9 years ago

Keywords: android posix_memalign added

comment:2 by viboes, 9 years ago

Component: Nonelog
Owner: set to Andrey Semashev

comment:3 by Andrey Semashev, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicates #8815.

Note: See TracTickets for help on using tickets.