If you look at the symbols in your libs is it in there anywhere?

On Saturday, December 30, 2017 at 10:01:28 AM UTC-8, Bogdan Padalko wrote:
>
> Thanks for quick reply! Unfortunately, it's the same. I ended up with 
> hello world example after to trying out to use NewDefaultPlatform with 
> php-v8 (
> https://github.com/pinepain/php-v8/blob/53a562e10c23e5f835b2ccdb20967f9c4aef529e/src/php_v8_a.cc#L34),
>  
> which yield me there
>
> /home/vagrant/.phpbrew/php/7.2-debug/bin/php: symbol lookup error: /home/
> vagrant/php-v8/modules/v8.so: undefined symbol: 
> _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE
>
> With CreateDefaultPlatform it works just fine, and there was no other 
> changes to sources except of using v8 6.5.116 and using NewDefaultPlatform. 
> Bare 6.5.116 with CreateDefaultPlatform works fine.
>
>
> On Saturday, December 30, 2017 at 7:28:25 PM UTC+2, Ben Noordhuis wrote:
>>
>> On Sat, Dec 30, 2017 at 5:54 PM, Bogdan Padalko <zaq17...@gmail.com> 
>> wrote: 
>> > Hi! 
>> > 
>> > I'm trying to adapt changes from 
>> > 
>> https://github.com/v8/v8/commit/ffee558e14e28fc8b1f9a3c10ea3615e0d686c7b 
>> to 
>> > replace CreateDefaultPlatform with NewDefaultPlatform calls, however, 
>> for 
>> > some reason I'm getting 
>> > 
>> > /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined 
>> reference 
>> > to `v8::platform::NewDefaultPlatform(int, 
>> v8::platform::IdleTaskSupport, 
>> > v8::platform::InProcessStackDumping, 
>> std::unique_ptr<v8::TracingController, 
>> > std::default_delete<v8::TracingController> >)' 
>> > 
>> > error with the following code: 
>> > 
>> > #include <v8.h> 
>> > #include <libplatform/libplatform.h> 
>> > 
>> > #include <stdlib.h> 
>> > #include <string.h> 
>> > 
>> > using namespace v8; 
>> > 
>> > void weak_callback(const 
>> v8::WeakCallbackInfo<v8::Persistent<v8::String>>& 
>> > data) { 
>> >   printf("Weak callback called\n"); 
>> >   data.GetParameter()->Reset(); 
>> > } 
>> > 
>> > int main(int argc, char* argv[]) { 
>> >   // Initialize V8. 
>> >   v8::V8::InitializeICU(); 
>> > //  v8::Platform *platform = v8::platform::CreateDefaultPlatform(); 
>> > //  v8::V8::InitializePlatform(platform); 
>> > 
>> >   std::unique_ptr<v8::Platform> platform = 
>> > v8::platform::NewDefaultPlatform(); 
>> >   v8::V8::InitializePlatform(platform.get()); 
>> > 
>> >   V8::Initialize(); 
>> > 
>> >   v8::Isolate::CreateParams create_params; 
>> >   create_params.array_buffer_allocator = 
>> > v8::ArrayBuffer::Allocator::NewDefaultAllocator(); 
>> > 
>> >   // Create a new Isolate and make it the current one. 
>> >   Isolate* isolate = v8::Isolate::New(create_params); 
>> > 
>> >   v8::Persistent<v8::String> test; 
>> > 
>> >   { 
>> >     Isolate::Scope isolate_scope(isolate); 
>> > 
>> >     // Create a stack-allocated handle scope. 
>> >     HandleScope handle_scope(isolate); 
>> > 
>> >     // Create a new context. 
>> >     Local<Context> context = Context::New(isolate); 
>> > 
>> >     // Enter the context for compiling and running the hello world 
>> script. 
>> >     Context::Scope context_scope(context); 
>> > 
>> > 
>> >     test.Reset(isolate, String::NewFromUtf8(isolate, "Hello' + ', 
>> > World!'")); 
>> >     test.SetWeak(&test, weak_callback, 
>> v8::WeakCallbackType::kParameter); 
>> > 
>> > 
>> >     // Create a string containing the JavaScript source code. 
>> >     Local<String> source = String::NewFromUtf8(isolate, "(2+2*2) + ' ' 
>> + 
>> > 'Hello' + ', World!'"); 
>> > 
>> >     // Compile the source code. 
>> >     Local<Script> script = Script::Compile(source); 
>> > 
>> >     // Run the script to get the result. 
>> >     Local<Value> result = script->Run(); 
>> > 
>> >     // Convert the result to an UTF8 string and print it. 
>> >     String::Utf8Value utf8(isolate, result); 
>> >     printf("%s\n", *utf8); 
>> >   } 
>> > 
>> >   isolate->LowMemoryNotification(); 
>> > 
>> > 
>> >   // Dispose the isolate and tear down V8. 
>> >   isolate->Dispose(); 
>> >   V8::Dispose(); 
>> >   V8::ShutdownPlatform(); 
>> > 
>> >   return 0; 
>> > } 
>> > 
>> > build script: 
>> > 
>> > #!/bin/bash 
>> > 
>> > ROOT=/opt/libv8-6.5 
>> > LIB_DIR=$ROOT/lib/ 
>> > 
>> > SRC_DIR=$ROOT 
>> > INCLUDE_DIR=$ROOT/include 
>> > 
>> > set -x 
>> > 
>> > g++ -std=c++14 hello_world.cpp -o hello_world \ 
>> >  -g \ 
>> >  -O2 \ 
>> >  -std=c++11 \ 
>> >  -I$INCLUDE_DIR \ 
>> >  -L$LIB_DIR \ 
>> >  -Wl,-rpath,$LIB_DIR \ 
>> >  -lv8_libbase \ 
>> >  -lv8_libplatform \ 
>> >  -lv8 \ 
>> >  -lpthread 
>> > 
>> > I use v8 build with the following params: 
>> > 
>> > gn gen out.gn/x64.release --args="is_debug=false 
>> is_component_build=true 
>> > v8_use_external_startup_data=false" 
>> > ninja -v d8 -C out.gn/x64.release 
>> > 
>> > Host is x64 Ubuntu 16.04, libv8 installed from my pinepain/libv8-6.5 
>> PPA 
>> > (https://launchpad.net/~pinepain/+archive/ubuntu/libv8-6.5) 
>> > 
>> > I'd really appreciate if anybody give it a look and provide some 
>> suggestions 
>> > as after spending two days with this I think I just missing something 
>> very 
>> > simple and obvious. 
>> > 
>> > Regards, 
>> > Bogdan 
>>
>> It sounds like a link order issue.  What happens when you put `-o 
>> hello_world` last? 
>>
>

-- 
-- 
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.

Reply via email to