Skip to content

Instantly share code, notes, and snippets.

@robe2
Last active October 23, 2016 23:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save robe2/94afc346e301b950aa40 to your computer and use it in GitHub Desktop.
Building v8 and plv8 under mingw-w64
# I still haven't figured out how to build with gyp,
# after many hours trying downloading 700 mb of a toolchain google forces me to use,
# so I still build with a version of v8 that I know works with scons
# 1. install scons (32-bit) from http://www.scons.org/ (I think mine is 2.3.4) and I have in python 2.7 something
# 2. For this I've been using mingw-w64 on a windows 7 64-bit ((x86_64-win32-seh-rev1, Built by MinGW-W64 project) 4.8.3) , Msys
# http://mingw-w64.sourceforge.net/download.php (for the 32-bit version I use minGW-w64 w32 chain ( (rev2, Built by MinGW-W64 project) 4.8.1 with sjlj ) )
##Building V8
## Rest is script, there is some manual edit involved
OS_BUILD=64
#export PATH="/c/Python27:/c/Python27/Scripts:.:/bin:/include:/mingw/bin:/mingw/include:/c/Windows/system32:/c/Windows"
export PATH="/c/Python27:/c/Python27/Scripts:.:/bin:/include:/mingw/bin"
export PROJECTS=/projects
export V8_REL=3.14.5
cd ${PROJECTS}/v8
#svn checkout http://v8.googlecode.com/svn/${V8_REL}/ ${V8_REL}
#git clone -b $V8_REL https://chromium.googlesource.com/v8/v8.git ${V8_REL}
cd ${PROJECTS}/v8/${V8_REL}
#make clean
###Edit the SConstruct file at the root of v8 source tree line 305, 408 and remove the '-Werror'
###If you are building for 32-bit change the x64 to ia32
scons.py --warn=no-all mode=release arch=x64 toolchain=gcc importenv=PATH library=shared I_know_I_should_build_with_GYP=yes
scons.py --warn=no-all d8 mode=release arch=x64 toolchain=gcc importenv=PATH library=shared I_know_I_should_build_with_GYP=yes
strip *.dll
##you should now have a v8.dll, v8preparser.dll, d3.exe in the root of your v8/3.14.5 source tree
## building plv8
export OS_BUILD=64
export PROJECTS=/projects
export GCC_TYPE=gcc48
export PG_VER=9.4
export PGPATH=${PROJECTS}/postgresql/rel/pg${PG_VER}w${OS_BUILD}${GCC_TYPE}
export PGPORT=5444
export PGUSER=postgres
export SOURCES=/sources
cd ${PROJECTS}
if true; then
cd ${SOURCES}
SRC_PLV8JS= ${SOURCES}/plv8js
rm -rf plv8js
git clone -b r1.4 https://code.google.com/p/plv8js/ plv8js
cd plv8js
export AUTOV8_VERSION=3.14.5
export AUTOV8_DIR=${PROJECTS}/v8/$AUTOV8_VERSION
export V8_SRCDIR=${AUTOV8_DIR}
export V8_OUTDIR=${AUTOV8_DIR}
export PATH="${AUTOV8_DIR}:${AUTOV8_DIR}/include:$PATH"
git pull
make clean
USE_PGXS=1
ENABLE_COFFEE=1
export SHLIB_LINK="-lv8 -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm"
make && make install && make installcheck && strip *.dll
fi
@isapir
Copy link

isapir commented Jan 11, 2016

Hi,

I'm trying to follow your instructions in order to build plv8 for PostgreSQL-9.5 but I don't have an SConstruct file at the root of V8 source tree.

Any ideas? Thanks!

@wesjacobs
Copy link

I installed PostgreSQL 9.4 and attempted the installation for plv8. On the surface it seemed to go as expected. I did the CREATE EXTENSION plv8; it returned CREATE EXTENSION. Then I added the comments to the custom_variables in the Postgresql.conf and attempted to restart the server and it would not restart. I am running xTuple ERP on it. Any recommendations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment