deejayy / hlds-v8

Half Life Dedicated Server with Google V8 JS Engine (a metamod plugin)
12 stars 2 forks source link

Error: invalid conversion from 'v8::Value*' to 'v8::String*' #2

Closed maxpain closed 10 years ago

maxpain commented 10 years ago
root@comeback:/home/maxpain177/dev/hlds-v8# ./build.sh
In file included from ../metamod-1.20/metamod/sdk_util.h:55:0,
                 from ../metamod-1.20/metamod/dllapi.h:40,
                 from dllapi.cpp:3:
../hlsdk-2.3-p4/multiplayer/dlls/util.h:249:70: warning: 'typedef' was ignored in this declaration [enabled by default]
In file included from ../metamod-1.20/metamod/sdk_util.h:55:0,
                 from ../metamod-1.20/metamod/dllapi.h:40,
                 from ../metamod-1.20/metamod/meta_api.h:40,
                 from engine_api.cpp:3:
../hlsdk-2.3-p4/multiplayer/dlls/util.h:249:70: warning: 'typedef' was ignored in this declaration [enabled by default]
In file included from ../metamod-1.20/metamod/sdk_util.h:55:0,
                 from ../metamod-1.20/metamod/log_meta.h:41,
                 from ../metamod-1.20/metamod/osdep.h:48,
                 from ../metamod-1.20/metamod/h_export.h:40,
                 from h_export.cpp:3:
../hlsdk-2.3-p4/multiplayer/dlls/util.h:249:70: warning: 'typedef' was ignored in this declaration [enabled by default]
In file included from ../metamod-1.20/metamod/sdk_util.h:55:0,
                 from ../metamod-1.20/metamod/dllapi.h:40,
                 from ../metamod-1.20/metamod/meta_api.h:40,
                 from hldsv8.cpp:2:
../hlsdk-2.3-p4/multiplayer/dlls/util.h:249:70: warning: 'typedef' was ignored in this declaration [enabled by default]
In file included from ../metamod-1.20/metamod/sdk_util.h:55:0,
                 from ../metamod-1.20/metamod/dllapi.h:40,
                 from ../metamod-1.20/metamod/meta_api.h:40,
                 from hldsv8_common.cpp:2:
../hlsdk-2.3-p4/multiplayer/dlls/util.h:249:70: warning: 'typedef' was ignored in this declaration [enabled by default]
In file included from hldsv8_common.cpp:7:0:
../v8/include/v8.h: In instantiation of 'v8::Handle<T>::Handle(v8::Handle<S>) [with S = v8::Value; T = v8::String]':
hldsv8_common.cpp:317:54:   required from here
../v8/include/v8.h:243:5: error: invalid conversion from 'v8::Value*' to 'v8::String*' [-fpermissive]
root@comeback:/home/maxpain177/dev/hlds-v8#
maxpain commented 10 years ago

but on version 3.25.0 this is compilng! After compiling the plugin is not loading via metamod.

maxpain commented 10 years ago

2014-04-08 23 02 01

maxpain commented 10 years ago

I really want to test it now :)

deejayy commented 10 years ago

addons <> plugins, check the folder you fixed :)

maxpain commented 10 years ago

This plugin exists in two folders plugins/hldsv8/hldsv8_i386.so addons/hldsv8/hldsv8_i386.so badf load...

deejayy commented 10 years ago

Are there any error messages in the logs?

maxpain commented 10 years ago

No

maxpain commented 10 years ago

2014-04-08 23 12 22 LD_LIBRARY_PATH is valid?

deejayy commented 10 years ago

My start script contains: export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CS}

deejayy commented 10 years ago

At startup, hlds creates two log files, one before worldspawn and one after. V8 loads before, so error messages may appear in the first log file.

maxpain commented 10 years ago

Can I give you SSH access?

deejayy commented 10 years ago

Sure, my pub key is:

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQBRv+ktEc0KJmqx+8kLL6l5wb6xrr+9948BHDdxmUr3WzL6JxJ0U2yz7d/qAdIVsaEI2WKxmMs6z+Pxh8LBfaKMHQfFtg6T0jiK6nbACz42XwOkwSs5b4hpiw3COo2OxHba26ssa+JxyeoBR/5xFuf3SecSIOGf+BU2qZwlS+QRP54qyjUcz6sUib7+KbZQJAcmGGbUi+vlEVZrMbGHqfG6mTTNDrQ9ij9mFfsrCPpXqAb4y9eeTT3CGy/SPAnMyyTaQSIuhARt1T9MHgKjepxQndmkkSNYmbIlwgaE9xPy6ZRCp9H+5AGFGOkCVxaZKvsq6wOhxMsrVDC/CrfXjGMh rsa-key-20070105

maxpain commented 10 years ago

added. ip: comeback.pro hlds path: /home/maxpain177/hlds/comeback.hlds/cs16 sources path: /home/maxpain177/dev

deejayy commented 10 years ago

checkin'

maxpain commented 10 years ago

try please

deejayy commented 10 years ago

Yes, there is an error at startup: undefined symbol: _ZN2v86Object3NewEPNS_7IsolateE

maxpain commented 10 years ago

What is the reason?

deejayy commented 10 years ago

Don't know yet.

maxpain commented 10 years ago

Ok. Thanks again for such a great job. Sorry for the mistakes in the sentences. I do not know much English (I live in Russia)

deejayy commented 10 years ago

I think the problem is that hlds loads /usr/lib/libv8.so first, which has different API (v8::Object::New()), the new version contains v8::Object::New(v8::Isolate*). I don't know yet how to force to load the new libv8 (export LD_LIBRARY_PATH=${CS}:${LD_LIBRARY_PATH} did'nt help), but unfortunately i have to got to a meeting now. If the host remains up, i will try some ideas later (or tomorrow).

maxpain commented 10 years ago

V8 API is unstable. Which version you used to compile when it worked?

deejayy commented 10 years ago

2014-03-05: Version 3.25.4

maxpain commented 10 years ago

anyway does not work

deejayy commented 10 years ago

Hey,

[ 1] v8 RUN - hldsv8_i386.so v0.56.13 ini ANY Pause

The problem was, that hldsv8 was built against the older libv8 (ld ... -lv8), but since you removed the package i copied the newly compiled libv8 to /usr/lib/, rebuilt hldsv8, and voila :)

maxpain commented 10 years ago

thank you very much

deejayy commented 10 years ago

You're welcome!

maxpain commented 10 years ago

Where do I upload my scripts?

deejayy commented 10 years ago

At hldsv8_common.cpp:402 you can specify, currently it is /home/cstrike/inst/debug/cstrike/plugins/hldsv8/scripts/test.js

maxpain commented 10 years ago

only one script file?

deejayy commented 10 years ago

Yes - really really alpha :)

maxpain commented 10 years ago

