Skip to content
This repository was archived by the owner on Nov 9, 2019. It is now read-only.
chrisber edited this page Apr 11, 2015 · 3 revisions

Build v8 manually (obsolet) ##Building V8.Net manually

This project contains Csharp and cpp projects. We are using MonoDevelop to build the Csharp projects and gyp to build the cpp project.

  1. Clone the project

    • git clone [email protected]:chrisber/v8dotnet.git
    • cd v8dotnet
    • git submodule update --init --recursive
  2. Building Google V8

  • cd Source/V8.NET-Proxy/V8/
  • make builddeps -j 2 (2 equals the number of cpu cores available)
  • make library=shared -j 2
  1. Build V8.NET-Proxy this step build the native library. On Windows OS the library is called V8_Net_Proxy_x64.dll on Linux it is called libV8_Net_Proxy.so. The g++ option to compile libV8_Net_Proxy.so are:
    'cflags':[ '-Werror -Wall -std=c++11 -w -fpermissive -fPIC -c',], The linke options are: 'ldflags':[ '-Wall -std=c++11 -shared -fPIC',],
    'libraries:['-Wl,-rpath,. -L. -L../ -lpthread -lstdc++ -lv8 -licui18n -licuuc -lglib-2.0 -lrt libgmock.a ...*a']
    Compiling:
ls | grep cpp | awk -F. '{ system("g++  -std=c++11 -w -fpermissive -fPIC -Wl,--gc-sections-c -IV8/ "$1".cpp -o out/"$1".o ") }

Linking: g++ -Wall -std=c++11 -shared -fPIC -I../ -I../V8/ -Wl,-soname,libV8_Net_Proxy.so -o libV8_Net_Proxy.so *.o ../V8/out/native/obj.host/testing/libgtest.a ../V8/out/native/obj.target/testing/libgmock.a ../V8/out/native/obj.target/testing/libgtest.a ../V8/out/native/obj.target/third_party/icu/libicudata.a ../V8/out/native/obj.target/tools/gyp/libv8_base.a ../V8/out/native/obj.target/tools/gyp/libv8_libbase.a ../V8/out/native/obj.target/tools/gyp/libv8_libplatform.a ../V8/out/native/obj.target/tools/gyp/libv8_nosnapshot.a ../V8/out/native/obj.target/tools/gyp/libv8_snapshot.a -Wl,-rpath,. -L. -L../ -lpthread -lstdc++ -licui18n -licuuc -lv8 -lglib-2.0 -lrt -Wl,--verbose

Or use the provided v8dotnet.gyp file for compiling and linking the shared library.

    ./gyp/gyp  -Dbase_dir=`pwd` -Dtarget_arch="x64" -Dbuild_option="release" -f make --depth=. v8dotnet.gyp  --generator-output=./Build/x64.release/makefiles
     V=1 make -C ./Build/x64.release/makefiles
  1. Now we can build the C# projects. Build the V8.Net.MonoDevelop.sln via MonoDevelop or with the command:

  2. xbuild /p:Configuration=Release Source/V8.Net.MonoDevelop.sln"

  3. The last step is to copy all files into one directory

  4. Release Directory

    • libicui18n.so
    • libicuuc.so
    • libv8.so
    • libV8_Net_Proxy.so
    • V8.Net.dll
    • V8.Net.Proxy.Interface.dll
    • V8.Net.SharedTypes.dll
    • V8.Net-Console.exe
  5. Start it with mono V8.Net-Console.exe.

  6. For debugging errors these commands can be helpful.

    • LD_LIBRARY_PATH="pwd" MONO_LOG_LEVEL=debug MONO_LOG_MASK=all mono V8.Net-Console.exe for checking if the library gets loaded.
    • nm -u -C libV8_Net_Proxy.so checking for undefined symboles.
Clone this wiki locally