Android Build Error or OSX: undeclared identifier '__NR_gettid' ?

795 views
Skip to first unread message

Jean-Philippe Déry

unread,
Jul 27, 2014, 7:54:16 PM7/27/14
to v8-u...@googlegroups.com

Hi,

I’ve been trying to build V8 for android following the wiki entries here https://code.google.com/p/v8/wiki/BuildingWithGYP and here https://code.google.com/p/v8/wiki/D8OnAndroid.


After cloning v8 from the github repo and doing

make builders

make arm.release


I’m able to compile . However, after cloning a new repository and doing:

make dependencies

make android_arm.release


I’m getting this error:

CXX(host) /Users/jpdery/Downloads/v8/out/android_arm.release/obj.host/icui18n/third_party/icu/source/i18n/anytrans.o

../src/base/platform/platform-posix.cc:325:35: error: use of undeclared identifier '__NR_gettid'

  return static_cast<int>(syscall(__NR_gettid));


I’ve not been able to find help online. Does anyone knows why I’m getting this error ?


I’ve install the SKD and NDK and set $ANDROID_NDK_ROOT property as well as adding the repo_tools to my path.


Any ideas ?


Thank you!

ja...@chromium.org

unread,
Jul 28, 2014, 6:00:25 AM7/28/14
to v8-u...@googlegroups.com
The gettid syscall is only used for experimental support of the Linux perf tool, so as a quick workaround it should be fine to replace syscall(__NR_gettid) with 0.

Out of curiosity, could you try to replace __NR_gettid with SYS_gettid? You could also try to replace syscall(__NR_gettid) with gettid(). We previously had trouble compiling SYS_gettid with Android, but __NR_gettid has been working fine with the Linux version of Android NDK/SDK. It looks like the root problem is that we are compiling the host version with the ANDROID macro defined - I will have a look whether we can fix this in the build.

Jean-Philippe Déry

unread,
Jul 28, 2014, 9:02:36 AM7/28/14
to v8-u...@googlegroups.com
Replacing __NR_gettid with SYS_gettid didn't do much better as it fails with this error:

./src/base/platform/platform-posix.cc: In static member function 'static int v8::base::OS::GetCurrentThreadId()':
../src/base/platform/platform-posix.cc:325:35: error: 'SYS_gettid' was not declared in this scope
../src/base/platform/platform-posix.cc: In constructor 'v8::base::Thread::Thread(const v8::base::Thread::Options&)':
../src/base/platform/platform-posix.cc:518:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]


And using  return static_cast<int>(gettid()) triggered:

../src/base/platform/platform-posix.cc:325:27: error: use of undeclared identifier 'gettid'
return static_cast<int>(gettid());

However, good old return 0 did succeed!

Thank you very much for your help, I would not have been able to find it by myself!
Reply all
Reply to author
Forward
0 new messages