It`s really really perspectively =)

maxpain commented 10 years ago
description      stat pend  file              vers      src  load  unlod
 [ 1] v8               RUN   -    hldsv8_i386.so    v0.56.13  ini  ANY   Pause
meta unpause v8
Unpause failed for plugin 'v8'

Why v8 in pause? /home/cstrike/inst/debug/cstrike/plugins/hldsv8/scripts/test.js - dont work...

deejayy commented 10 years ago

Yes, there is a bug in file reading, if you see "SyntaxError: Unexpected token ILLEGAL" in the logs, you should do an extra newline to the script's end. Try now.

maxpain commented 10 years ago

Where i can see logs?

deejayy commented 10 years ago

cstrike/logs/

maxpain commented 10 years ago
L 04/09/2014 - 15:42:38: Log file started (file "logs/L0409006.log") (game "cstrike") (version "48/1.1.2.7/Stdio/6132")
L 04/09/2014 - 15:42:38: [META] Metamod v1.20  2013-02-16
L 04/09/2014 - 15:42:38: [META] by Will Day <willday@metamod.org>
L 04/09/2014 - 15:42:38: [META]    http://www.metamod.org/
L 04/09/2014 - 15:42:38: [META] compiled: Feb 16 2013, 17:11:35 +0100 (optimized)
L 04/09/2014 - 15:42:38: [META] engine: i486
L 04/09/2014 - 15:42:38: [META] Recognized game 'cstrike'; using dllfile 'cs.so'
L 04/09/2014 - 15:42:38: [META] Game DLL for 'Counter-Strike' loaded successfully
L 04/09/2014 - 15:42:38: [META] ini: Begin reading plugins list: /home/maxpain177/hlds/comeback.hlds/cs16/cstrike/addons/metamod/plugins.ini
L 04/09/2014 - 15:42:38: [META] ini: Read plugin config for: v8
L 04/09/2014 - 15:42:38: [META] ini: Finished reading plugins list: /home/maxpain177/hlds/comeback.hlds/cs16/cstrike/addons/metamod/plugins.ini; Found 1 plugins to load
L 04/09/2014 - 15:42:38: [META] dll: Loading plugins...
L 04/09/2014 - 15:42:38: [META] dll: Loaded plugin 'v8': hlds-v8 v0.56.13 2014-03-13, DeeJayy <deejayy@deejayy.hu>
L 04/09/2014 - 15:42:38: [META] dll: Finished loading 1 plugins
L 04/09/2014 - 15:42:38: [HLDSV8] No GameInit defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ServerActivate defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CmdStart defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ClientCommand defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ServerDeactivate defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No PlayerPreThink defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No Think defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No PlayerPostThink defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No Touch defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No StartFrame defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CmdEnd defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ClientDisconnect defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ClientKill defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ClientPutInServer defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SpectatorConnect defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SpectatorDisconnect defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SpectatorThink defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ClientUserInfoChanged defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarRegister defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarGetFloat defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarGetString defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarSetFloat defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarSetString defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No CVarGetPointer defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No AlertMessage defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No AllocString defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No ServerCommand defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No RegUserMsg defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No LoadFileForMe defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No AddServerCommand defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No InfoKeyValue defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SetKeyValue defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SetClientKeyValue defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No Info_RemoveKey defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No GetPhysicsKeyValue defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No SetPhysicsKeyValue defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No GetPlayerAuthId defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No GetPlayerUserId defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No FindEntityByString defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No PlaybackEvent defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No EmitSound defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No MessageBegin defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No MessageEnd defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteByte defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteChar defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteShort defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteLong defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteAngle defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteCoord defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteString defined in script!
L 04/09/2014 - 15:42:38: [HLDSV8] No WriteEntity defined in script!
L 04/09/2014 - 15:42:38: Log file closed
deejayy commented 10 years ago

Yes, this is how a script loads normally. I fixed it 4 you :)

maxpain commented 10 years ago
/home/cstrike/inst/debug/cstrike/plugins/hldsv8/scripts/test.js
function ClientConnect(params) {
    console.log('A client connected! Name: ' + params.name + ', ip: ' + params.address);
};

When i connecting to server for test it - nothing happens :)

maxpain commented 10 years ago

oops.

log on

YES!!! It really works!!!! v8 in hlds!!!!!!

maxpain commented 10 years ago

Where i can see callbacks, eg. ClientConnect(params)?

deejayy commented 10 years ago
# egrep "v8c_CheckCallbackIsDefined" hldsv8.cpp

All callbacks got only one parameter.

# egrep "v8Common    ->Set" hldsv8_common.cpp

This displays invokable hlds engine functions from V8.

maxpain commented 10 years ago

Good.

maxpain commented 10 years ago

Now i can send info to website on meteor.js (framework for node.js) via websockets/xhr/etc.?

maxpain commented 10 years ago
All callbacks got only one parameter.

Can i see array options in params, eg. console.log(params)?

deejayy commented 10 years ago

V8 is a very bare JS environment what only implements the current ECMA standard. Node.JS is much more than this.

I'm looking for a way to embed the whole node ecosystem, but with no luck. Anyway, i don't give up yet.

deejayy commented 10 years ago

Yes, console.log(params) will log the params object.

For making this easier, paste this snippet in your test.js:

Object.prototype.toString = function ()
{
    var ret = 'Object dump: \n';
    for (var key in this) {
        ret += '  ' + key + ': ' + this[key] + '\n';
    }

    return ret;
}
maxpain commented 10 years ago
node ecosystem

This means that it is possible to use npm-modules?

deejayy commented 10 years ago

Yup, all of it :) That's the plan.

maxpain commented 10 years ago

very nice. all works. thank you again. No more questions :)

maxpain commented 10 years ago

but I still want to send data to my website :)