Created
March 26, 2014 19:14
-
-
Save cfiorini/9791020 to your computer and use it in GitHub Desktop.
OSX Mavericks + Brew + PostgreSQL 9.3 + V8 3.14.5 + PLV8JS 1.4.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I spent hours to get plv8js works on my macbookpro with mavericks osx and this simple gist explain how i did!! | |
First of all i have already brew and postgresql installed | |
To install V8 we can use brew but we need to switch version to 3.14.5 | |
and i did in a very raw way!! | |
cd /usr/local/Library/Formula | |
vi v8.rb | |
on my laptop i have this | |
url 'https://github.com/v8/v8/archive/3.21.17.tar.gz' | |
sha1 '762dacc85a896e23a311eaed1e182f535677f4d6' | |
that i changed to | |
url 'https://github.com/v8/v8/archive/3.14.5.tar.gz' | |
sha1 '595492842ff86eaa7e8cf5cf88b2dd9a000e357f' | |
after you can install v8 just by | |
brew install v8 | |
now it's time of plv8js | |
cd /usr/local/src | |
git clone https://code.google.com/p/plv8js/ | |
cd plv8js | |
git checkout v1.4.1 | |
make | |
sudo make install | |
psql -U postgres template1 | |
CREATE EXTENSION plv8; | |
CREATE OR REPLACE FUNCTION plv8_test(keys text[], vals text[]) | |
RETURNS text AS $$ | |
var o = {}; | |
for(var i=0; i<keys.length; i++){ | |
o[keys[i]] = vals[i]; | |
} | |
return JSON.stringify(o); | |
$$ LANGUAGE plv8 IMMUTABLE STRICT; | |
SELECT plv8_test(ARRAY['name', 'age'], ARRAY['Tom', '29']); | |
plv8_test | |
--------------------------- | |
{"name":"Tom","age":"29"} | |
(1 row) |
Thanks to using this as inspiration, I've made a much easier process to get v1.4.3 up and running in just three commands (no file editing!)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, It almost worked for me. Can you help me with this error?
$ make
g++ -arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -bundle -multiply_defined suppress -o plv8.so plv8.o plv8_type.o plv8_func.o plv8_param.o coffee-script.o livescript.o -L/usr/lib -arch x86_64 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wl,-dead_strip_dylibs -lv8 -bundle_loader /usr/bin/postgres
ld: file not found: /usr/bin/postgres
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [plv8.so] Error 1