Closed GoogleCodeExporter closed 9 years ago
Hmm, I don't have FreeBSD... I wish I had some environment to reproduce it...
Original comment by umi.tan...@gmail.com
on 5 Sep 2012 at 7:33
I can give you temporary shell access to a FreeBSD box .. could you send me
your public key? => tobias dot oberstein at tavendo dot de
Alternatively, I can prepare a virtual appliance that you can import into
VirtualBox and run on your desktop.
Original comment by tobias.o...@gmail.com
on 5 Sep 2012 at 1:03
The same exact thing happens for me:
- FreeBSD 9.0-STABLE (AMD64)
- V8 3.12.10
- PostgreSQL 9.1, 9.2dev, and 9.2 release.
- gcc/g++ v4.2.1
- plv8js 2012-07-19 snapshot
I've ktraced the PostgreSQL child running the query to define the 'to_jsontext'
function on the home page after plv8 is loaded, if that helps at all.
Original comment by rubym...@gmail.com
on 12 Sep 2012 at 9:39
[deleted comment]
Even such a simple UDF fails in the FreeBSD box.
extern "C" {
#include "postgres.h"
#include "fmgr.h"
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(miniv8);
Datum miniv8(PG_FUNCTION_ARGS);
}
#include "v8.h"
using namespace v8;
Datum
miniv8(PG_FUNCTION_ARGS)
{
{
HandleScope scope;
Handle<ObjectTemplate> obj = ObjectTemplate::New();
}
PG_RETURN_BOOL(true);
}
Still I don't understand what is happening.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 7:49
Attachments:
Is this related...?
https://github.com/cowboyd/therubyracer/issues/145
Can you try adding -fPIC in SConstruct and rebuild libv8.so?
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 8:28
Ah, never mind. It's already there.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 8:32
Oh, ok. You need to build postgresql with -pthread. Try:
./configure --prefix=$HOME/local CFLAGS='-pthread'
Note: don't forget -O2 in CFLAGS for your production.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 8:42
...and installcheck still fails.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 8:45
Well, no. I was just messing up the source. It works fine with -pthread.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 8:46
I'll try with PG build with above option.
FWIW: the FreeBSD port for V8 does this patching:
/usr/ports/lang/v8/files
webmqpgdev# cat patch-SConstruct
--- SConstruct.orig 2012-02-08 09:38:50.000000000 +0800
+++ SConstruct 2012-02-08 09:50:13.000000000 +0800
@@ -115,7 +115,7 @@ LIBRARY_FLAGS = {
'CPPPATH' : [src_dir, '/usr/local/include'],
'LIBPATH' : ['/usr/local/lib'],
'CCFLAGS': ['-ansi'],
- 'LIBS': ['execinfo']
+ 'LIBS': ['pthread', 'execinfo']
},
'os:openbsd': {
'CPPPATH' : [src_dir, '/usr/local/include'],
webmqpgdev# cat patch-gyp_common.py
--- build/gyp/pylib/gyp/common.py.orig 2012-05-14 16:25:53.000000000 +0800
+++ build/gyp/pylib/gyp/common.py 2012-05-14 16:26:03.000000000 +0800
@@ -355,6 +355,8 @@ def GetFlavor(params):
'sunos5': 'solaris',
'freebsd7': 'freebsd',
'freebsd8': 'freebsd',
+ 'freebsd9': 'freebsd',
+ 'freebsd10': 'freebsd',
}
flavor = flavors.get(sys.platform, 'linux')
return params.get('flavor', flavor)
webmqpgdev#
Original comment by tobias.o...@gmail.com
on 14 Sep 2012 at 8:47
Cool! I'll try in a moment. On success, I document the steps for building on
FBSD in detail .. maybe that would be worth a page on the PLV8 wiki?
Original comment by tobias.o...@gmail.com
on 14 Sep 2012 at 8:49
To be honest, PLV8 wiki page's V8 install instruction is out of date at all.
I'll work on that soon.
Original comment by umi.tan...@gmail.com
on 14 Sep 2012 at 9:08
Ok, confirmed that adding "-pthread" during PG build did the trick! Works for
me now .. thanks alot for helping!
Build PostgreSQL
================
cd ~/build
tar xvjf ../tarballs/postgresql-9.2.0.tar.bz2
cd postgresql-9.2.0
./configure --prefix=$HOME/local CFLAGS='-O2 -pthread'
gmake
gmake install
Build Google V8
===============
cd ~/build
svn checkout http://v8.googlecode.com/svn/trunk/ v8
cd v8
export GYPFLAGS="-D OS=freebsd"
gmake dependencies
gmake native.check -j 4 library=shared strictaliasing=off console=readline
cp ./include/* ~/local/include/
cp ./out/native/lib.target/libv8.so ~/local/lib/
cp ./out/native/d8 ~/local/bin/
Build PLV8
==========
cd ~/build
git clone https://code.google.com/p/plv8js/
cd plv8js
Edit `Makefile` for
V8DIR = ${HOME}/local
gmake
gmake install
Test PLV8
=========
To test, open a first shell and do
initdb -D $HOME/pgdata
postgres -D $HOME/pgdata
..
and in a 2nd shell do:
gmake installcheck
If you run PG on non-standard port (or have multiple PGs running),
adjust the Makefile, i.e.
REGRESS = --port 5433 --host 127.0.0.1 init-extension plv8 inline json
startup_pre startup varparam
Original comment by tobias.o...@gmail.com
on 14 Sep 2012 at 9:44
Updated a little of Wiki.
Original comment by umi.tan...@gmail.com
on 19 Sep 2012 at 4:43
Original issue reported on code.google.com by
tobias.o...@gmail.com
on 27 Aug 2012 at 4:24