LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

If I just want to use js module but not other. I can compile myself v8, how can I do? #25

Closed jellychen closed 7 years ago

ericwlange commented 7 years ago

As mentioned in README.md:

The Node.js library (libnode.so) is pre-compiled and included in binary form in LiquidCoreAndroid/jni/lib/**/libnode.so, where ** represents the ABI. All of the modifications required to produce the library are included in deps/node-6.10.2. To build each library (if you so choose), you can do the following:

.../LiquidCore/deps/node-6.10.2% ./android-configure /path/to/android/ndk <abi>
.../LiquidCore/deps/node-6.10.2% make

where <abi> is one of arm, arm64, x86 or x86_64

You can include libnode.so in your project. It includes the V8 library (as well as node, but node is actually quite small -- the bulk of library is V8)

jellychen commented 7 years ago

libnode is too big~~ I just want v8 java bridger......

ericwlange commented 7 years ago

Yup. V8 is big. The vast majoroty of node is V8.

On Sat, Apr 29, 2017 at 7:12 PM Guodong Chen notifications@github.com wrote:

libnode is too big~~ I just want v8 java bridger......

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/25#issuecomment-298169762, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIuZBXw5BpdppXSWV2ETvtTcA5rD7IUks5r0z5QgaJpZM4NMFR4 .

ericwlange commented 7 years ago

If you are looking for just a bridge to the V8 installed on the device, I don't think it will work. I looked into this in the past. You never know which version is on any given device. The API changes constantly. You have to install your own version, which is what is in libnode.

On Sat, Apr 29, 2017 at 7:19 PM Eric Lange eric@flicket.tv wrote:

Yup. V8 is big. The vast majoroty of node is V8.

On Sat, Apr 29, 2017 at 7:12 PM Guodong Chen notifications@github.com wrote:

libnode is too big~~ I just want v8 java bridger......

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/25#issuecomment-298169762, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIuZBXw5BpdppXSWV2ETvtTcA5rD7IUks5r0z5QgaJpZM4NMFR4 .

jellychen commented 7 years ago

I compile myself v8 for android only 7 ~8MB size, So how can I use your code link with myself compiled v8. I just want to a bridge with java and v8. So how can I do this ?

ericwlange commented 7 years ago

My library includes a copy for 4 different architectures: armv7, arm64, x86 and x86_64. See the other open issue for a discussion.

On Sat, Apr 29, 2017 at 7:26 PM Guodong Chen notifications@github.com wrote:

I compile myself v8 for android only 7 ~8MB size, So how can I use your code link with myself compiled v8. I just want to a bridge with java and v8. So how can I do this ?

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/25#issuecomment-298170519, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIuZIZDbz78snm39mgeADouWdToojpzks5r00GCgaJpZM4NMFR4 .

jellychen commented 7 years ago

yes It include too much things, I just want to the part of bridge

ericwlange commented 7 years ago

It is interesting. Here is a list of the generated static libraries:

-rw-r--r--  1 eric  staff     9542 Apr 16 10:18 ./obj.target/deps/cares/libcares.a
-rw-r--r--  1 eric  staff    34670 Apr 16 10:03 ./obj.target/deps/gtest/libgtest.a
-rw-r--r--  1 eric  staff      614 Apr 16 10:04 ./obj.target/deps/http_parser/libhttp_parser.a
-rw-r--r--  1 eric  staff   221122 Apr 16 10:04 ./obj.target/deps/openssl/libopenssl.a
-rw-r--r--  1 eric  staff    11248 Apr 16 10:04 ./obj.target/deps/uv/libuv.a
-rw-r--r--  1 eric  staff  1964854 Apr 16 10:18 ./obj.target/deps/v8/tools/gyp/libv8_base.a
-rw-r--r--  1 eric  staff    12222 Apr 16 10:18 ./obj.target/deps/v8/tools/gyp/libv8_libbase.a
-rw-r--r--  1 eric  staff     5248 Apr 16 10:04 ./obj.target/deps/v8/tools/gyp/libv8_libplatform.a
-rw-r--r--  1 eric  staff     2912 Apr 16 10:18 ./obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a
-rw-r--r--  1 eric  staff   118926 Apr 16 10:32 ./obj.target/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/libv8_inspector_stl.a
-rw-r--r--  1 eric  staff     3944 Apr 16 10:32 ./obj.target/deps/zlib/libzlib.a

None of those libraries are very big. And even when I look at the node object files, it doesn't explain why the final .so is so big:

