Re: [v8-users] How do I use the Accessor?

2016-09-21 Thread Ben Noordhuis
On Thu, Sep 22, 2016 at 2:19 AM, kito  wrote:
> I will need an example of how to use the Accessor.
>
> The code was posted above, it does not run successfully.

Take a look at test/cctest/test-api.cc and
test/cctest/test-accessors.cc.  If you can't distill a working example
from that, can you be more specific about what doesn't work and what
you have tried so far?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Any build flag to maintain regular v8 stack trace?

2016-09-21 Thread Ben Noordhuis
On Thu, Sep 22, 2016 at 2:41 AM, Jane Chen  wrote:
> Embedding v8.  Currently on 4.6.88, and in the process of upgrading to
> 5.3.lkgr.
>
> When I do a pstack of my program embedding v8, some of the v8 frames show up
> as ???.  I wonder whether there's a build flag I could use to enable the
> full stack trace of v8 frames.
>
> Please advise.
>
> Thanks.

If your pstack is a wrapper around gdb, compile V8 with
v8_enable_gdbjit set to 1 (`make native gdbjit=on`) and it should be
able to decode JS stack frames.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] v8 libraries.

2016-09-21 Thread Ben Noordhuis
On Thu, Sep 22, 2016 at 2:02 AM, Jane Chen  wrote:
> I'm embedding v8 and trying to upgrade to v8 5.3-lkgr.  After I built v8
> using GYP with GYPFLAGS="-Dv8_use_external_startup_data=0
> -Dcomponent=shared_library", I got the following files under
> out/x64.release/obj.target/src/:
>
> js2c.stamp libv8_nosnapshot.a
> libv8_base.a   libv8_snapshot.a
> libv8_external_snapshot.a  libv8.so
> libv8_libbase.anatives_blob.stamp
> libv8_libplatform.av8_maybe_snapshot.stamp
> libv8_libsampler.a
>
> I seem to be able to link my program with a subset of the above, leaving out
> libv8_libsampler.a and the *.stamp files.  Should they be included?  Would I
> get runtime issues if any of them is left out?
>
> Thanks!

You don't need the *.stamp files but libv8_sampler.a is a dependency
of libv8_base.a that is used when the heap and CPU profilers are
active.  I'd leave it in.

An easy litmus test is if a static build can be linked into an
executable without linker errors.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Any build flag to maintain regular v8 stack trace?

2016-09-21 Thread Jane Chen
Embedding v8.  Currently on 4.6.88, and in the process of upgrading to 
5.3.lkgr.

When I do a pstack of my program embedding v8, some of the v8 frames show 
up as ???.  I wonder whether there's a build flag I could use to enable the 
full stack trace of v8 frames.  

Please advise.  

Thanks.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Building v8 with gn.

2016-09-21 Thread Jane Chen
Trying to build v8 5.3-lkgr with gn for embedding use.

When I build with GYP, I need to set "-Dv8_use_external_startup_data=0".  
Is there an equivalent setting flag for gn?

Also if I build with gn and I need to link with libv8_libplatform.a, 
libv8_libbase.a etc, is there a flag to generate those static libs?

Thanks!

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How do I use the Accessor?

2016-09-21 Thread kito


I will need an example of how to use the Accessor.

The code was posted above, it does not run successfully.


