So I think I found the solution. Since I'm using Xcode this works for me but I think there might be an alternative solution for command line. Here it is...
In the previous post, I mentioned that I noticed -std=gnu++0x when using V=1 while executing the make native command. (As suggested by Ben) I began to search for gnu++0x in all the files in the project. Within my search I found several files on the out folder with the following pattern "*. native.mk". I changed them and than ran the build native, and I noticed they would be replaced by gnu++0x. So this was not working. I then checked other files and noticed there was one in particular in the build folder "build/standalone.gypi". While going through the file I noticed there was a section called 'clang==1'. It was the same parameter I was setting GYP_DEFINES!! Inside there was CLANG_CXX_LANGUAGE_STANDARD which was set to gnu++0x. I changed the value to gnu++11. I also added a new parameter called CLANG_CXX_LIBRARY and set it with the value libc++. When I ran the make native I noticed the flags -std=gnu++11 and -stdlib=libc++ which was nice. But this alone did not help with the make native to work. I went ahead and also ran build/gyp_v8 -Dtarget_arch=x64 This actually changed the tools/gyp/v8.xcodeproj/project.pbxproj file to use those configs when adding the v8 project to my solution. When I hit build, I stopped getting the linking errors!!!! :D Now, while searching other errors I was getting while running the sample code I found this: https://code.google.com/p/v8/issues/detail?id=3627 Here I noticed that the poster was actually using /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ instead of using the 'which clang++' command which outputs /usr/bin/clang++. It makes sense because you could say that these are two different compilers. I think that instead if I use: export CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -std=c++11 -stdlib=libc++" export LINK="`/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -std=c++11 -stdlib=libc++" export GYP_DEFINES="clang=1 mac_deployment_target=10.9" make native I should not be getting the LINK errors!!! So to summarize: If you want the v8 xcode project to work: - Change the value *CLANG_CXX_LANGUAGE_STANDARD* to *gnu++11* in the b *uild/standalone.gypi*. (Or to the dialect used by your xcode project found in the *Build Settings*) - Add *CLANG_CXX_LIBRARY *with value *libc++ *right under *CLANG_CXX_LANGUAGE_STANDARD.* - Remember to modify it where it says *'clang==1'* - Then run *build/gyp_v8 -Dtarget_arch=x64* (Or to the target arch of your preference) If you want to build using the terminal using make: - export the following variables and run make native: *export CXX="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -std=c++11 -stdlib=libc++"export LINK="`/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -std=c++11 -stdlib=libc++"export GYP_DEFINES="clang=1 mac_deployment_target=10.9"make native* - Note I haven't tested this method, but if I get a chance I will, or if someone could do this that would be great. Well I hope this helps anyone in the future and have them compiling like a happy programmer! I know this will help my future self, since I tend to forget about these things :P 2014-10-19 8:27 GMT-07:00 Alberto Gonzalez <[email protected]>: > I'm attaching the output of the build. I did notice something: > > > /usr/bin/clang++ -std=gnu++11 -stdlib=libc++ '-DU_USING_ICU_NAMESPACE=0' > '-DHAVE_DLOPEN=0' '-DU_STATIC_IMPLEMENTATION' '-DV8_TARGET_ARCH_X64' > '-DU_I18N_IMPLEMENTATION' '-DU_ENABLE_DYLOAD=0' > -I../third_party/icu/source/common -I../third_party/icu/source/i18n -O3 > -gdwarf-2 -fstrict-aliasing -fvisibility=hidden -mmacosx-version-min=10.9 > -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter > -Wno-missing-field-initializers -Wno-deprecated-declarations > -Wno-logical-op-parentheses -Wno-tautological-compare > -Wno-return-type-c-linkage -std=gnu++0x -fno-exceptions > -fvisibility-inlines-hidden -fno-threadsafe-statics -fno-strict-aliasing > -MMD -MF > /Users/kunashu/Development/libs/v8/out/native/.deps//Users/kunashu/Development/libs/v8/out/native/obj.target/icui18n/third_party/icu/source/i18n/numfmt.o.d.raw > -c -o > /Users/kunashu/Development/libs/v8/out/native/obj.target/icui18n/third_party/icu/source/i18n/numfmt.o > ../third_party/icu/source/i18n/numfmt.cpp > > It looks like even do I specify -std=gnu++11 inside it also specifies > another -std=gnu++0x > > 2014-10-19 4:23 GMT-07:00 Ben Noordhuis <[email protected]>: > > On Sun, Oct 19, 2014 at 5:43 AM, Alberto Gonzalez <[email protected]> >> wrote: >> > Hello, >> > >> > I have been trying to compile the v8 with libc++ but I have not been >> > successful. I'm currently working with the latest verison of Xcode and >> my >> > project is using some c++11 stuff. I have tried using the following: >> > >> > export CXX="`which clang++` -std=c++11 -stdlib=libc++" >> > export LINK="`which clang++` -std=c++11 -stdlib=libc++" >> > export GYP_DEFINES="clang=1 mac_deployment_target=10.9" >> > make native >> > >> > But when I try to use the library files are generated with my xcode >> project >> > I'm getting linking errors such as: >> > >> > Undefined symbols for architecture x86_64: >> > "std::string::end() const", referenced from: >> > v8::internal::compiler::operator<<(std::ostream&, >> > v8::internal::compiler::Escaped const&) in >> libv8_base.a(graph-visualizer.o) >> > "std::string::begin() const", referenced from: >> > v8::internal::compiler::operator<<(std::ostream&, >> > v8::internal::compiler::Escaped const&) in >> libv8_base.a(graph-visualizer.o) >> > "std::string::c_str() const", referenced from: >> > v8::internal::Object::ShortPrint(v8::internal::StringStream*) in >> > libv8_base.a(objects.o) >> > v8::internal::FlagList::argv() in libv8_base.a(flags.o) >> > v8::internal::Logger::SharedLibraryEvent(std::string const&, >> unsigned >> > long, unsigned long) in libv8_base.a(log.o) >> > v8::internal::Logger::SetUp(v8::internal::Isolate*) in >> > libv8_base.a(log.o) >> > v8::internal::JavaScriptFrame::Print(v8::internal::StringStream*, >> > v8::internal::StackFrame::PrintMode, int) const in >> libv8_base.a(frames.o) >> > >> > Am I doing something wrong? or is there a different way to have the v8 >> > project build on libc++? >> > >> > Best Regards >> > >> > Alberto Gonzalez Pacheco >> >> It looks like it's not actually linking against libc++. Can you run >> `make native V=1` and post the output of the link phase? >> >> -- >> -- >> v8-users mailing list >> [email protected] >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "v8-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/v8-users/_epMtwP9NDI/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Saludos, > > Alberto Gonzalez > -- Saludos, Alberto Gonzalez -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
