My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 15, 2009 by sgbeal
Labels: Phase-UserDocs, Phase-Implementation, Featured, Topic-Project
BuildingTheCode  
Configuring and building the source tree

Requirements and prerequisites

Caveat #1: the main/complete build tree will ONLY work on GNU platforms, or Unix-like platforms which host GNU toolsets (including GNU-compatible versions of the basic system tools, gcc, and GNU Make 3.81). It won't compile as-is (or will compile but not link) on Cygwin or Mac platforms (i only have Linux boxes, so that's what my build tools target). i would really like to port (or get someone else to port) the tree to scons at some point (for platform compatibility), but i have no experience with scons. Once the tree is restructured how i want it, i'll revisit scons (which can live in parallel with my own personal favourite, Make).

Caveat #2: there is a minimal build configuration for scons, but it can't do much and requires manual tweaking of the SConstruct file. See the section on scons down below.

The sources have only two hard dependencies: Google v8 and the STL (which comes with all sane C++ compilers and is also available separately via projects like STLPort). For plugins to work it needs (on Unix platforms) libdl or libltdl. (For Windows platforms the DLL support needs no additional libraries.)

Configuring and compiling

The build is fairly conventional:

./configure ... options (see below) ...
make
make install # installs under the path defined by --prefix=/path

My default build options is make -j2 for parallel building, so the tree is believed to build okay with parallel builds (if it doesn't, please file a bug report). That said, certain parts of the tree enforce that certain directory branches are built before others, so certain branches may not allow parallelization. Even without parallelization it builds quickly (currently (20090312) it takes about 6 seconds on a 2GHz PC).

The following configuration options are often helpful or necessary:

See SourceTreeOverview for info on how the tree is laid out.

Installation

Run make install to install the library under the directory specified by the --prefix=/path configure argument.

If you need to do a custom installation, here's what you'll need to copy (and to where):

The makefile also supports make uninstall.

Using SCons

As of 20090313 the tree has very minimal support for a build using SCons.

Finally, just type scons. All buildable objects will be created in the top of the source tree.

To install it, follow the instructions shown above for a manual installation.

Achtung: the scons build actually depends on certain header files which are generated by the make-based build process. The copies of those generated files "might" not be as current as their generated forms.

Building on Windows and Mac

Good luck! i use Windows only for gaming and i've been boycotting Apple since the mid 1990's, so i cannot personally support building on such platforms. i am happy to accept patches, or even whole new build options (e.g. a MSVC project file), for such platforms, but cannot personally test or maintain them.


Comment by lpsantil, Sep 23, 2009

Two things about building on a 10.5 Mac: 1) There is no ldd. otool -L is supposed to be equivalent. For some, toc2/test/gnu_cpp_test.sh checks for ldd but it does not seemed to be used elsewhere. 2) I'm not getting stuck on looking for libv8/v8.h. I have v8 built in ~/Desktop/build/v8 but running ./configure --v8-prefix=~/Desktop/build/v8 returns...

Looking for libv8 headers and libraries...
=?= find_header? Looking for header file v8.h :-) v8.h :-) find_header? Using v8 CPPFLAGS: -I/Users/lpsantil/Desktop/build/v8/include Searching for v8 library: Debuggering not enabled. Preferring libv8 over libv8_g. Looking for libv8.a Looking for libv8.so Looking for libv8_g.a Looking for libv8_g.so Could not find libv8 any of these paths:
/Users/lpsantil/Desktop/build/v8/libnt/usr/local/libnt/usr/libnt/usr/local/libnt/Users/lpsantil/lib
:-( toc2_die: exiting with error code 127. Missing required v8 library :'-(

It would seem test/message/testcfg.py is getting confused. I'm trying the SConstruct file now.

Comment by sgbeal, Sep 24, 2009

The "default" build tools will only work on Unix-like platforms, and Mac isn't quite Unix enough. i'm perfectly happy to accept patches for getting it to work on Mac, but i don't have a Mac (i've boycotted Apple since the mid 1990's), so i can't personally test such patches.

For the second part of the problem, libv8.{so,a} must be somewhere in the search path used by the configure script. The default path is: ${v8_prefix}/lib, PREFIX/lib, /usr/lib, /usr/local/lib, $HOME/lib, where ${v8_prefix} can be specified by passing --v8-prefix to the configure script.

You could also try the scons build, but it's very minimal and requires manual tweaking of the SConstruct file (i'm no scons expert).

Comment by lpsantil, Oct 08, 2009

