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
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++"
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 build/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++"