Javascript plugin does not compile with v8 version 3.30.33.16 #360

Open
flashcode opened this Issue Mar 15, 2015 · 4 comments

Projects

None yet

2 participants

@flashcode
Member

The javascript fails to compile with v8 version 3.30.33.16 and weechat v1.1-151-g9f15851, on Arch Linux:

[ 70%] Building CXX object src/plugins/javascript/CMakeFiles/javascript.dir/weechat-js.o
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp: In function ‘void weechat_js_hashtable_map_cb(void*, t_hashtable*, const char*, const char*)’:
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:94:17: error: ‘New’ is not a member of ‘v8::String’
     (*obj)->Set(String::New(key), String::New(value));
                 ^
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:94:35: error: ‘New’ is not a member of ‘v8::String’
     (*obj)->Set(String::New(key), String::New(value));
                                   ^
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp: In function ‘v8::Handle<v8::Object> weechat_js_hashtable_to_object(t_hashtable*)’:
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:104:38: error: no matching function for call to ‘v8::Object::New()’
     Handle<Object> obj = Object::New();
                                      ^
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:104:38: note: candidate is:
In file included from /home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.h:24:0,
                 from /home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:33:
/usr/include/v8.h:2609:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/usr/include/v8.h:2609:24: note:   candidate expects 1 argument, 0 provided
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp: In function ‘void* weechat_js_exec(t_plugin_script*, int, const char*, const char*, void**)’:
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:196:32: error: ‘New’ is not a member of ‘v8::String’
                     argv2[i] = v8::String::New((const char *)argv[i]);
                                ^
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:199:66: error: no matching function for call to ‘v8::Integer::New(int&)’
                     argv2[i] = v8::Integer::New(*((int *)argv[i]));
                                                                  ^
/home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:199:66: note: candidate is:
In file included from /home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.h:24:0,
                 from /home/flashcode/src/weechat/dev/src/plugins/javascript/weechat-js.cpp:33:
/usr/include/v8.h:2224:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/usr/include/v8.h:2224:25: note:   candidate expects 2 arguments, 1 provided
src/plugins/javascript/CMakeFiles/javascript.dir/build.make:54: recipe for target 'src/plugins/javascript/CMakeFiles/javascript.dir/weechat-js.o' failed
make[2]: *** [src/plugins/javascript/CMakeFiles/javascript.dir/weechat-js.o] Error 1
CMakeFiles/Makefile2:1557: recipe for target 'src/plugins/javascript/CMakeFiles/javascript.dir/all' failed
make[1]: *** [src/plugins/javascript/CMakeFiles/javascript.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2

This is caused by API changes in v8.
Since there's no version in v8 headers, so it's hard to support multiple version of v8 at same time.

@flashcode flashcode added the bug label Mar 15, 2015
@flashcode flashcode self-assigned this Mar 15, 2015
@flashcode
Member

It looks like the deprecated functions in API have been removed in v8 version 3.24.4.
So WeeChat currently only supports v8 <= 3.24.3.

@flashcode
Member

Supporting multiple versions of v8 seems hard, since the version is not exported in headers (it is only since a few days, but not for old releases).

@stfnm
Contributor
stfnm commented Apr 22, 2015

The following commit seems to be the first one in v8 to introduce version information as an include header: v8/v8@9dac60a

So I guess WeeChat could support v8 versions >= 4.3.0 and <= 3.24.3 (implicitly as the "no version information" fallback).

Of course this would leave some versions in between which will remain unsupported forever but I suppose that's still better than only supporting those old versions forever.

@flashcode
Member

@stfnm: yes you're right, I'll do that.

@flashcode flashcode added this to the 1.3 milestone Apr 25, 2015
@flashcode flashcode modified the milestone: 1.3, 1.4 Aug 14, 2015
@flashcode flashcode modified the milestone: 1.5, 1.4 Jan 3, 2016
@flashcode flashcode removed this from the 1.5 milestone Apr 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment