clang++ -std=c++11 -stdlib=libc++ -I. out/x64.release/libv8_base.a out/x64.release/libv8_libbase.a out/x64.release/libv8_nosnapshot.a out/x64.release/libicudata.a out/x64.release/libicuuc.a out/x64.release/libicui18n.a out/x64.release/libv8_libplatform.a hello_world.cpp -o hello_world
Worked. Thanks for the help so far. Would still like the documentation to be updated with an official tutorial for OSX and Windows. On Tuesday, March 8, 2016 at 3:20:51 PM UTC+1, Frank Lyder Bredland wrote: > > I tried to do the following: > > clang++ -std=c++11 -stdlib=libc++ -Weverything -I. > out/x64.release/libv8_base.a out/x64.release/libv8_libbase.a > out/x64.release/libv8_nosnapshot.a out/x64.release/libicudata.a > out/x64.release/libicuuc.a out/x64.release/libicui18n.a hello_world.cpp -o > hello_world > > Which gives me: > > 99 warnings generated. > Undefined symbols for architecture x86_64: > "v8::platform::CreateDefaultPlatform(int)", referenced from: > _main in hello_world-0e9dbc.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > So I guess I'm still no closer to get this to work. > > On Tuesday, March 8, 2016 at 3:06:18 PM UTC+1, Jochen Eisinger wrote: >> >> filed https://bugs.chromium.org/p/v8/issues/detail?id=4821 to track this >> >> On Tue, Mar 8, 2016 at 3:04 PM Jochen Eisinger <[email protected]> >> wrote: >> >>> Yeah, I guess we should invest in updating the tutorial for other OSs as >>> well. The set of libraries you have to link against is the same as on >>> Linux, however, the command line is different (and I don't know off the top >>> of my head how the correct command line for OSX would look like). >>> >>> On Tue, Mar 8, 2016 at 2:50 PM Frank Lyder Bredland <[email protected]> >>> wrote: >>> >>>> Seems like your correct about the tutorial being for Linux, I just >>>> assumed that it would be the same for OSX since they are both *nix >>>> systems, >>>> thats my fault. >>>> I however would wish that there also was a Windows and OSX version of >>>> the tutorial. >>>> >>>> Seems like there was a binary in ./out/x64.release/hello-world just as >>>> you said. So even if the tutorial was for Linux I guess it worked on OSX? >>>> >>>> I'd wished that this made me any wiser, but how am I supposed to link >>>> this against my own application? >>>> I mean, I guess I could just change the hello_world example and keep my >>>> whole application in that file, but I guess thats not the best way to >>>> develop C++ applications while embedding V8. >>>> >>>> What I would like to do is in some way build something that I could >>>> link against my application. >>>> >>>> How would I go about doing that? >>>> Normally for other libraries you could download the header files and >>>> some pre-build libraries for your platform. >>>> Since I can't find this option for V8 I'm guessing you have to build >>>> from source. >>>> Running "make x64.release" worked and I was able to run the hello_world >>>> example, so I guess building works. >>>> >>>> Now how would link against this on OSX? I'm at a bit of a loss, since >>>> the example is for Linux and there are no example for OSX. >>>> >>>> On Tuesday, March 8, 2016 at 2:37:06 PM UTC+1, Jochen Eisinger wrote: >>>> >>>>> >>>>> >>>>> On Tue, Mar 8, 2016 at 2:00 PM Frank Lyder Bredland < >>>>> [email protected]> wrote: >>>>> >>>>>> Okay, I'm afraid most of what your saying is gibberish to me. >>>>>> It's a bit hard trying to get V8 to work when literally the first >>>>>> example doesn't work. >>>>>> >>>>> >>>>> >>>>> The tutorial explicitly says that it's targeting Linux... >>>>> >>>>> >>>>>> Could you give me a step-to-step tutorial on how I'm supposed to >>>>>> build the hello_world example? >>>>>> >>>>> >>>>> make x64.release is enough to build hello world. it's in >>>>> out/x64.release/hello-world >>>>> >>>>> >>>>>> >>>>>> What I tried, based on the tutorial ( >>>>>> https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding) >>>>>> was the following: >>>>>> >>>>>> $ fetch v8 # do download v8 >>>>>> $ git checkout -b 4.8 -t branch-heads/4.8 # to get to the correct >>>>>> branch >>>>>> $ make x64.release # to build the lib? >>>>>> >>>>>> And then I copy-pasted the hello_world.cpp file from that page and >>>>>> tried to build it using the command that was listed there. >>>>>> Which gives me a bunch of errors for missing .a files. >>>>>> >>>>>> So my question is this: >>>>>> >>>>>> Can you explain it to me like I'm five, how to I build and run this >>>>>> hello_world.cpp example on OSX using make and gyp or whatever? >>>>>> If the example is outdated then how am I supposed to do it? >>>>>> >>>>> >>>>> The example assumes you use Linux. If you chose to deviate from some >>>>> parts of the tutorial, you're more or less on your own. >>>>> >>>>> >>>>>> >>>>>> On Tuesday, March 8, 2016 at 12:35:56 PM UTC+1, Jochen Eisinger wrote: >>>>>> >>>>>>> If you use make for your development, it should work. Just building >>>>>>> x64.release should create the hello_world binary. >>>>>>> >>>>>>> The command line from the example is still linux specific (and >>>>>>> predates the time we added hello_world to the "all" build target...) >>>>>>> >>>>>>> On Tue, Mar 8, 2016 at 12:14 PM Frank Lyder Bredland < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> I'm not sure what you mean when you say "hello_world target"? or >>>>>>>> why this shouldn't work on osx? >>>>>>>> I'm not looking to create a xcode project, just to build it using >>>>>>>> clang on the terminal. >>>>>>>> >>>>>>>> Is there any reason that "make x64.release" should not work on Mac? >>>>>>>> >>>>>>>> >>>>>>>> On Tuesday, March 8, 2016 at 11:51:49 AM UTC+1, Jochen Eisinger >>>>>>>> wrote: >>>>>>>> >>>>>>>>> This example command line only works on 64bit Linux. >>>>>>>>> >>>>>>>>> On Mac, just build the hello_world target. I don't know off the >>>>>>>>> top of my head what the corresponding command line would be for >>>>>>>>> xcodebuild, >>>>>>>>> sorry >>>>>>>>> >>>>>>>>> On Mon, Mar 7, 2016 at 5:59 PM Frank Lyder Bredland < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>> I tried to follow this guid: >>>>>>>>>> https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding >>>>>>>>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fv8%2Fv8%2Fwiki%2FGetting%2520Started%2520with%2520Embedding&sa=D&sntz=1&usg=AFQjCNGAkmnkMHKNwDI4_Ax0b6qwnWLMuw> >>>>>>>>>> >>>>>>>>>> Everything seem to work until I get to step 3 where I get the >>>>>>>>>> following: >>>>>>>>>> >>>>>>>>>> v8 git:(4.8) ✗ 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 >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/tools/gyp/libv8_base.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/tools/gyp/libv8_libbase.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/tools/gyp/libv8_external_snapshot.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/tools/gyp/libv8_libplatform.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/third_party/icu/libicuuc.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/third_party/icu/libicui18n.a' >>>>>>>>>> clang: error: no such file or directory: >>>>>>>>>> 'out/x64.release/obj.target/third_party/icu/libicudata.a' >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Any idea how to get it to work? >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> -- >>>>>>>>>> v8-dev mailing list >>>>>>>>>> >>>>>>>>> [email protected] >>>>>>>>> >>>>>>>>> >>>>>>>>>> http://groups.google.com/group/v8-dev >>>>>>>>>> --- >>>>>>>>>> You received this message because you are subscribed to the >>>>>>>>>> Google Groups "v8-dev" group. >>>>>>>>>> >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>>> send an email to [email protected]. >>>>>>>>> >>>>>>>>> >>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>> >>>>>>>>> -- >>>>>>>> -- >>>>>>>> v8-dev mailing list >>>>>>>> [email protected] >>>>>>>> http://groups.google.com/group/v8-dev >>>>>>>> --- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "v8-dev" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- >>>>>> -- >>>>>> v8-dev mailing list >>>>>> [email protected] >>>>>> http://groups.google.com/group/v8-dev >>>>>> --- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "v8-dev" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- >>>> -- >>>> v8-dev mailing list >>>> [email protected] >>>> http://groups.google.com/group/v8-dev >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "v8-dev" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
