Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d1af93e

Browse files
committed
update build instructions
1 parent ff1b080 commit d1af93e

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

‎README.Linux.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ V8Js on GNU/Linux
33

44
Installation of V8Js on GNU/Linux is pretty much straight forward.
55

6-
The biggest hurdle actually is that you need a rather new V8 library.
7-
However many distributions still ship the rusty version 3.14, published
8-
years ago.
6+
First you need to decide if you can go with a V8 library that is
7+
shipped with your GNU/Linux distribution or whether you would want
8+
to compile V8 on your own.
99

10-
This means that you usually need to compile V8 on your own before
11-
you can start to compile & install V8Js itself.
10+
Many GNU/Linux distributions, for example Debian/Ubuntu, have
11+
recent V8 library versions installable, that are ready to be used.
12+
In order to go with these, just `sudo apt-get install libv8-dev`
13+
(or similar, as it fits your distribution).
1214

13-
It is recommended to install the V8 version for V8Js off your system's
14-
load path, so it doesn't interfere with the V8 library shipped with your
15-
system's distribution.
15+
If you compile V8 on your own, it is recommended to install the V8
16+
version for V8Js off your system's load path, so it doesn't interfere
17+
with the V8 library shipped with your system's distribution.
1618

1719

1820
Snapshots
@@ -51,12 +53,34 @@ then you
5153
`CPPFLAGS="-DV8_COMPRESS_POINTERS"` to the `./configure` call.
5254

5355

56+
Sandbox
57+
-------
58+
59+
V8 has optional sandbox support. You need to compile php-v8js with matching
60+
configurations. If your V8 library was called with sandbox support, you
61+
need to pass the `-DV8_ENABLE_SANDBOX` flag to the configure call.
62+
63+
By default V8 currently enables this feature.
64+
Many GNU/Linux distributions currently seem to have sandbox feature turned
65+
off however.
66+
67+
If you configure it the wrong way round, you'll get runtime errors like this,
68+
as soon as php-v8js tries to initialize V8:
69+
70+
```
71+
Embedder-vs-V8 build configuration mismatch. On embedder side sandbox is DISABLED while on V8 side it's ENABLED.
72+
```
73+
74+
In order to compile V8 with sandbox support off, pass `v8_enable_sandbox=false`
75+
to v8gen.py invocation.
76+
77+
5478
Compile V8 5.6 and newer (using GN)
5579
-----------------------------------
5680

5781
```
5882
# Install required dependencies
59-
sudo apt-get install build-essential curl git python libglib2.0-dev
83+
sudo apt-get install build-essential curl git python3 libglib2.0-dev
6084
6185
cd /tmp
6286
@@ -69,8 +93,8 @@ fetch v8
6993
cd v8
7094
7195
# (optional) If you'd like to build a certain version:
72-
git checkout 8.0.426.30
73-
gclient sync
96+
git checkout 12.0.267.36
97+
gclient sync -D
7498
7599
# Setup GN
76100
tools/dev/v8gen.py -vv x64.release -- is_component_build=true use_custom_libcxx=false
@@ -101,7 +125,7 @@ cd /tmp
101125
git clone https://github.com/phpv8/v8js.git
102126
cd v8js
103127
phpize
104-
./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS"
128+
./configure --with-v8js=/opt/v8 LDFLAGS="-lstdc++" CPPFLAGS="-DV8_COMPRESS_POINTERS -DV8_ENABLE_SANDBOX"
105129
make
106130
make test
107131
sudo make install

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /