V8-based JavaScript interpreter for online judging
Prebuilt Packages
The DMOJ offers prebuilt packages for Debian-based amd64 systems, although the binaries are statically linked.
We offer this as a Debian repository. First, choose the line suited to your distro. (For non-Debian distros, select the closest Debian release):
deb [arch=amd64] https://apt.dmoj.ca/ jessie main non-free
deb [arch=amd64] https://apt.dmoj.ca/ stretch main non-free
deb [arch=amd64] https://apt.dmoj.ca/ buster main non-free
Then run:
curl https://dmoj.ca/dmoj-apt.key | sudo apt-key add -
sudo apt update
sudo apt install v8dmoj
Building on Linux
You must have git
, clang
, and GNU make
installed.
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:$(pwd)/depot_tools
gclient
fetch v8
cd v8
- Find the Chrome stable v8 version on
https://omahaproxy.appspot.com/
. git checkout <the version from step 6>
.gclient sync
tools/dev/v8gen.py x64.release
- Run
gn args out.gn/x64.release
and add:is_component_build = false v8_static_library = true use_sysroot = false treat_warnings_as_errors = false icu_use_data_file = false v8_use_external_startup_data = false
ninja -C out.gn/x64.release
mkdir <path to v8dmoj>/v8lib
find out.gn/x64.release/obj/ -name '*.a' | while read -r file; do ar t "$file" | xargs ar rs "<path to v8dmoj>/v8lib/$(basename "$file")"; done
cp out.gn/x64.release/obj/third_party/icu/icudata/icudtl_dat.o <path to v8dmoj>/v8lib
ar cr <path to v8dmoj>/v8lib/libc++.a out.gn/x64.release/obj/buildtools/third_party/libc++/libc++/*
ar cr <path to v8dmoj>/v8lib/libc++abi.a out.gn/x64.release/obj/buildtools/third_party/libc++abi/libc++abi/
cp -R include <path to v8dmoj>/v8inc
cd <path to v8dmoj>
make
Building on Windows
- Download depot tools and unpack into a directory called
depot_tools
. - Open a command prompt window and
cd
into the parent directory ofdepot_tools
, and run:
You may need to adapt the version of Visual Studio and the Windows SDK.set PATH=%cd%\depot_tools;%PATH% set DEPOT_TOOLS_WIN_TOOLCHAIN=0 set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0 set WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10
gclient
fetch v8
cd v8
- Find the Chrome stable v8 version on
https://omahaproxy.appspot.com/
. git checkout <the version from step 6>
.gclient sync
tools/dev/v8gen.py x64.release
- Run
gn args out.gn/x64.release
and add:is_component_build = false v8_static_library = true treat_warnings_as_errors = false icu_use_data_file = false v8_use_external_startup_data = false
ninja -C out.gn/x64.release
mkdir [path to v8dmoj]\v8lib
for /R out.gn\x64.release\obj %f in (*.lib) do @copy /y %f [path to v8dmoj]\v8lib\ > nul
xcopy /s /y include [path to v8dmoj]\v8inc\
cd [path to v8dmoj]
nmake