Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't compile erlang_v8 #3

Closed
dongyuwei opened this issue Sep 7, 2016 · 19 comments
Closed

can't compile erlang_v8 #3

dongyuwei opened this issue Sep 7, 2016 · 19 comments
Assignees

Comments

@dongyuwei
Copy link

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
@strange
Copy link
Owner

strange commented Sep 7, 2016

Looks like you weren't able to connect to gyp.googlecode.com. You could try again.

If that fails, you can try to build the 'contexts' branch. It's not ready yet, but you can at-least see if that builds. I do not have a Mac here to test (but can ask HQ to send me one).

@dongyuwei
Copy link
Author

dongyuwei commented Sep 10, 2016

I use a ubuntu 14.04 in a VPS(located at Tokyo Japan) ,

svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
            --revision 1831
svn: E160013: Unable to connect to a repository at URL 'http://gyp.googlecode.com/svn/trunk'
svn: E160013: '/svn/trunk' path not found
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

I can confirm that http://gyp.googlecode.com/svn/trunk is broken since Google code doomed.

@dongyuwei
Copy link
Author

when switch to 'contexts' branch, I got:

/bin/sh: 1: build/gyp/gyp: not found                                                                 │
make[3]: *** [out/Makefile.x64.release] Error 127                                                    │
make[2]: *** [/root/code/erlang_v8/c_src/../lib/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a]│
 Error 2                                                                                             │
make[1]: *** [app-c_src] Error 2                                                                     │
make: *** [all] Error 2

@strange
Copy link
Owner

strange commented Sep 11, 2016

Ok. Thanks for the report. I'll take a look!

@strange
Copy link
Owner

strange commented Sep 11, 2016

I can confirm that I have the same problem on updated Arch. Looks like Google changed something.

@strange
Copy link
Owner

strange commented Sep 12, 2016

Ok, I've upgraded v8 and updated the build procedure.

Please try with the branch v8.5.5.149. I'd advice you to start clean to make sure no old files interfere.

git clone git@github.com:strange/erlang_v8
git checkout -b v8.5.5.149
git pull origin v8.5.5.149
make
make tests

Please let me know if that works for you.

@dongyuwei
Copy link
Author

when run make:

From https://chromium.googlesource.com/v8/v8
 * branch            07234f240d2c346ee00e6a1c5a57b6ae861be6b3 -> FETCH_HEAD
cd /root/code/erlang_v8/c_src/../lib/v8 && git reset --hard 07234f240d2c346ee00e6a1c5a57b6ae861be6b3
HEAD is now at 07234f2 Version 5.5.149

Hint: You can raise verbosity (-vv) to see the output of failed commands.

Traceback (most recent call last):
  File "./tools/dev/v8gen.py", line 297, in <module>
    sys.exit(gen.main())
  File "./tools/dev/v8gen.py", line 291, 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 "/usr/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[2]: *** [/root/code/erlang_v8/c_src/../lib/v8/out/x64.release/obj.target/src/libv8_base.a] Error 1
make[1]: *** [app-c_src] Error 2
make: *** [all] Error 2

@strange
Copy link
Owner

strange commented Sep 12, 2016

That's not a very helpful message. I can try on Ubuntu later, but in the meanwhile you could change line 71 in c_src/Makefile from:

@cd $(V8_DIR) && ./tools/dev/v8gen.py $(BUILD_ARCH).release

To:

@cd $(V8_DIR) && ./tools/dev/v8gen.py -vv $(BUILD_ARCH).release

That should give us some information on the error.

@dongyuwei
Copy link
Author

ok, this is the log after add the -vv flag:

