Builder v8 as a static library for Android

703 views
Skip to first unread message

Diep Nguyen Hoang

unread,
Sep 17, 2013, 5:50:06 AM9/17/13
to v8-u...@googlegroups.com
Hi, currently I'm trying to build v8 as a static library on Android.

I have successfully finished build command, and have libv8_base.arm.a, libv8_nosnapshot.arm.a, libv8_snapshot.a already. But when I put them into my project and compile, these .a file seems to be directly linked to the .o files, which are result of v8 building. I also notice that, size of these .a files is too small (about 1MB), and contains no object file but the absolute path to object file (using $ cat).

What I want is static library must contains all object files, not map to them, so I can push them to repository, is this right? I used default build command (make android_arm.release, OS: Ubuntu 12 and OS X). Now because the .a files just contain the paths, not objects themself, my project build command is failed.

Please help,
Thanks,

Ben Noordhuis

unread,
Sep 17, 2013, 8:48:56 AM9/17/13
to v8-u...@googlegroups.com
GYP builds thin archives by default on platforms that support it (the
GNU toolchain on Linux does, don't think OS X does.) You can disable
it by setting standalone_static_library: 1 in the *.gyp file that
builds the static library, e.g.:

'targets': [{
'target_name': 'foo',
'type': 'static_library',
'standalone_static_library': 1,
'sources': [ ... ]
}]

Good luck.

Diep Nguyen Hoang

unread,
Sep 17, 2013, 9:48:03 PM9/17/13
to v8-u...@googlegroups.com
I have edited my android.gypi like this:

['_type=="static_library"', {
            'ldflags': [
              # Don't export symbols from statically linked libraries.
              '-Wl,--exclude-libs=ALL',
            ],
    'standalone_static_library': 1, 
          }],

And it does not work, my output still 3MB libv8_base.arm.a with bunch of object file which do not merged into .a file.

Diep Nguyen Hoang

unread,
Sep 17, 2013, 10:47:19 PM9/17/13
to v8-u...@googlegroups.com
Updated: it works, thanks for your help!

wingsky fly

unread,
Sep 29, 2013, 11:03:22 PM9/29/13
to v8-u...@googlegroups.com
hi i compiled v8 as the method,but link the program comes error, so can you tell any more information about that...

在 2013年9月18日星期三UTC+8上午10时47分19秒,Diep Nguyen Hoang写道:

Diep Nguyen Hoang

unread,
Nov 11, 2013, 11:00:40 PM11/11/13
to v8-u...@googlegroups.com
Sorry for late reply, but what error you encountered?

wingsky fly

unread,
Nov 13, 2013, 12:21:06 AM11/13/13
to v8-u...@googlegroups.com
it is fine, i fixed,thanks you.


2013/11/12 Diep Nguyen Hoang <virusl...@gmail.com>

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to a topic in the Google Groups "v8-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/v8-users/cl2rPGbqsvQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dzung Tran

unread,
Jan 28, 2017, 1:10:02 PM1/28/17
to v8-users
Have you try using GN to build the libraries? I have issue linking with android code. Do you have instruction on include these v8 libraries into a Android project?

raoju...@gmail.com

unread,
May 2, 2017, 10:22:17 PM5/2/17
to v8-users
add  v8_static_library = true to gn.args will be worked.

在 2017年1月29日星期日 UTC+8上午2:10:02,Dzung Tran写道:
Reply all
Reply to author
Forward
0 new messages