Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10822 closed Bugs (fixed)

Boost.Thread fails to compile on Android

Reported by: Niall Douglas Owned by: Niall Douglas
Milestone: Boost 1.58.0 Component: thread
Version: Boost 1.57.0 Severity: Showstopper
Keywords: Cc:

Description

Unfortunately the fix for ticket #7716 of manually including asm/page.h has broken Boost.Thread on Android for the Android 5.0 NDK:

In file included from ./boost/thread/thread_only.hpp:17:0,

from libs/thread/src/pthread/thread.cpp:11:

./boost/thread/pthread/thread_data.hpp:28:81: fatal error: asm/page.h: No such file or directory

#include <asm/page.h> http://code.google.com/p/android/issues/detail?id=39983

compilation terminated.

This is because asm/page.h has gone away, and Android seems to dislike defining PAGE_SIZE anywhere when getpagesize() works perfectly well.

Vicente, if it's okay with you can I hard code PAGE_SIZE to 4096 on Android if it is not already defined by a system header? Then the problem goes away, forever.

Niall

Change History (6)

comment:1 by viboes, 8 years ago

Version: Boost 1.58.0Boost 1.57.0

Yes, please take care of this issue. what about checking for an Android version?

in reply to:  1 comment:2 by Niall Douglas, 8 years ago

Replying to viboes:

Yes, please take care of this issue. what about checking for an Android version?

It seems that some NDKs pull in a definition and some require you to pull in that asm/page.h header because it basically got left out by accident for a few NDK revisions. Android 5.0 seems to have fixed the problem, and now system headers define PAGE_SIZE like the oldest NDKs did.

Hence me thinking a simple #ifndef PAGE_SIZE as all current Android hardware has 4k page sizes.

comment:3 by viboes, 8 years ago

Couldn't the change be done conditionally depending on the version?

Please, do as you find it is more coherent.

comment:4 by Niall Douglas, 8 years ago

Resolution: fixed
Status: newclosed

comment:5 by eazyigz@…, 6 years ago

I am getting this error with boost 1_57 now. Is there a solution?

comment:6 by eazyigz@…, 5 years ago

I am getting this error with boost 1_57 and android-ndk-r16 with CMake 3.6.3155560 now. There has been an issue filed against this for android NDK, but there doesn't seem to be a fix: https://github.com/android-ndk/ndk/issues/302#issuecomment-300843092

Do you have a suggestion for a solution?

Note: See TracTickets for help on using tickets.