|
HowToBuild
Build StepsPrecompiled PackagesIf you want to try pyv8 ASAP, we suggest you use precompiled package for your platform. Please downloads the precompiled packages for Windows and Linux/Debian. tocer also provide packages (1) (2) for ArchLinux Build the moduleJust run the setup.py with install or build command setup.py install Build the distributionJust run the setup.py with bdist or bdist_wininst command setup.py bdist_wininst Third Party LibraryPythonAs the runtime and libraries, download and install Python 2.5 or later first. set environment variable PYTHON_HOME to the python root folder BoostPyV8 use boost::python for interoperability, so, download the latest boost version and build the library. set environment variable BOOST_HOME to the boost root folder Google V8Follow the document to download and build v8 engine as static library set environment variable V8_HOME to the v8 root folder If you want to build v8 with GCC 4.x at x64 platform, you should compile v8 with PIC (Position-Independent Code) mode, and set the arch to x64 for scons. export CCFLAGS=-fPIC scons arch=x64 You may also need build Boost with '-fPIC' argument. ./bjam --clean ./bjam cxxflags=-fPIC Runtime Type Information and C++ Exception in v8 3.0From the v8 engine 3.0, the build script of v8 engine has disabled RTTI and Exception by default. It may save some bits of memory, but will broke the boost::python library and pyv8. So, we must enable it before build pyv8. For the Visual Studio, you could apply the patch or modify it by manual. Index: common.vsprops =================================================================== --- common.vsprops (Version 5952) +++ common.vsprops (Working Copy) @@ -8,12 +8,12 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="$(ProjectDir)\..\..\src;$(IntDir)\DerivedSources" - PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;ENABLE_VMSTATE_TRACKING;ENABLE_LOGGING_AND_PROFILING;ENABLE_DEBUGGER_SUPPORT" + PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=1;ENABLE_VMSTATE_TRACKING;ENABLE_LOGGING_AND_PROFILING;ENABLE_DEBUGGER_SUPPORT" MinimalRebuild="false" - ExceptionHandling="0" - RuntimeTypeInfo="false" + ExceptionHandling="1" + RuntimeTypeInfo="yes" WarningLevel="3" - WarnAsError="true" + WarnAsError="false" Detect64BitPortabilityProblems="false" DebugInformationFormat="3" DisableSpecificWarnings="4355;4800" For the GCC and other environment base on the SCons, please remove the -fno-rtti and -fno-exceptions from SConstruct Index: SConstruct
===================================================================
--- SConstruct (revision 6041)
+++ SConstruct (working copy)
@@ -126,7 +126,7 @@
'gcc': {
'all': {
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
- 'CXXFLAGS': ['$CCFLAGS', '-fno-rtti', '-fno-exceptions'],
+ 'CXXFLAGS': ['$CCFLAGS'],
},
'visibility:hidden': {
# Use visibility=default to disable this.
@@ -455,7 +455,6 @@
'gcc': {
'all': {
'LIBPATH': ['.'],
- 'CCFLAGS': ['-fno-rtti', '-fno-exceptions']
},
'os:linux': {
'LIBS': ['pthread'],Debug ModeYou could build Google v8 and PyV8 with debug mode, for more detail debug information.
scons mode=debug # x86 scons mode=debug arch=x64 #64 set DEBUG=1 # Windows export DEBUG=1 # Unix python setup.py build contribute by gaussgss FAQ1. Fail to load PyV8.so with AttributeError exception If you got the exception "AttributeError: 'Boost.Python.StaticProperty' object attribute 'doc' is read-only", please check your Python version. The Python 2.6.4 introduce a known issue which will break boost 1.40 or earlier version. Please use Python 2.5.x/2.6.3, or upgrade your boost to 1.41 or later. |
The documentation doesn't mention whether or not to build v8 shared or static.
on os x 10.5 with macports managed python:
the issue brought up on this thread was solved for me on snow leopard by removing all shared libv8 files and compiling v8 as static (and arch=x64) and copying the libv8.a file into /usr/lib (and /opt/local/lib for good measure).
also worth mentioning that on OS X you need to run setup.py with sudo, you need to set V8_HOME in the root environment. so instead of setting V8_HOME as your user, then running "sudo python setup.py install", you might want to use "sudo V8_HOME=/path/to/v8 python setup.py install".
It is better to build v8 static.
BTW: Does anyone have idea on how to compile it on FreeBSD? I have difficult on solving problem below:
%python setup.py build running build running build_py running build_ext building 'PyV8?' extension cc -fno-strict-aliasing -DNDEBUG -O2 -fno-strict-aliasing -pipe -Dwchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -fPIC -DBOOST_PYTHON_STATIC_LIB -DV8_NATIVE_REGEXP -DENABLE_DISASSEMBLER -DENABLE_LOGGING_AND_PROFILING -DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_IA32 -I../v8/include -I../v8 -I../v8/src -I/usr/include -I/usr/local/include -I/usr/local/include/python2.6 -c src/Exception.cpp -o build/temp.freebsd-7.2-RELEASE-p4-i386-2.6/src/Exception.o In file included from /usr/include/c++/4.2/ios:47, /usr/include/c++/4.2/bits/localefwd.h:58:34: error: macro "isspace" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:70:34: error: macro "isupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:74:34: error: macro "islower" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:78:34: error: macro "isalpha" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:94:34: error: macro "isalnum" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:102:34: error: macro "toupper" passed 2 arguments, but takes just 1 /usr/include/c++/4.2/bits/localefwd.h:106:34: error: macro "tolower" passed 2 arguments, but takes just 1
Hi SemigodKing?,
flier.lu,
I managed to have it compiled successfully by modifying /usr/include/c++/4.2/bits/localefwd.h. Unfortunately, the .so failed to be load.
Hi SemigodKing?,
Here is the result. It looks like the output is not a shared object for python.
%ls -al total 3962 drwxr-xr-x 2 kitty wheel 512 Apr 4 01:43 . drwxr-xr-x 4 kitty wheel 512 Apr 4 00:44 .. -rw-r--r-- 1 kitty wheel 48142 Jan 31 07:55 PyV8?.py -rw-r--r-- 1 kitty wheel 54262 Apr 4 01:43 PyV8?.pyc -rwxr-xr-x 1 kitty wheel 3924374 Apr 4 01:42 PyV8?.so %ldd -v PyV8?.so ldd: PyV8?.so: this is an ELF program; use objdump to examine
%objdump -i PyV8?.so BFD header file version 2.15 FreeBSD? 2004-05-23 elf32-i386-freebsd elf32-i386 srec symbolsrec tekhex binary ihex
build on ubuntu, no boost installed:
u should add the BOOST_HOME in setup.py: elif os.name == "posix" and sys.platform == "linux2":
i am having issues building this on OSX with this error:
full output here: http://pastie.org/1215681
what am i missing here?
thanks
Hi SnowYu?.LEE and all,
I am experiencing the same error on ubuntu 10.10 and your solution doesnt work. Any other ideas? What exactly do i need to build in Boost? - I just built the libraries. Does this suffice?
thanks,
Hi theohar,
Could you try to checkout and compile pyv8 from SVN trunk? The public API of v8 project has changed after pyv8 0.9 released, I'm working on the pyv8 1.0 which may solve your issue.
Thanks
Hello all,
I built py-v8 successfully from SVN and when i try to run a simple example I am getting this error:
import PyV8? ImportError?: libv8.so: cannot open shared object file: No such file or directory
I can see this file under v8 dir and I have V8_HOME pointing to this dir. I also tried to copy it under /usr/lib but still no luck.
Any ideas please?
Hi theohar,
Could you submit a issue to follow up your problem?
http://code.google.com/p/pyv8/issues/list
I think you must build and link v8 with the static mode