-rw-r--r--  1 eric  staff  1232212 Apr 16 10:33 ./obj.target/node/gen/node_javascript.o
-rw-r--r--  1 eric  staff    26212 Apr 16 10:32 ./obj.target/node/src/async-wrap.o
-rw-r--r--  1 eric  staff      860 Apr 16 10:33 ./obj.target/node/src/backtrace_posix.o
-rw-r--r--  1 eric  staff   115404 Apr 16 10:32 ./obj.target/node/src/cares_wrap.o
-rw-r--r--  1 eric  staff     7504 Apr 16 10:32 ./obj.target/node/src/connect_wrap.o
-rw-r--r--  1 eric  staff    21460 Apr 16 10:32 ./obj.target/node/src/connection_wrap.o
-rw-r--r--  1 eric  staff    16272 Apr 16 10:32 ./obj.target/node/src/debug-agent.o
-rw-r--r--  1 eric  staff     2884 Apr 16 10:32 ./obj.target/node/src/env.o
-rw-r--r--  1 eric  staff    13188 Apr 16 10:32 ./obj.target/node/src/fs_event_wrap.o
-rw-r--r--  1 eric  staff    11512 Apr 16 10:32 ./obj.target/node/src/handle_wrap.o
-rw-r--r--  1 eric  staff    94308 Apr 16 10:33 ./obj.target/node/src/inspector_agent.o
-rw-r--r--  1 eric  staff    19772 Apr 16 10:33 ./obj.target/node/src/inspector_socket.o
-rw-r--r--  1 eric  staff    39964 Apr 16 10:32 ./obj.target/node/src/js_stream.o
-rw-r--r--  1 eric  staff   148064 Apr 16 10:32 ./obj.target/node/src/node.o
-rw-r--r--  1 eric  staff   131824 Apr 16 10:32 ./obj.target/node/src/node_buffer.o
-rw-r--r--  1 eric  staff     2292 Apr 16 10:32 ./obj.target/node/src/node_config.o
-rw-r--r--  1 eric  staff    49024 Apr 16 10:32 ./obj.target/node/src/node_constants.o
-rw-r--r--  1 eric  staff    44936 Apr 16 10:32 ./obj.target/node/src/node_contextify.o
-rw-r--r--  1 eric  staff   593064 Apr 16 10:33 ./obj.target/node/src/node_crypto.o
-rw-r--r--  1 eric  staff    10252 Apr 16 10:33 ./obj.target/node/src/node_crypto_bio.o
-rw-r--r--  1 eric  staff     2376 Apr 16 10:33 ./obj.target/node/src/node_crypto_clienthello.o
-rw-r--r--  1 eric  staff    95092 Apr 16 10:32 ./obj.target/node/src/node_file.o
-rw-r--r--  1 eric  staff    48236 Apr 16 10:32 ./obj.target/node/src/node_http_parser.o
-rw-r--r--  1 eric  staff      764 Apr 16 10:32 ./obj.target/node/src/node_i18n.o
-rw-r--r--  1 eric  staff    15224 Apr 16 10:32 ./obj.target/node/src/node_os.o
-rw-r--r--  1 eric  staff     1768 Apr 16 10:32 ./obj.target/node/src/node_revert.o
-rw-r--r--  1 eric  staff    14624 Apr 16 10:32 ./obj.target/node/src/node_stat_watcher.o
-rw-r--r--  1 eric  staff    17132 Apr 16 10:32 ./obj.target/node/src/node_util.o
-rw-r--r--  1 eric  staff    11544 Apr 16 10:32 ./obj.target/node/src/node_v8.o
-rw-r--r--  1 eric  staff    11060 Apr 16 10:32 ./obj.target/node/src/node_watchdog.o
-rw-r--r--  1 eric  staff    65452 Apr 16 10:32 ./obj.target/node/src/node_zlib.o
-rw-r--r--  1 eric  staff    19980 Apr 16 10:32 ./obj.target/node/src/pipe_wrap.o
-rw-r--r--  1 eric  staff    25392 Apr 16 10:32 ./obj.target/node/src/process_wrap.o
-rw-r--r--  1 eric  staff    14192 Apr 16 10:32 ./obj.target/node/src/signal_wrap.o
-rw-r--r--  1 eric  staff    30156 Apr 16 10:32 ./obj.target/node/src/spawn_sync.o
-rw-r--r--  1 eric  staff    49132 Apr 16 10:33 ./obj.target/node/src/stream_base.o
-rw-r--r--  1 eric  staff    35576 Apr 16 10:33 ./obj.target/node/src/stream_wrap.o
-rw-r--r--  1 eric  staff    25588 Apr 16 10:33 ./obj.target/node/src/string_bytes.o
-rw-r--r--  1 eric  staff     1016 Apr 16 10:33 ./obj.target/node/src/string_search.o
-rw-r--r--  1 eric  staff    29388 Apr 16 10:33 ./obj.target/node/src/tcp_wrap.o
-rw-r--r--  1 eric  staff    16668 Apr 16 10:33 ./obj.target/node/src/timer_wrap.o
-rw-r--r--  1 eric  staff    64196 Apr 16 10:33 ./obj.target/node/src/tls_wrap.o
-rw-r--r--  1 eric  staff    16208 Apr 16 10:33 ./obj.target/node/src/tty_wrap.o
-rw-r--r--  1 eric  staff    39760 Apr 16 10:33 ./obj.target/node/src/udp_wrap.o
-rw-r--r--  1 eric  staff     9076 Apr 16 10:33 ./obj.target/node/src/util.o
-rw-r--r--  1 eric  staff    15360 Apr 16 10:33 ./obj.target/node/src/uv.o

I will look into this. But if you just want to use the v8 libraries, follow the directions to build node, but only use the .a libraries. See if that will work.

ericwlange commented 7 years ago

Ok. I just discovered that libnode.so contains all debugging symbols. That's why the file is bloated. arm-linux-androideabi-objdump --debugging lib.target/libnode.so > /var/tmp/foo.foo produced a 61 MB file!

I will figure out the flag to turn that off for the release version. As it happens, those debugging symbols have been very useful to me for, well, debugging. But I will thin out the release version.

jellychen commented 7 years ago

Ok, thanks>

But I Just want to use only V8 without libuv and others. How can I do it?

ericwlange commented 7 years ago

I don't know. That's not what this project is about.

On May 10, 2017 7:14 AM, "Guodong Chen" notifications@github.com wrote:

Ok, thanks>

But I Just want to use only V8 without libuv and others. How can I do it?

— You are receiving this because you were assigned.

Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/25#issuecomment-300376035, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIuZF9F1M2KVNFvi_HsWSER7AFN_zaMks5r4UfEgaJpZM4NMFR4 .