2016년 9월 21일 수요일 오후 7시 47분 51초 UTC+9, Ben Noordhuis 님의 말:
>
> On Wed, Sep 21, 2016 at 12:37 PM, kito > 
> wrote: 
> > Hi~ 
> > 
> > I try to use the google's v8 in win32 application console Project of 
> visual 
> > studio 2015. (For reference, I'm using Windows 10.) 
> > 
> > I will use the Accessor, trying to output the url of location.href. 
> > 
> > 
> > Sample code to output a value using the Accessor is required. 
> > 
> > The following is the code that I've tried. 
> > 
> > std::string href; 
> > 
> > class lhref { 
> > public: 
> > lhref() {} 
> > ~lhref() {} 
> > 
> > std::string url; 
> > std::string getUrl(void) { return url; } 
> > }; 
> > 
> > // lhref wrapper class 
> > class lhrefWrapper { 
> > public: 
> > lhrefWrapper() {}; 
> > ~lhrefWrapper(); 
> > 
> > void Initialize(v8::Isolate*, v8::Local); 
> > 
> > private: 
> > static lhref* Unwraplhref(v8::Local); 
> > static void Getter(v8::Local, const 
> > v8::PropertyCallbackInfo&); 
> > static void Setter(v8::Local, v8::Local, 
> > const v8::PropertyCallbackInfo&); 
> > }; 
> > 
> > 
> > lhrefWrapper::~lhrefWrapper() { 
> > } 
> > 
> > 
> > void lhrefWrapper::Initialize(v8::Isolate * isolate, 
> v8::Local 
> > Context) { 
> > v8::HandleScope handle_scope(isolate); 
> > 
> > v8::Context::Scope context_scope(Context); 
> > 
> > v8::Local ft_print = 
> > v8::FunctionTemplate::New(isolate, Print); 
> > v8::Local f_print = ft_print->GetFunction(); 
> > 
> > v8::Local ft_alert = 
> > v8::FunctionTemplate::New(isolate, Alert); 
> > v8::Local f_alert = ft_alert->GetFunction(); 
> > 
> > v8::Local ft_prompt = 
> > v8::FunctionTemplate::New(isolate, Prompt); 
> > v8::Local f_prompt = ft_prompt->GetFunction(); 
> > 
> > v8::Local ft_window = 
> > v8::FunctionTemplate::New(isolate, Window); 
> > v8::Local f_window = ft_window->GetFunction(); 
> > 
> > Context->Global()->Set(v8::String::NewFromUtf8(isolate, "print", 
> > v8::NewStringType::kNormal).ToLocalChecked(), f_print); 
> > Context->Global()->Set(v8::String::NewFromUtf8(isolate, "alert", 
> > v8::NewStringType::kNormal).ToLocalChecked(), f_alert); 
> > Context->Global()->Set(v8::String::NewFromUtf8(isolate, 
> "prompt", 
> > v8::NewStringType::kNormal).ToLocalChecked(), f_prompt); 
> > Context->Global()->Set(v8::String::NewFromUtf8(isolate, 
> "window", 
> > v8::NewStringType::kNormal).ToLocalChecked(), f_window); 
> > 
> > v8::Local lhref_templ = 
> > v8::ObjectTemplate::New(isolate); 
> > lhref_templ->SetInternalFieldCount(1); 
> > //lhref_templ->SetAccessor(v8::String::NewFromUtf8(isolate, 
> "href"), 
> > Getter); 
> > 
> > lhref* lohref = new lhref(); 
> > 
> > v8::Local lhref_obj = lhref_templ->NewInstance(); 
> > 
> > lhref_obj->SetInternalField(0, v8::External::New(isolate, 
> lohref)); 
> > 
> > Context->Global()->Set(v8::String::NewFromUtf8(isolate, 
> "location", 
> > v8::NewStringType::kNormal).ToLocalChecked(), lhref_obj); 
> > } 
> > 
> > lhref* lhrefWrapper::Unwraplhref(v8::Local obj) { 
> > v8::Local field = 
> > v8::Local::Cast(obj->GetInternalField(0)); 
> > void* ptr = field->Value(); 
> > return static_cast(ptr); 
> > } 
> > 
> > 
> > void lhrefWrapper::Getter(v8::Local property, const 
> > v8::PropertyCallbackInfo& info) 
> > { 
> > v8::Local self = info.Holder(); 
> > v8::Local wrap = 
> > v8::Local::Cast(self->GetInternalField(0)); 
> > void* ptr = wrap->Value(); 
> > href = static_cast(ptr)->url; 
> > info.GetReturnValue().Set(StringToV8String(href)); 
> > } 
> > 
> > void lhrefWrapper::Setter(v8::Local property, 
> > v8::Local value, const v8::PropertyCallbackInfo& 
> info) 
> > { 
> > v8::Local self = info.Holder(); 
> > v8::Local wrap = 
> > v8::Local::Cast(self->GetInternalField(0)); 
> > void* ptr = wrap->Value(); 
> > static_cast(ptr)->url = V8StringToString(value); 
> > } 
> > 
> > . 
> > . 
> > . 
> > 
> > /[[ Main 
> > ]]/ 
> > 
> > int main(int argc, char* argv[]) { 
> > v8::V8::InitializeICUDefaultLocation(argv[0]); 
> > v8::V8::InitializeExternalStartupData(argv[0]); 
> > v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 
> > v8::V8::InitializePlatform(platform); 
> > v8::V8::Initialize(); 
> > 
> > v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 
> > v8::Isolate::CreateParams create_params; 
> > create_params.array_buffer_allocator = 
> > v8::ArrayBuffer::Allocator::NewDefaultAllocator(); 
> > v8::Isolate* isolate = v8::Isolate::N

[v8-users] v8 libraries.

2016-09-21 Thread Jane Chen
I'm embedding v8 and trying to upgrade to v8 5.3-lkgr.  After I built v8 
using GYP with GYPFLAGS="-Dv8_use_external_startup_data=0 
-Dcomponent=shared_library", I got the following files under 
out/x64.release/obj.target/src/:

js2c.stamp libv8_nosnapshot.a
libv8_base.a   libv8_snapshot.a
libv8_external_snapshot.a  libv8.so
libv8_libbase.anatives_blob.stamp
libv8_libplatform.av8_maybe_snapshot.stamp
libv8_libsampler.a 

I seem to be able to link my program with a subset of the above, leaving 
out libv8_libsampler.a and the *.stamp files.  Should they be included?  
Would I get runtime issues if any of them is left out?

Thanks!

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Unresolved symbol error

2016-09-21 Thread Pieter
Thanks for the reply Ben,
This is odd as this very same code compiles fine on OSX and Ubuntu with the 
same branch checked out?

On Wednesday, 21 September 2016 18:21:21 UTC+2, Ben Noordhuis wrote:
>
> On Wed, Sep 21, 2016 at 2:47 PM, Pieter  > wrote: 
> > After I have managed to get the windows build of v8 going I have a 
> single 
> > unresolved symbol issue that I could use some help with. 
> > 
> > unresolved external symbol "public: static class v8::Local > v8::Context> __cdecl v8::Context::New(class v8::Isolate *,class 
> > v8::ExtensionConfiguration *,class v8::MaybeLocal > v8::ObjectTemplate>,class v8::MaybeLocal)" 
>
> Context::New() takes a Local and a Local, not 
> MaybeLocal and MaybeLocal. 
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Unresolved symbol error

