V8 for Android undefined symbol v8::base::SysInfo::NumberOfProcessors()

279 views
Skip to first unread message

ibon tolosana

unread,
Oct 28, 2016, 7:12:38 AM10/28/16
to v8-users
Hi,

after successfully cross-compiling v8 for raspberry I am getting a linker error on both ubuntu16.04 and and CentOS 7.2.
I am getting this:

  CXX(host) /data/build/v8/out/android_arm.release/obj.host/mksnapshot/src/snapshot/mksnapshot.o
  LINK(host) /data/build/v8/out/android_arm.release/mksnapshot
/data/build/v8/out/android_arm.release/obj.host/src/libv8_libplatform.a(/data/build/v8/out/android_arm.release/obj.host/v8_libplatform/src/libplatform/default-platform.o):../src/libplatform/default-platform.cc:function v8::platform::CreateDefaultPlatform(int): error: undefined reference to 'v8::base::SysInfo::NumberOfProcessors()'
/data/build/v8/out/android_arm.release/obj.host/src/libv8_libplatform.a(/data/build/v8/out/android_arm.release/obj.host/v8_libplatform/src/libplatform/default-platform.o):../src/libplatform/default-platform.cc:function v8::platform::DefaultPlatform::SetThreadPoolSize(int): error: undefined reference to 'v8::base::SysInfo::NumberOfProcessors()'

I have checked /v8/out/android_arm.release/obj.host/v8_libbase/src/base/sys-info.o and NumberOfProcessors function is there. 
I have extracted sys-info.o from libv8_libbase.a and made sure NumberOfProcessors is referenced there, but the linker get undefined reference.

Since the snapshot is not important to me, I have tried to link with libv8_base.a libv8_libbase.a libv8_libplatform libv8_libsampler.a  and libv8_nosnapshot.a (instead of external snapshot) but i get the same undefined referenced symbol.

any ideas ? 
help please ^^

thanks.

- i

Rodolph Perfetta

unread,
Oct 28, 2016, 2:48:19 PM10/28/16
to v8-users
Hi,

I am not sure I follow what you are doing: if your cross compilation was successful why do you need to build and link mksnapshot again? Secondly cross compiling for raspberry will target arm linux, but the lines you posted reference android_arm. Did you intend to mix both target?

Rodolph

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ibon tolosana

unread,
Oct 28, 2016, 5:15:32 PM10/28/16
to v8-users
Hi Rodolph, sorry, I did not explain myself properly.
I compiled for pi successfully. As a different compilation. Nothing to do with this.

Now i try to compile v8 for android.
And i get that missing symbol.

Sorry for the misunderstanding.

thanks.

Rodolph Perfetta

unread,
Oct 29, 2016, 6:47:22 PM10/29/16
to v8-users
I see. I don't have experience with Android builds but have you checked the wiki: https://github.com/v8/v8/wiki/D8%20on%20Android

Rodolph

ibon tolosana

unread,
Nov 1, 2016, 4:06:37 PM11/1/16
to v8-users
Hi Rodolph,

yes, I did follow that instructions.
What surprises me most is that v8::base::SysInfo::NumberOfProcessors exists on the libv8_libplatform.a, but the linker seems to pass on it.

I fixed by defining the symbol myself though.
Thanks.

- ibon

ibon tolosana

unread,
Nov 3, 2016, 12:56:34 PM11/3/16
to v8-users
Fixed.

So it turns out it was a matter of the order of the libs handed to the linker.
Assuming after compilation different libs are created for base, platform, etc, the correct order in the .mk should be:
  1. base
    • (external_snapshot, snapshot) or (nosnapshot) depending on your needs
  2. libplatform
  3. libbase
  4. libsampler
With this, all linker symbols are found correctly:

LOCAL_STATIC_LIBRARIES := v8_base v8_nosnapshot v8_libplatform v8_libbase v8_libsampler

Thanks.

Dzung Tran

unread,
Jan 29, 2017, 11:25:35 AM1/29/17
to v8-users
Can you tell me where can I find this LOCAL_STATIC_LIBRARIES in v8 directory to modify?
I am getting the same error. I am surprise this is not fix in the v8 repo.

ibon tolosana

unread,
Jan 30, 2017, 2:15:00 PM1/30/17
to v8-users
Hi,

I fixed the problem by reordering the link libraries list. I used the following as the source for external libs (android.mk)

LOCAL_STATIC_LIBRARIES := v8_base v8_libplatform v8_libbase v8_libsampler v8_snapshot 

hope that helps.

- i
Reply all
Reply to author
Forward
0 new messages