Ok....I've figured out what's needed to get v8-juice configured w/toc on Max OSX 10.6: 1) Download & build v8 with scons arch=x64 mode=release library=static 2) in $V8_SRC_DIR, do mkdir lib, cp libv8.a lib/ 2) ln -s otool ldd 3) (Using macports), install everything that toc complains about (gmake, findutils, gnutar, and maybe some others, I'll produce what I have installed w/macports below ) 4) configure v8-juice with the --v8-prefix dir

Now I'm off to go try and build v8-juice. Which me luck.

port installed The following ports are currently installed:

apr @1.3.8_0 (active) apr-util @1.3.9_0 (active) autoconf @2.64_2 (active) automake @1.11_0 (active) binutils @2.19_0 (active) bzip2 @1.0.5_3+darwin (active) ccrypt @1.9_0 (active) cryptlib @3.3.3_0+darwin+darwin_10 (active) curl @7.19.6_0 (active) cyrus-sasl2 @2.1.23_0+kerberos (active) db46 @4.6.21_5 (active) diffutils @2.8.1_3 (active) expat @2.0.1_0 (active) findutils @4.4.2_0 (active) fontconfig @2.7.3_0+macosx (active) freetype @2.3.9_1+macosx (active) gdbm @1.8.3_1 (active) gettext @0.17_4 (active) git-core @1.6.4.4_0+doc (active) GitX @0.7.1_0 (active) gmake @3.81_0 (active) gnutar @1.22_1 (active) gperf @3.0.4_0 (active) help2man @1.36.4_1 (active) libiconv @1.13_0 (active) libidn @1.15_0 (active) libmcrypt @2.5.8_1 (active) libtool @2.2.6a_0 (active) m4 @1.4.13_0 (active) mcrypt @2.6.8_0 (active) mhash @0.9.9.9_0 (active) ncurses @5.7_0+darwin_10 (active) ncursesw @5.7_0+darwin_10 (active) neon @0.28.6_0 (active) openssl @0.9.8k_0+darwin (active) p5-error @0.17015_0 (active) p5-locale-gettext @1.05_0 (active) perl5 @5.8.9_0 (active) perl5.8 @5.8.9_3 (active) pkgconfig @0.23_1 (active) popt @1.15_0 (active) python25 @2.5.4_7+darwin_10+macosx (active) python31 @3.1.1_0+darwin (active) readline @6.0.000_2+darwin (active) rsync @3.0.6_0 (active) scons @1.2.0_0 (active) serf @0.3.0_0 (active) sqlite3 @3.6.18_0 (active) subversion @1.6.5_0 (active) tcl @8.5.6_0+darwin (active) tk @8.5.6_1+darwin (active) wget @1.12_0 (active) Xft2 @2.1.13_2 (active) xorg-bigreqsproto @1.1.0_0 (active) xorg-inputproto @1.5.1_0 (active) xorg-kbproto @1.0.3_0 (active) xorg-libX11 @1.2.2_0 (active) xorg-libXau @1.0.5_0 (active) xorg-libXdmcp @1.0.3_0 (active) xorg-libXext @1.0.99.4_1 (active) xorg-libXScrnSaver @1.2.0_0 (active) xorg-renderproto @0.11_0 (active) xorg-scrnsaverproto @1.2.0_0 (active) xorg-util-macros @1.3.0_0 (active) xorg-xcmiscproto @1.2.0_0 (active) xorg-xextproto @7.1.1_0 (active) xorg-xf86bigfontproto @1.2.0_0 (active) xorg-xproto @7.0.16_0 (active) xorg-xtrans @1.2.4_0 (active) xrender @0.9.4_6 (active) zlib @1.2.3_3 (active)

Comment by lpsantil, Oct 08, 2009

make Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src

Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src/include
Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src/include/v8
Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src/include/v8/juice
make4?: Nothing to be done for `all'.
Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src/lib
Making 'all' in /Users/lpsantil/Desktop/build/v8juice.20091008/src/lib/juice
Generating c-dlls rules: libv8-juice g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o PathFinder?.o PathFinder?.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o PathFinder?-js.o PathFinder?-js.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o cleanup.o cleanup.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o convert.o convert.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o plugin.o plugin.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o juice.o juice.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o JSClassCreator.o JSClassCreator.cc cc -o ../../../mkdep-toc2 /Users/lpsantil/Desktop/build/v8juice.20091008/toc2/bin/mkdep-toc2.c + cc -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -o whprintf.o whprintf.c g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o jssprintf.o jssprintf.cc g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -o time.o time.cc + g++ -pipe -O2 -DNDEBUG -fPIC -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -I/Users/lpsantil/Desktop/build/v8/include -c -I. -I/Users/lpsantil/Desktop/build/v8juice.20091008/src/include -I/Users/lpsantil/sw/include -o mutex.o mutex.cpp + ar crs libv8-juice.a PathFinder?.o PathFinder?-js.o cleanup.o convert.o plugin.o juice.o JSClassCreator.o whprintf.o jssprintf.o time.o mutex.o g++ -pipe -O2 -DNDEBUG -fPIC -o libv8-juice.so --export-dynamic -shared -Wl,-soname=libv8-juice.so PathFinder?.o PathFinder?-js.o cleanup.o convert.o plugin.o juice.o JSClassCreator.o whprintf.o jssprintf.o time.o mutex.o -ldl -rdynamic ld: unknown option: -soname=libv8-juice.so collect2: ld returned 1 exit status make3?: libv8-juice.so? Error 1 make2?: subdir-juice? Error 2 make1?: subdir-lib? Error 2 make: subdir-src? Error 2

Comment by lpsantil, Oct 08, 2009

Whoops...the above is as far as I got. :/ I'll work on this more tomorrow.

Comment by sgbeal, Oct 10, 2009

i can promise you that the existing build tree WILL NOT build on Mac systems. It (http://toc.sf.net) was designed on/for Linux-like systems (since those are the only ones i work with on a regular basis). Though Mac uses gcc, the options to link libraries on Mac are much different.

There are at least two options:

a) If you are up to the task of patching the build tools, the fix for the above problem should go in toc2/make/c-dlls.make.

b) Try building with scons (be sure to edit the top-level SConstruct file to suit your system).


Sign in to add a comment
Hosted by Google Code