Tag: v8

building v8 with mingw32… not yet

Building v8 with mingw32 is not quite stable yet.

In the latest revision of the trunk, you need to tweak some piece of code in platform-win32.cc for it to compile.

Then, when you do get it to compile there is a nasty bug using a get accesor inside a anonymous method, wich doesn’t crashes on other platforms/compiler.

v8-users group discussions related to this bug.

In conclusion, to avoid losing your time like I did, you should use MSVC 😉

building v8 using mingw on windows

By default v8 only builds on MSVC for Windows. It also supports building with mingw, but it is not documented anywhere and I’ve lost some time finding how. So here it is, easy steps for whoever needs it.

Prerequisites

1. v8 source code (of course), in my case I used trunk.

svn checkout http://v8.googlecode.com/svn/trunk/ v8

2. scons (building tool used by v8)

http://prdownloads.sourceforge.net/scons/scons-1.3.0.win32.exe

3. mingw32 (gcc 4.x.x is required to build v8)


binutils-2.20.1-2-mingw32-bin.tar.gz
gcc-full-4.4.0-mingw32-bin-2.tar.lzma
make-3.81-20090914-mingw32-bin.tar.gz
mingwrt-3.15.2-mingw32-dev.tar.gz
mingwrt-3.15.2-mingw32-dll.tar.gz
w32api-3.13-mingw32-dev.tar.gz

You can get those from http://sourceforge.net/projects/mingw/files/.

Building v8 with mingw

1. Using the “toolchain=gcc” command line paremeter doesn’t work, so you need to modify Scons.

a) Open file C:\Python26\Lib\site-packages\scons-1.3.0\SCons\Tool\__init__.py
b) Find the line “if str(platform) == ‘win32’:”
c) Modify the tools lists to use mingw tools instead of msvc tools by default.

Should look something like this once done:

linkers = ['gnulink', 'mslink', 'ilink', 'linkloc', 'ilink32' ]
c_compilers = ['mingw', 'msvc', 'gcc', 'intelc', 'icl', 'icc', 'cc', 'bcc32' ]
cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++', 'bcc32' ]
assemblers = ['nasm', 'masm', 'gas', '386asm' ]
fortran_compilers = ['g77', 'gfortran', 'ifl', 'cvf', 'f95', 'f90', 'fortran']
ars = ['ar', 'mslib', 'tlib']
other_plat_tools=['msvs','midl']

2. Open a command line (cmd.exe)

3. Set you environment path (if required)


set path=c:\python26;c:\python26\scripts;c:\mingw\bin;%PATH%

4. Build v8


scons mode=debug visibility=default

note: the visibility=default parameter is required otherwise gcc generate a warning (as an error) and the build doesn’t work.

note: currently (revision 4432) only static debug mode works with mingw building, debug=release produce errors (warning as error) and so does library=shared (building dll). Will try to fix this in a next post.

Have fun with v8 😉