rubyjs / mini_racer

Minimal embedded v8
MIT License
585 stars 91 forks source link

Update to Node 18: libv8 API change (ScriptOrigin) #258

Closed lloeki closed 1 year ago

lloeki commented 1 year ago

I added a node-18 branch to rubyjs/libv8-node based on Node 18.8.0 / libv8 10.2.something, which mostly built successfully (except the ruby platform but right now I fail to understand why since it built fine otherwise).

Here's the result when testing on current mini_racer:

../../../../ext/mini_racer_extension/mini_racer_extension.cc:525:22: error: no matching constructor for initialization of 'v8::ScriptOrigin'
[87](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:88)
        origin = new v8::ScriptOrigin(*eval_params->filename);
[88](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:89)
                     ^                ~~~~~~~~~~~~~~~~~~~~~~
[89](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:90)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:62:17: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Local<v8::String>' to 'const v8::ScriptOrigin' for 1st argument
[90](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:91)
class V8_EXPORT ScriptOrigin {
[91](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:92)
                ^
[92](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:93)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:62:17: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'Local<v8::String>' to 'v8::ScriptOrigin' for 1st argument
[93](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:94)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:64:13: note: candidate constructor not viable: requires at least 2 arguments, but 1 was provided
[94](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:95)
  V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
[95](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:96)
            ^
[96](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:97)
../../../../ext/mini_racer_extension/mini_racer_extension.cc:802:18: error: no matching constructor for initialization of 'v8::ScriptOrigin'
[97](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:98)
    ScriptOrigin origin(resource_name);
[98](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:99)
                 ^      ~~~~~~~~~~~~~
[99](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:100)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:62:17: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'Local<v8::String>' to 'const v8::ScriptOrigin' for 1st argument
[100](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:101)
class V8_EXPORT ScriptOrigin {
[101](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:102)
                ^
[102](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:103)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:62:17: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'Local<v8::String>' to 'v8::ScriptOrigin' for 1st argument
[103](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:104)
/usr/local/lib/ruby/gems/2.7.0/gems/libv8-node-18.8.0.0-x86_64-darwin/vendor/v8/include/v8-message.h:64:13: note: candidate constructor not viable: requires at least 2 arguments, but 1 was provided
[104](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:105)
  V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
[105](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:106)
            ^
[106](https://github.com/rubyjs/libv8-node/runs/8025962683?check_suite_focus=true#step:5:107)
2 errors generated.
lloeki commented 1 year ago

Fixed by #261 (hopefully, as of today I quickly made it compile and pass tests, but I have no idea what I'm really doing without spending more time)

tisba commented 1 year ago

0.8.0 with Node 18 based v8 has been released.