APP    erlang_v8.app.src
make -C /root/code/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 /root/code/erlang_v8/lib/v8/out.gn/x64.release/args.gn.

  /root/code/erlang_v8/lib/v8/buildtools/linux64/gn gen out.gn/x64.release --check
    -> returned 1
  ERROR at //build/config/linux/pkg_config.gni:85:17: Script returned non-zero exit code.
      pkgresult = exec_script(pkg_config_script, args, "value")
                  ^----------
  Current dir: /root/code/erlang_v8/lib/v8/out.gn/x64.release/
  Command: python -- /root/code/erlang_v8/lib/v8/build/config/linux/pkg-config.py -s /root/code/erlang_v8/lib/v8/build/linux/debian_wheezy_amd64-sysroot -a x64 glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 
  Returned 1.
  stderr:

  Traceback (most recent call last):
    File "/root/code/erlang_v8/lib/v8/build/config/linux/pkg-config.py", line 219, in <module>
      sys.exit(main())
    File "/root/code/erlang_v8/lib/v8/build/config/linux/pkg-config.py", line 138, in main
      prefix = GetPkgConfigPrefixToStrip(args)
    File "/root/code/erlang_v8/lib/v8/build/config/linux/pkg-config.py", line 80, in GetPkgConfigPrefixToStrip
      env=os.environ)
    File "/usr/lib/python2.7/subprocess.py", line 566, in check_output
      process = Popen(stdout=PIPE, *popenargs, **kwargs)
    File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
      errread, errwrite)
    File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
      raise child_exception
  OSError: [Errno 2] No such file or directory

  See //build/config/linux/BUILD.gn:90:3: whence it was called.
    pkg_config("glib") {
    ^-------------------
  See //build/config/compiler/BUILD.gn:147:18: which caused the file to be included.
      configs += [ "//build/config/linux:compiler" ]
                   ^------------------------------
  GN gen failed: 1
Traceback (most recent call last):
  File "./tools/dev/v8gen.py", line 297, in <module>
    sys.exit(gen.main())
  File "./tools/dev/v8gen.py", line 291, 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 "/usr/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[2]: *** [/root/code/erlang_v8/c_src/../lib/v8/out/x64.release/obj.target/src/libv8_base.a] Error 1
make[1]: *** [app-c_src] Error 2
make: *** [all] Error 2

@dongyuwei
Copy link
Author

the OS info:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty

@strange
Copy link
Owner

strange commented Sep 13, 2016

Do you have pkg-config installed?

@strange strange self-assigned this Sep 13, 2016
@dongyuwei
Copy link
Author

dongyuwei commented Sep 13, 2016

You are right, after install pkg-config, code compiled successfully. Thank you very much!

but when doing some basic test, I get the following error:

erl -pa ebin/                                             
Erlang/OTP 19 [erts-8.0.2] [source-753b9b9] [64-bit] [async-threads:10] [hipe] [kern

Eshell V8.0.2  (abort with ^G)                                                      
1> {ok, VM} = erlang_v8:start_vm().                                                 
{ok,<0.59.0>}                                                                       
2> {ok, Context} = erlang_v8:create_context(VM).                                    
{ok,4}                                                                              
3> {ok, undefined} = erlang_v8:eval(VM, Context, <<"function sum(a, b) { return a + 

=ERROR REPORT==== 13-Sep-2016::13:24:47 ===                                         
** Generic server <0.59.0> terminating                                              
** Last message in was {eval,4,<<"function sum(a, b) { return a + b }">>,           
                             15000}                                                 
** When Server state == {state,<<>>,5242880,#Port<0.525>,<0.60.0>}                  
** Reason for termination ==                                                        
** {'module could not be loaded',                                                   
       [{jsx,encode,[#{source => <<"function sum(a, b) { return a + b }">>}],[]},   
        {erlang_v8_vm,handle_call,3,                                                
            [{file,"src/erlang_v8_vm.erl"},{line,102}]},                            
        {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,615}]},        
        {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,647}]},             
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}           
** exception exit: undef                                                            
     in function  jsx:encode/1                                                      
        called as jsx:encode(#{source => <<"function sum(a, b) { return a + b }">>})
     in call from erlang_v8_vm:handle_call/3 (src/erlang_v8_vm.erl, line 102)       
     in call from gen_server:try_handle_call/4 (gen_server.erl, line 615)           
     in call from gen_server:handle_msg/5 (gen_server.erl, line 647)                
     in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 247)

@strange
Copy link
Owner

strange commented Sep 13, 2016

Hmm. Maybe jsx failed to install for some reason.

Is jsx present in ./deps/? If yes, what happens if you run the following from the erlang_v8 directory?

erl -pa deps/**/ebin -run jsx encode "{}" -run init stop -noshell

@dongyuwei
Copy link
Author

jsx is present in ./deps/ dir. After I include the deps/**/ebin, the basic test has no problem now:

erl -pa deps/**/ebin -pa ./ebin/
Erlang/OTP 19 [erts-8.0.2] [source-753b9b9] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.0.2  (abort with ^G)
1> {ok, VM} = erlang_v8:start_vm().
{ok,<0.59.0>}
2> {ok, Context} = erlang_v8:create_context(VM).
{ok,4}
3>
3> {ok, undefined} = erlang_v8:eval(VM, Context, <<"function sum(a, b) { return a + b }">>).
{ok,undefined}
4> {ok, 2} = erlang_v8:call(VM, Context, <<"sum">>, [1, 1]).
{ok,2}

I'm sorry to interrupt you so many times. Thank you for your patient replies :)

@strange
Copy link
Owner

strange commented Sep 14, 2016

I'm very happy when people stop and ask questions instead of just moving on.

I guess the initial issue has been resolved, but the path should be set for you automatically when you run make tests.

Also note that this branch is still being tested. It will merge into master (the API is frozen), but we're not using this in production yet.

Most notable shortcomings:

  • The timeout for time spent inside the vm is hardcoded (will add configuration soon)
  • The documentation is not yet up to date

@strange
Copy link
Owner

strange commented Sep 14, 2016

Ah, what is the full path to the project?

@dongyuwei
Copy link
Author

dongyuwei commented Sep 14, 2016

yes, I also noticed the document is not up to date.
And my local project path is /root/code/erlang_v8/, if you need to know it.

@strange
Copy link
Owner

strange commented Sep 21, 2016

Ah, I was a little tired when I read your response.

make tests should work out of the box. If you want to run custom code in the shell, you have to specify the path to the dependencies or start the shell with make shell (a feature of erlang.mk).

I will consider the ticket closed. Updated documentation coming soon.

@dongyuwei
Copy link
Author

Thanks for the tip of make shell 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants