How to compile the samples/hello-world.cc example on ubuntu 64 bit ?

491 views
Skip to first unread message

verta...@gmail.com

unread,
Dec 25, 2016, 2:39:51 PM12/25/16
to v8-users
Hello everyone,

I am new to v8. I am trying to achieve something that should be easy, but I just can't get it right.

I have downloaded v8 via depot-tools and built it via make x64, and now I am trying to compile the hello-world example which is given in the "samples" folder.
What command am I supposed to type in ubuntu terminal for this to work, please ?

I have tried g++ hello-world.cc -o hello -I. but that fails with the following error : 

In file included from hello-world.cc:9:0:
include/libplatform/libplatform.h:8:44: fatal error: libplatform/libplatform-export.h: No such file or directory
compilation terminated.

Thank you.

Jochen Eisinger

unread,
Jan 2, 2017, 3:39:30 AM1/2/17
to v8-users
https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding explains how to compile the sample

note that if you build all of v8, the hello world sample will be compiled automatically

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

verta...@gmail.com

unread,
Jan 6, 2017, 2:25:22 PM1/6/17
to v8-users
Thank you for your answer Jochen Eisinger, but I tried this and it didn't work, of course. I couldn't switch to the 4.8 version of v8, I don't know why. Moreover, I would like to compile with an up-to-date version of v8.

Jochen Eisinger

unread,
Jan 11, 2017, 8:32:32 AM1/11/17
to v8-users
can you build a current version of V8 (using gn/ninja)?

verta...@gmail.com

unread,
Jan 31, 2017, 3:19:46 PM1/31/17
to v8-users
Hello,

Yes, I have built the current version with ninja. I have also seen that the hello-world.cc sample has been compiled when I built V8. However, I still don't know what I have to do in order to compile it myself in terminal.

"g++ I. hello-world.cc -o hello" doesn't work at all.

Nor does "g++ -I. hello_world.cpp -o hello_world -Wl,--start-group out/x64.release/obj.target/{tools/gyp/libv8_{base,libbase,external_snapshot,libplatform},third_party/icu/libicu{uc,i18n,data}}.a -Wl,--end-group -lrt -ldl -pthread -std=c++0x"

I have tried to adapt with something like
"g++ -I. hello-world.cc -o hello_world -Wl,--start-group out.gn/x64.release/obj/{libv8_{libbase,libplatform},third_party/icu/libicu{uc,i18n}}.a -Wl,--end-group -lrt -ldl -pthread"
But that doesn't work either, I get
In file included from hello-world.cc:8:0:
include/libplatform/libplatform.h:8:44: fatal error: libplatform/libplatform-export.h: No such file or directory
compilation terminated.

I really want to compile this because I have written a simple V8 program derived from Hello-World.cc and I would like it to be working.

Reply all
Reply to author
Forward
0 new messages