2016-09-21 Thread Ben Noordhuis
On Wed, Sep 21, 2016 at 2:47 PM, Pieter  wrote:
> After I have managed to get the windows build of v8 going I have a single
> unresolved symbol issue that I could use some help with.
>
> unresolved external symbol "public: static class v8::Local v8::Context> __cdecl v8::Context::New(class v8::Isolate *,class
> v8::ExtensionConfiguration *,class v8::MaybeLocal v8::ObjectTemplate>,class v8::MaybeLocal)"

Context::New() takes a Local and a Local, not
MaybeLocal and MaybeLocal.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Unresolved symbol error

2016-09-21 Thread Pieter
After I have managed to get the windows build of v8 going I have a single 
unresolved symbol issue that I could use some help with.

unresolved external symbol "public: static class v8::Local __cdecl v8::Context::New(class v8::Isolate *,class 
v8::ExtensionConfiguration *,class v8::MaybeLocal,class v8::MaybeLocal)" 

I have linked to the following libs already
v8_base_0.lib
v8_base_1.lib
v8_base_2.lib
v8_base_3.lib
v8_libbase.lib
v8_libplatform.lib
v8_nosnapshot.lib
ws2_32.lib
winmm.lib
icui18n.lib
icuuc.lib

I don't seem to be missing anything?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Building v8 with Visual Studio 2015 on Windows 10

2016-09-21 Thread 'Michael Achenbach' via v8-users
That'd be with
set GYP_GENERATORS=msvs

But I'm afraid we dropped official support for this a while back.

Why not build with ninja? E.g. gyp_generator like you specified and then 
build with:
ninja -C out\Release

on x64 platforms might require:
ninja -C out\Release_x64

On Wednesday, September 21, 2016 at 10:56:55 AM UTC+2, Pieter wrote:
>
> Thanks for the reply Jochen,
> How do I specify the msvs gyp generator?
>
> On Wednesday, 21 September 2016 10:54:39 UTC+2, Jochen Eisinger wrote:
>>
>> If you want to build with MSVS, you need the msvs gyp generator. 
>> msvs-ninja only supports browsing the project, not building it
>>
>> On Tue, Sep 20, 2016 at 10:04 AM Pieter  wrote:
>>
>>>
>>> I have been struggling for a couple of days to get the correct 
>>> incantations to get a build of v8 working on windows 10 with visual studio 
>>> 2015.
>>>
>>> In short the steps that i've been attempting are as follows
>>>
>>>- set DEPOT_TOOLS_WIN_TOOLCHAIN=0
>>>- set GYP_MSVS_VERSION=2015
>>>- set GYP_GENERATORS=msvs-ninja,ninja
>>>- Get depot tools from: wget 
>>>https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile 
>>>depot_tools.zip
>>>- Expand Archive: Expand-Archive .\depot_tools.zip -dest depot_tools
>>>- Set the path for depot tools
>>>- Checkout the v8 source code by running: fetch v8
>>>- Change directory to /v8 and checkout 5.2: git checkout 
>>>branch-heads/5.2
>>>- Run sync so that all the dependencies are up to date with the 
>>>branch: gclient sync
>>>- To generate the project files run: third_party/python_26/python.exe 
>>>build\gyp_v8 -Dtarget_arch=x64
>>>- To build: : "c:\Program Files (x86)\Microsoft Visual Studio 
>>>14.0\Common7\IDE\devenv.com" /build Release gypfiles\All.sln
>>>
>>> I am running into all kinds of issues related with the build and after 
>>> running the last command it ends with
>>>
>>> The first occurrence of the error is 
>>>
>>> 1>  ninja -t msvc -e environment.x64 -- "C:\Program Files 
>>> (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /
>>> showIncludes /FC @obj\third_party\icu\source\i18n\icui18n.collationkeys.
>>> obj.rsp /c..\..\third_party\icu\source\i18n\collationkeys.cpp /Foobj\
>>> third_party\icu\source\i18n\icui18n.collationkeys.obj /Fdobj\third_party
>>> \icu\icui18n.cc.pdb
>>> 1>C:\source\v8build\v8\third_party\icu\source\i18n\collationkeys.cpp : 
>>> fatal 
>>> error C1083: Cannot open compiler generated file: 
>>> 'C:\source\v8build\v8\out\Release_x64\obj\third_party\icu\source\i18n\icui18n.collationkeys.obj'
>>> : Permission denied
>>>
>>> I am not sure why i'm getting a permission denied.
>>>
>>> the build then ends with
>>>
>>> 40>  ninja: build stopped: subcommand failed.
>>> 40>ninja : warning : premature end of file; recovering
>>> 40>C:\source\v8build\v8\test\fuzzer\wasm_fuzzer.vcxproj(334,5): error 
>>> MSB3073: The command "call ninja.exe -C ..\..\out\Release_x64\ 
>>> wasm_fuzzer" exited with code 1.
>>>
>>>  ..\..\out\Release_x64\ wasm_fuzzer" exited with code 1.
>>> == Build: 20 succeeded, 21 failed, 0 up-to-date, 0 skipped 
>>> ==
>>>
>>>
>>> Any help would be much appreciated
>>>
>>> -- 
>>> -- 
>>> v8-users mailing list
>>> v8-u...@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to v8-users+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Undefined reference to `v8::platform::CreateDefaultPlatform(int)`

2016-09-21 Thread Andre Cunha
Okay. I'll try to link statically, then.

Thank you!
Andre

On Wednesday, September 21, 2016 at 5:52:12 AM UTC-3, Jochen Eisinger wrote:
>
> I filed https://bugs.chromium.org/p/v8/issues/detail?id=5412 as feature 
> request
>
> On Wed, Sep 21, 2016 at 10:50 AM Jochen Eisinger  > wrote:
>
>> libplatform currently does not support dynamic linking.
>>
>> On Tue, Sep 20, 2016 at 7:43 PM Andre Cunha > > wrote:
>>
>>> Hello,
>>>
>>> I'm trying to dynamically load libplatform in an application I'm 
>>> writing. I searched through the available gn options, but I couldn't find 
>>> an option to build libplatform as a shared object, so I did it by hand:
>>>
>>> $ gcc -shared -o libv8_libplatform.so obj/v8_lib{platform,base}/*.o
>>>
>>> I use this both in debug and in release mode, but when I link my 
>>> application against libplatform in release mode, I get "undefined reference 
>>> to `v8::platform::CreateDefaultPlatform(int)`". This doesn't happen in 
>>> debug mode. After some investigation, I realized that the aforementioned 
>>> function is exported in debug mode, but is hidden in release mode:
>>>
>>> # Debug
>>> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
>>> 0001ad70 *T* v8::platform::CreateDefaultPlatform(int)
>>>
>>> # Release
>>> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
>>> 3b20 *t* v8::platform::CreateDefaultPlatform(int)
>>>
>>> I inspected the ninja files, and realized this happens because object 
>>> files are compiled with -fvisibility=default in debug mode, and with 
>>> -fvisibility=hidden in release mode.
>>>
>>> So, my question is: is this function not supposed to be used in release 
>>> applications? Should I, then, link statically against the many individual 
>>> .o files needed (as the hello-world.cc example does)? If so, what's the 
>>> best way to do this?
>>>
>>> Thanks in advance,
>>> Andre
>>>
>>> -- 
>>> -- 
>>> v8-users mailing list
>>> v8-u...@googlegroups.com 
>>> http://groups.google.com/group/v8-users
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to v8-users+u...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] How do I use the Accessor?

2016-09-21 Thread Ben Noordhuis
On Wed, Sep 21, 2016 at 12:37 PM, kito  wrote:
> Hi~
>
> I try to use the google's v8 in win32 application console Project of visual
> studio 2015. (For reference, I'm using Windows 10.)
>
> I will use the Accessor, trying to output the url of location.href.
>
>
> Sample code to output a value using the Accessor is required.
>
> The following is the code that I've tried.
>
> std::string href;
>
> class lhref {
> public:
> lhref() {}
> ~lhref() {}
>
> std::string url;
> std::string getUrl(void) { return url; }
> };
>
> // lhref wrapper class
> class lhrefWrapper {
> public:
> lhrefWrapper() {};
> ~lhrefWrapper();
>
> void Initialize(v8::Isolate*, v8::Local);
>
> private:
> static lhref* Unwraplhref(v8::Local);
> static void Getter(v8::Local, const
> v8::PropertyCallbackInfo&);
> static void Setter(v8::Local, v8::Local,
> const v8::PropertyCallbackInfo&);
> };
>
>
> lhrefWrapper::~lhrefWrapper() {
> }
>
>
> void lhrefWrapper::Initialize(v8::Isolate * isolate, v8::Local
> Context) {
> v8::HandleScope handle_scope(isolate);
>
> v8::Context::Scope context_scope(Context);
>
> v8::Local ft_print =
> v8::FunctionTemplate::New(isolate, Print);
> v8::Local f_print = ft_print->GetFunction();
>
> v8::Local ft_alert =
> v8::FunctionTemplate::New(isolate, Alert);
> v8::Local f_alert = ft_alert->GetFunction();
>
> v8::Local ft_prompt =
> v8::FunctionTemplate::New(isolate, Prompt);
> v8::Local f_prompt = ft_prompt->GetFunction();
>
> v8::Local ft_window =
> v8::FunctionTemplate::New(isolate, Window);
> v8::Local f_window = ft_window->GetFunction();
>
> Context->Global()->Set(v8::String::NewFromUtf8(isolate, "print",
> v8::NewStringType::kNormal).ToLocalChecked(), f_print);
> Context->Global()->Set(v8::String::NewFromUtf8(isolate, "alert",
> v8::NewStringType::kNormal).ToLocalChecked(), f_alert);
> Context->Global()->Set(v8::String::NewFromUtf8(isolate, "prompt",
> v8::NewStringType::kNormal).ToLocalChecked(), f_prompt);
> Context->Global()->Set(v8::String::NewFromUtf8(isolate, "window",
> v8::NewStringType::kNormal).ToLocalChecked(), f_window);
>
> v8::Local lhref_templ =
> v8::ObjectTemplate::New(isolate);
> lhref_templ->SetInternalFieldCount(1);
> //lhref_templ->SetAccessor(v8::String::NewFromUtf8(isolate, "href"),
> Getter);
>
> lhref* lohref = new lhref();
>
> v8::Local lhref_obj = lhref_templ->NewInstance();
>
> lhref_obj->SetInternalField(0, v8::External::New(isolate, lohref));
>
> Context->Global()->Set(v8::String::NewFromUtf8(isolate, "location",
> v8::NewStringType::kNormal).ToLocalChecked(), lhref_obj);
> }
>
> lhref* lhrefWrapper::Unwraplhref(v8::Local obj) {
> v8::Local field =
> v8::Local::Cast(obj->GetInternalField(0));
> void* ptr = field->Value();
> return static_cast(ptr);
> }
>
>
> void lhrefWrapper::Getter(v8::Local property, const
> v8::PropertyCallbackInfo& info)
> {
> v8::Local self = info.Holder();
> v8::Local wrap =
> v8::Local::Cast(self->GetInternalField(0));
> void* ptr = wrap->Value();
> href = static_cast(ptr)->url;
> info.GetReturnValue().Set(StringToV8String(href));
> }
>
> void lhrefWrapper::Setter(v8::Local property,
> v8::Local value, const v8::PropertyCallbackInfo& info)
> {
> v8::Local self = info.Holder();
> v8::Local wrap =
> v8::Local::Cast(self->GetInternalField(0));
> void* ptr = wrap->Value();
> static_cast(ptr)->url = V8StringToString(value);
> }
>
> .
> .
> .
>
> /[[ Main
> ]]/
>
> int main(int argc, char* argv[]) {
> v8::V8::InitializeICUDefaultLocation(argv[0]);
> v8::V8::InitializeExternalStartupData(argv[0]);
> v8::Platform* platform = v8::platform::CreateDefaultPlatform();
> v8::V8::InitializePlatform(platform);
> v8::V8::Initialize();
>
> v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
> v8::Isolate::CreateParams create_params;
> create_params.array_buffer_allocator =
> v8::ArrayBuffer::Allocator::NewDefaultAllocator();
> v8::Isolate* isolate = v8::Isolate::New(create_params);
>
> {
> v8::Isolate::Scope isolate_scope(isolate);
> v8::HandleScope handle_scope(isolate);
>
> v8::Local context = v8::Context::New(isolate);
>
> v8::Context::Scope context_scope(context);
>
> v8::Local source;
>
> for (int i = 1; i < argc; i++) {
> const char* str = argv[i];
>
> ReadFile(isolate, str).ToLocal(&source);
> }
>
> lhrefWrapper lw;
>
> lw.Initialize(isolate, context);
>
> 

Re: [v8-users] Building v8 with Visual Studio 2015 on Windows 10

2016-09-21 Thread Pieter
Thanks for the reply Jochen,
How do I specify the msvs gyp generator?

On Wednesday, 21 September 2016 10:54:39 UTC+2, Jochen Eisinger wrote:
>
> If you want to build with MSVS, you need the msvs gyp generator. 
> msvs-ninja only supports browsing the project, not building it
>
> On Tue, Sep 20, 2016 at 10:04 AM Pieter  > wrote:
>
>>
>> I have been struggling for a couple of days to get the correct 
>> incantations to get a build of v8 working on windows 10 with visual studio 
>> 2015.
>>
>> In short the steps that i've been attempting are as follows
>>
>>- set DEPOT_TOOLS_WIN_TOOLCHAIN=0
>>- set GYP_MSVS_VERSION=2015
>>- set GYP_GENERATORS=msvs-ninja,ninja
>>- Get depot tools from: wget 
>>https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile 
>>depot_tools.zip
>>- Expand Archive: Expand-Archive .\depot_tools.zip -dest depot_tools
>>- Set the path for depot tools
>>- Checkout the v8 source code by running: fetch v8
>>- Change directory to /v8 and checkout 5.2: git checkout 
>>branch-heads/5.2
>>- Run sync so that all the dependencies are up to date with the 
>>branch: gclient sync
>>- To generate the project files run: third_party/python_26/python.exe 
>>build\gyp_v8 -Dtarget_arch=x64
>>- To build: : "c:\Program Files (x86)\Microsoft Visual Studio 
>>14.0\Common7\IDE\devenv.com" /build Release gypfiles\All.sln
>>
>> I am running into all kinds of issues related with the build and after 
>> running the last command it ends with
>>
>> The first occurrence of the error is 
>>
>> 1>  ninja -t msvc -e environment.x64 -- "C:\Program Files 
>> (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /
>> showIncludes /FC @obj\third_party\icu\source\i18n\icui18n.collationkeys.
>> obj.rsp /c..\..\third_party\icu\source\i18n\collationkeys.cpp /Foobj\
>> third_party\icu\source\i18n\icui18n.collationkeys.obj /Fdobj\third_party\
>> icu\icui18n.cc.pdb
>> 1>C:\source\v8build\v8\third_party\icu\source\i18n\collationkeys.cpp : fatal 
>> error C1083: Cannot open compiler generated file: 
>> 'C:\source\v8build\v8\out\Release_x64\obj\third_party\icu\source\i18n\icui18n.collationkeys.obj'
>> : Permission denied
>>
>> I am not sure why i'm getting a permission denied.
>>
>> the build then ends with
>>
>> 40>  ninja: build stopped: subcommand failed.
>> 40>ninja : warning : premature end of file; recovering
>> 40>C:\source\v8build\v8\test\fuzzer\wasm_fuzzer.vcxproj(334,5): error 
>> MSB3073: The command "call ninja.exe -C ..\..\out\Release_x64\ 
>> wasm_fuzzer" exited with code 1.
>>
>>  ..\..\out\Release_x64\ wasm_fuzzer" exited with code 1.
>> == Build: 20 succeeded, 21 failed, 0 up-to-date, 0 skipped 
>> ==
>>
>>
>> Any help would be much appreciated
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com 
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Building v8 with Visual Studio 2015 on Windows 10

2016-09-21 Thread Jochen Eisinger
If you want to build with MSVS, you need the msvs gyp generator. msvs-ninja
only supports browsing the project, not building it

On Tue, Sep 20, 2016 at 10:04 AM Pieter  wrote:

>
> I have been struggling for a couple of days to get the correct
> incantations to get a build of v8 working on windows 10 with visual studio
> 2015.
>
> In short the steps that i've been attempting are as follows
>
>- set DEPOT_TOOLS_WIN_TOOLCHAIN=0
>- set GYP_MSVS_VERSION=2015
>- set GYP_GENERATORS=msvs-ninja,ninja
>- Get depot tools from: wget
>https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile
>depot_tools.zip
>- Expand Archive: Expand-Archive .\depot_tools.zip -dest depot_tools
>- Set the path for depot tools
>- Checkout the v8 source code by running: fetch v8
>- Change directory to /v8 and checkout 5.2: git checkout
>branch-heads/5.2
>- Run sync so that all the dependencies are up to date with the
>branch: gclient sync
>- To generate the project files run: third_party/python_26/python.exe
>build\gyp_v8 -Dtarget_arch=x64
>- To build: : "c:\Program Files (x86)\Microsoft Visual Studio
>14.0\Common7\IDE\devenv.com" /build Release gypfiles\All.sln
>
> I am running into all kinds of issues related with the build and after
> running the last command it ends with
>
> The first occurrence of the error is
>
> 1>  ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft
> Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /showIncludes /FC @obj\
> third_party\icu\source\i18n\icui18n.collationkeys.obj.rsp /c..\..\
> third_party\icu\source\i18n\collationkeys.cpp /Foobj\third_party\icu\
> source\i18n\icui18n.collationkeys.obj /Fdobj\third_party\icu\icui18n.cc.
> pdb
> 1>C:\source\v8build\v8\third_party\icu\source\i18n\collationkeys.cpp : fatal
> error C1083: Cannot open compiler generated file:
> 'C:\source\v8build\v8\out\Release_x64\obj\third_party\icu\source\i18n\icui18n.collationkeys.obj'
> : Permission denied
>
> I am not sure why i'm getting a permission denied.
>
> the build then ends with
>
> 40>  ninja: build stopped: subcommand failed.
> 40>ninja : warning : premature end of file; recovering
> 40>C:\source\v8build\v8\test\fuzzer\wasm_fuzzer.vcxproj(334,5): error
> MSB3073: The command "call ninja.exe -C ..\..\out\Release_x64\
> wasm_fuzzer" exited with code 1.
>
>  ..\..\out\Release_x64\ wasm_fuzzer" exited with code 1.
> == Build: 20 succeeded, 21 failed, 0 up-to-date, 0 skipped
> ==
>
>
> Any help would be much appreciated
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Undefined reference to `v8::platform::CreateDefaultPlatform(int)`

2016-09-21 Thread Jochen Eisinger
I filed https://bugs.chromium.org/p/v8/issues/detail?id=5412 as feature
request

On Wed, Sep 21, 2016 at 10:50 AM Jochen Eisinger 
wrote:

> libplatform currently does not support dynamic linking.
>
> On Tue, Sep 20, 2016 at 7:43 PM Andre Cunha 
> wrote:
>
> Hello,
>
> I'm trying to dynamically load libplatform in an application I'm writing.
> I searched through the available gn options, but I couldn't find an option
> to build libplatform as a shared object, so I did it by hand:
>
> $ gcc -shared -o libv8_libplatform.so obj/v8_lib{platform,base}/*.o
>
> I use this both in debug and in release mode, but when I link my
> application against libplatform in release mode, I get "undefined reference
> to `v8::platform::CreateDefaultPlatform(int)`". This doesn't happen in
> debug mode. After some investigation, I realized that the aforementioned
> function is exported in debug mode, but is hidden in release mode:
>
> # Debug
> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
> 0001ad70 *T* v8::platform::CreateDefaultPlatform(int)
>
> # Release
> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
> 3b20 *t* v8::platform::CreateDefaultPlatform(int)
>
> I inspected the ninja files, and realized this happens because object
> files are compiled with -fvisibility=default in debug mode, and with
> -fvisibility=hidden in release mode.
>
> So, my question is: is this function not supposed to be used in release
> applications? Should I, then, link statically against the many individual
> .o files needed (as the hello-world.cc example does)? If so, what's the
> best way to do this?
>
> Thanks in advance,
> Andre
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [v8-users] Undefined reference to `v8::platform::CreateDefaultPlatform(int)`

2016-09-21 Thread Jochen Eisinger
libplatform currently does not support dynamic linking.

On Tue, Sep 20, 2016 at 7:43 PM Andre Cunha 
wrote:

> Hello,
>
> I'm trying to dynamically load libplatform in an application I'm writing.
> I searched through the available gn options, but I couldn't find an option
> to build libplatform as a shared object, so I did it by hand:
>
> $ gcc -shared -o libv8_libplatform.so obj/v8_lib{platform,base}/*.o
>
> I use this both in debug and in release mode, but when I link my
> application against libplatform in release mode, I get "undefined reference
> to `v8::platform::CreateDefaultPlatform(int)`". This doesn't happen in
> debug mode. After some investigation, I realized that the aforementioned
> function is exported in debug mode, but is hidden in release mode:
>
> # Debug
> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
> 0001ad70 *T* v8::platform::CreateDefaultPlatform(int)
>
> # Release
> $ nm -C libv8_libplatform.so | grep CreateDefaultPlatform
> 3b20 *t* v8::platform::CreateDefaultPlatform(int)
>
> I inspected the ninja files, and realized this happens because object
> files are compiled with -fvisibility=default in debug mode, and with
> -fvisibility=hidden in release mode.
>
> So, my question is: is this function not supposed to be used in release
> applications? Should I, then, link statically against the many individual
> .o files needed (as the hello-world.cc example does)? If so, what's the
> best way to do this?
>
> Thanks in advance,
> Andre
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] linking error while building V8 for Android device using GN and Ninja

2016-09-21 Thread Yakir E
Hi all, 
I am trying in the last few days to build V8 for Android. I am using Ubuntu 
64bit as the build machine. After a lot of tries I was able to make ninja 
to start the build but after compiling few hundreds of files I get the 
following linking error

*unrecognised emulation mode: aarch64linux*

my GN args file is 



*target_os = "android"target_cpu = "arm64"is_debug = falseis_clang = true*

I guess the first issue is that instead of trying to build the lib for 
device it trying to build an emulation build but I don't really understand 
why it does that since I asked for Android arm64.

Please advice,
Thanks
Yakir 

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.