strange / erlang_v8 Goto Github PK
View Code? Open in Web Editor NEWRun JavaScript from Erlang in an external OS process.
License: ISC License
Run JavaScript from Erlang in an external OS process.
License: ISC License
Sweet project!
Any particular reason to avoid a NIF in the first place, I did not benchmark but I think the ser/deser + packet_proc_loop will have a much higher overhead then a NIF call.
Also now you have rogue threads fighting for OS cores. In the NIF case, a process on an erlang scheduler would proc a V8 instance when appropriate.
Also managing the v8 contexts I assume is possible from erlang (and procing the js eventloop from erlang)? The google engineers did not make some ridiculous JS implementation that demands an event thread be given to solely it?
Thanks for your work on this module.
I'm trying to compile this using make
and this is the error I'm getting after adding the -vv
flag:
make[1]: Entering directory '/Users/me/myapp/deps/erlang_v8/deps/jsx'
make[1]: Leaving directory '/Users/me/myapp/deps/erlang_v8/deps/jsx'
make -C /Users/me/myapp/deps/erlang_v8/c_src
make[1]: Entering directory '/Users/me/myapp/deps/erlang_v8/c_src'
################################################################################
/usr/bin/python -u tools/mb/mb.py gen -f infra/mb/mb_config.pyl -m developer_default -b x64.release out.gn/x64.release
Writing """\
is_debug = false
target_cpu = "x64"
""" to /Users/me/myapp/deps/erlang_v8/build/v8/out.gn/x64.release/args.gn.
/Users/me/myapp/deps/erlang_v8/build/v8/buildtools/mac/gn gen out.gn/x64.release --check
-> returned 1
ERROR at //gni/v8.gni:116:3: Dependency not allowed.
executable(target_name) {
^------------------------
The item //:mkpeephole
can not depend on //build/config/sanitizers:deps
because it is not in //build/config/sanitizers:deps's visibility list: [
//build/config:exe_and_shlib_deps
]
GN gen failed: 1
Traceback (most recent call last):
File "./tools/dev/v8gen.py", line 304, in <module>
sys.exit(gen.main())
File "./tools/dev/v8gen.py", line 298, in main
return self._options.func()
File "./tools/dev/v8gen.py", line 166, in cmd_gen
gn_outdir,
File "./tools/dev/v8gen.py", line 208, in _call_cmd
stderr=subprocess.STDOUT,
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/usr/bin/python', '-u', 'tools/mb/mb.py', 'gen', '-f', 'infra/mb/mb_config.pyl', '-m', 'developer_default', '-b', 'x64.release', 'out.gn/x64.release']' returned non-zero exit status 1
make[1]: *** [Makefile:66: /Users/me/myapp/deps/erlang_v8/c_src/../priv/libv8_libbase.so] Error 1
make[1]: Leaving directory '/Users/me/myapp/deps/erlang_v8/c_src'
make: *** [erlang.mk:5841: app-c_src] Error 2
Any suggestions? Thanks again.
Error log is here. (failed once and redo log)
$ make
APP jsx.app.src
APP erlang_v8.app.src
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/mizchi/sandbox/testapp/deps/erlang_v8/c_src
# We need to link libstdc++ as XCode defaults to libc++, and use slightly
# different flags, on OS X. The following assumes Mavericks, XCode and
# default compiler (clang).
g++ -Iinclude erlang_v8.cc \
-stdlib=libstdc++ \
-o ../priv/erlang_v8 \
../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/out/x64.release/libv8_{base.x64,snapshot}.a \
../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/out/x64.release/libicu{uc,i18n,data}.a \
-I ../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/include \
-lpthread \
-v
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name erlang_v8.cc -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 242.2 -v -dwarf-column-info -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0 -I include -I ../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/include -stdlib=libstdc++ -fdeprecated-macro -fdebug-compilation-dir /Users/mizchi/sandbox/testapp/deps/erlang_v8/c_src -ferror-limit 19 -fmessage-length 116 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/3m/vd32gtbn0wv70jch09w3kw280000gp/T/erlang_v8-3d1500.o -x c++ erlang_v8.cc
clang -cc1 version 6.1.0 based upon LLVM 3.6.0svn default target x86_64-apple-darwin14.5.0
ignoring nonexistent directory "include"
ignoring nonexistent directory "/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
ignoring nonexistent directory "/usr/include/c++/4.0.0"
ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple-darwin8/"
ignoring nonexistent directory "/usr/include/c++/4.0.0/backward"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/include
/usr/include/c++/4.2.1
/usr/include/c++/4.2.1/backward
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
erlang_v8.cc:169:23: error: variable length array of non-POD element type 'Handle<v8::Value>'
Handle<Value> argz[len];
^
1 error generated.
make[2]: *** [../priv/erlang_v8] Error 1
make[1]: *** [app-c_src] Error 2
make: *** [all] Error 2
Two month ago, I did it but that hash 1ca13321d5746f3ec20f0c0bfd2bcc8293db71da
fails too today.
Hi. I was trying to compile elixir_v8
that depends on your erlang_v8
and it fails with the log below.
After I changed make v8
to make
in elixir_v8/deps/erlang_v8/rebar.confg
, it works fine. I'm new to erlang/elixir and not sure, but it seems some of make targets is missing/wrongly specified in your Makefile. How is it?
[pig@localhost elixir_v8]$ mix test
(...)
===> Compiling erlang_v8
make: *** No rule to make target 'v8'. Stop.
===> Hook for compile failed!
** (Mix) Could not compile dependency :erlang_v8, "/home/pig/.mix/rebar3 bare compile --paths "/home/pig/git/elixir_v8/_build/test/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile erlang_v8", update it with "mix deps.update erlang_v8" or clean it with "mix deps.clean erlang_v8"
since http://gyp.googlecode.com/svn/trunk is broken.
~/c/e/erlang_v8> make
APP jsx.app.src
APP erlang_v8.app.src
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C /Users/dyw/code/erlang-elixir/erlang_v8/c_src
svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
--revision 1831
svn: E175002: Unable to connect to a repository at URL 'http://gyp.googlecode.com/svn/trunk'
svn: E175002: OPTIONS of 'http://gyp.googlecode.com/svn/trunk': could not connect to server (http://gyp.googlecode.com)
make[3]: *** [dependencies] Error 1
make[2]: *** [../lib/v8-49744859536225e7ac3b726e5b019dd99e127e6f/build/gyp] Error 2
make[1]: *** [app-c_src] Error 2
make: *** [all] Error 2
make tests
finishes without error. But when I put meaningless lines in test/js/variables.js
to make its size larger, the test was failed with the following log.
[pig@localhost erlang_v8]$ ls -lh test/js/variables.js; make tests
-rw-r--r-- 1 pig pig 130K Feb 25 11:32 test/js/variables.js
make[1]: Entering directory '/home/pig/git/erlang_v8/deps/jsx'
make[1]: Leaving directory '/home/pig/git/erlang_v8/deps/jsx'
make[1]: Entering directory '/home/pig/git/erlang_v8/deps/ct_helper'
make[1]: Leaving directory '/home/pig/git/erlang_v8/deps/ct_helper'
GEN test-dir
make -C /home/pig/git/erlang_v8/c_src
make[1]: Entering directory '/home/pig/git/erlang_v8/c_src'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/pig/git/erlang_v8/c_src'
GEN ct
Common Test v1.13 starting (cwd is /home/pig/git/erlang_v8)
CWD set to: "/home/pig/git/erlang_v8/logs/[email protected]_11.35.48"
TEST INFO: 1 test(s), 14 case(s) in 1 suite(s)
Testing git.erlang_v8.port_SUITE: Starting test, 14 test cases
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
port_SUITE:init_from_file failed on line 220
Reason: {badmatch,{error,vm_unresponsive}}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Testing git.erlang_v8.port_SUITE: *** FAILED test case 9 of 14 ***
Testing git.erlang_v8.port_SUITE: TEST COMPLETE, 13 ok, 1 failed of 14 test cases
Updating /home/pig/git/erlang_v8/logs/index.html ... done
Updating /home/pig/git/erlang_v8/logs/all_runs.html ... done
make: *** [erlang.mk:6145: ct] Error 1
Is there any way to control the limitation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.