-
Notifications
You must be signed in to change notification settings - Fork 34
BuildInstructions
The following environment variables are used during the make process, and while running and debugging pcc:BR
PCC_HOME:: The root directory of the pcc source tree. This should be defined if you will actually be developing the compiler, and working strait from the source directory. It is required to run the test suite. If you are only building and installing the compiler for use, it is not necessary. PCC_CONF:: Full path to the PCC configuration file. If this variable isn't set, the default location is /etc/pcc.conf. An example config file can be found in $PCC_HOME/doc/pcc.conf.sample LD_LIBRARY_PATH:: Depending on your setup, this may need to include the directory containing the Roadsend PHP libraries. It may also need to include the bigloo library directory.
”‘Prerequisites”’
* [ftp://ftp-sop.inria.fr/mimosa/fp/Bigloo/bigloo3.0c.tar.gz Bigloo Scheme 3.0c] (or 3.0b) * [http://curl.haxx.se/libcurl/ libcurl 7.15.x] * GNU C toolchain (gcc, ld, etc) * [http://ccache.samba.org/ ccache] can greatly speed up rebuilds
”‘Optional (Extensions)”’
* [http://mysql.org/ Mysql 4 or 5] * [http://sqlite.org/ Sqlite 3.3.x] * [http://www.pcre.org/ libpcre 6.3] * [http://xmlsoft.org/downloads.html libxml2 2.6.x] * [http://www.unixodbc.org/ UnixODBC 2.2.6] * [http://fastcgi.com/ fastcgi 2.4.0] * GTK 1.2.x Extension: [ftp://ftp.gtk.org/pub/gtk/v1.2 Gtk 1.2.x], [http://ftp.gnome.org/pub/GNOME/sources/libglade/0.17/ libglade 0.17], [http://downloads.sourceforge.net/moleskine/GtkScintilla-0.8.2.tar.gz?modtime=1013122800&big_mirror=0 GtkScintilla 0.8.2] 1. Either download a snapshot or get the latest source tree with subversion. Instructions are [wiki:GetSource here]. 1. run "./configure" 1. it will try to detect which extensions can be built 1. run "./configure --help" for help on adding/removing support for extensions manually 1. Build: 1. To build a production version, type "make" 1. To build a debug enabled version, type "make debug" 1. To run the stand alone test suite (quick), type "make test" 1. To install, type "make install" 1. To clean the source tree, type "make clean"
The main compiler binary will be built in {root}/compiler/pcc. The debugger is in {root}/compiler/pdb.
You can now [wiki:TestSuite run the compiler test suites] to verify success. If you have any trouble building or running the test suite, try DeveloperSupport
There are a few common problems that people run into while building Roadsend PHP, or using it to compile. 1. Error during Roadsend PHP build: '''pcc: error while loading shared libraries: libphp-runtime_x-X.X.so: cannot open shared object file: No such file or directory''' * You need to add the Roadsend PHP runtime directory to your LD_LIBRARY_PATH environment variable. This is the directory that contains libphp-runtime_* 2. Error during build of PDO libraries: '''../../../compiler/pcc: symbol lookup error: ../../../compiler/pcc: undefined symbol: BGl_xxxxxxx''' * You probably have an earlier version of Roadsend PHP currently installed on your system, and it's finding and using the older libraries instead of the current ones in your new source tree. The solution is to uninstall your old version first. See #3577 3. Error during PHP compile (especially statically linked): '''undefined reference to [pthread_self/pcre_study/other]''' * This happens when Roadsend PHP hasn't correctly determined the list of libraries to use during a link of your binary. You will need to edit the "(ldflags ..." directive in your pcc.conf file, and add the missing library for the extension it's linking to. For example, if you get an undefined reference to "pthread_self", you probably need to "-lpthread" to one or more extension that you are linking against.
”‘11/2009: Many thanks to Bill Dieter for a patch and update to these instructions”’
”‘Prerequisites”’
Latest versions of: * Bigloo Scheme * MinGW * MSYS
”‘Optional”’
* [http://tortoisesvn.tigris.org/ TortoiseSVN subversion client for Windows]
”‘Note”’
* The source to the Roadsend Studio IDE is not currently available. You may use the version from the binary builds on www.roadsend.com. 1. First you need a working [http://www.mingw.org MinGW/MSYS environment]. If you don't have one, follow these steps: a. Install MinGW. During install, check (at least) the options "MinGW base tools", "MinGW Make" and "g++ compiler". This guide assumes installation to C:\MinGW a. Install MSYS. This guide assumes installation to C:\msys\1.0 a. You should now have a blue "M" icon on your desktop that will give you a Unix-like shell. When you click on this, it will automatically create an MSYS user directory in C:\msys\1.0\home\USERNAME. The USERNAME will be the same one you are logged into Windows with. a. It's important to remember the location of this directory, as it is your Unix-like home directory and is mapped inside of the MSYS shell to /home/USERNAME a. You will need certain environment variables defined in your MSYS shell. The easiest way to do this is to create the file ".bashrc" in your /home/USERNAME directory:
{{{ PCC_HOME=C:/msys/1.0/local/src/pcc # or wher you put the source tree
PCC_ROOT=C:/msys/1.0/local/src/pcc # (same as PCC_HOME, but used
# in different places)
BIGLOO_HOME=C:/msys/1.0/local/src/bigloo # or wherever you compiled bigloo # NOTE this should match your real version! BIGLOO_VERSION=3.2b
# for binaries PATH=$BIGLOO_HOME/bin:/usr/local/bin:$PCC_HOME:$PCC_HOME/compiler:~/bin:$PATH
# for DLL’s PATH=$PCC_HOME/libs:$BIGLOO_HOME/lib/bigloo/$BIGLOO_VERSION:/usr/local/lib:$PATH BGL_LIBRARY_PATH=c:/msys/1.0/home/$USERNAME/bigloo/lib/bigloo/$BIGLOO_VERSION
export PATH PCC_HOME BGL_LIBRARY_PATH }}}
a. You may need to tell bash to load this file by adding ". .bashrc" to a new line at the end of the file: C:\msys\1.0\etc\profile 1. Download the biglooX.X.tar.gz source package file to your BIGLOO_HOME directory 1. If you don't have an MSYS shell open yet, open it, then unpack bigloo with the command: "tar -zxvf biglooX.X.tar.gz" 1. Change to the bigloo source tree directory: "cd biglooX.X" 1. Configure bigloo. Note that to provide bigloo with a path for installation, we use the MinGW 'forward slash hack': "./configure --prefix=$BIGLOO_HOME" 1. Start bigloo build with "make" or "make safe". NOTE if you will be compiling Roadsend PHP in "safe" mode, make sure you compile Bigloo in safe mode as well! 1. Install bigloo: "make install" 1. Unpack a [http://code.roadsend.com/snaps/ snapshot], or [wiki:GetSource check out the latest code from subversion] into your home directory. This HOWTO assumes the source directory "pcc" 1. In the pcc tree, copy the correct Makefile.config: "cp Makefile.mingw Makefile.config" 1. You now need to install several supporting libraries before the compiler and extensions will build: a. '''NOTE You may have more luck unpacking the given zip files into c:\msys\1.0\local in their entirety, instead of pulling out the individual files mentioned below ''' a. In the MSYS shell, type "mkdir -p /usr/local/lib /usr/local/include /usr/local/bin" a. [http://gnuwin32.sourceforge.net/downlinks/libgw32c-lib-zip.php libgw32c.a]: place the "lib/libgw32c.a" file from the zip file into c:\msys\1.0\local\lib a. [http://gnuwin32.sourceforge.net/downlinks/zlib-bin-zip.php zlib dll]: unpack the zipfile to a temporary location, then: 1. copy "bin/zlib1.dll" to c:\msys\1.0\local\bin\libz.dll (NOTE NAME CHANGE) a. [http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php zlib lib]: unpack the zipfile to a temporary location, then: 1. copy "bin/libz.*" to c:\msys\1.0\local\lib a. [http://gnuwin32.sourceforge.net/downlinks/openssl-bin-zip.php openssl dll]: unpack the zipfile to a temporary location, then: 1. copy "lib/libeay32.dll" and "lib/libssl32.dll" to c:\msys\1.0\local\bin\ and also copy them to files c:\msys\1.0\local\bin\libcrypto.dll and c:\msys\1.0\local\bin\libssl.dll respectively (NOTE NAME CHANGE). [this hack gets around the fact that libcurl-4.dll requires libeay32.dll and libssl32.dll but for static builds the libssl and libcrypto versions are used.] a. [http://gnuwin32.sourceforge.net/downlinks/openssl-lib-zip.php openssl lib]: unpack the zipfile to a temporary location, then: 1. copy "lib/*" to c:\msys\1.0\local\lib a. [http://curl.haxx.se/latest.cgi?curl=win32-devel-ssl libcurl-7.x.x-win32-ssl.zip]: unpack the zipfile to a temporary location, then: 1. copy the entire "include/curl" directory to c:\msys\1.0\local\include (so that c:\msys\1.0\local\include\curl directory exists) 1. copy "lib/libcurl.la", "lib/libcurl.a", "lib/libcurl.dll.a" to c:\msys\1.0\local\lib 1. copy "lib/libcurl-4.dll" to c:\msys\1.0\local\bin a. [http://gnuwin32.sourceforge.net/downlinks/pcre-lib-zip.php libpcre.lib]: unpack the zipfile to a temporary location, then: 1. copy the 2 files from the "include" directory to c:\msys\1.0\local\include 1. copy all the files from the "lib" directory to c:\msys\1.0\local\lib a. [http://gnuwin32.sourceforge.net/downlinks/pcre-bin-zip.php libpcre.dll]: unpack the zipfile to a temporary location, then: 1. copy pcre3.dll and pcreposix3.dll from the "bin" directory to c:\msys\1.0\local\bin a. [http://downloads.sourceforge.net/gnuwin32/libxml2-2.4.12-1-lib.zip libxml2.lib]: unpack the zipfile to a temporary location, then: 1. copy the entire "include/libxml2" directory to c:\msys\1.0\local\include (so that c:\msys\1.0\local\include\libxml2 directory exists) 1. copy all the files from the "lib" directory to c:\msys\1.0\local\lib a. [http://downloads.sourceforge.net/gnuwin32/libxml2-2.4.12-bin.zip libxml2.dll]: unpack the zipfile to a temporary location, then: 1. copy libxml2.dll from the "bin" directory to c:\msys\1.0\local\bin a. [http://code.roadsend.com/libs/sqlite-pcc-3.3.5.zip libsqlite3.dll]: unpack the zipfile to a temporary location, then: 1. copy bin/* to c:\msys\1.0\local\bin, lib/* to c:\msys\1.0\local\lib, and include/* to c:\msys\1.0\local\include a. mysql: 1. Make sure you're aware of the [http://www.mysql.com/company/legal/licensing/opensource-license.html MySQL licensing policy] 1. [http://dev.mysql.com/downloads/mysql/5.0.html#downloads Download] at least the "Windows Essentials" package and make sure you select the Custom install and include the "C Include Files / Lib Files" 1. Copy the files from C:\Program Files\MySQL\MySQL Server 5.0\include\* to c:\msys\1.0\local\include\mysql (make the new "mysql" directory) 1. [http://code.roadsend.com/libs/mysql-5-pcc-mingw.zip Download] the premade libmysqlclient.a library. Copy libmysqlclient.a to c:\msys\1.0\local\lib a. [http://prdownloads.sourceforge.net/devpaks/libfcgi-2.4.0-1cm.DevPak?download fastcgi]: 1. rename file to libfcgi-2.4.0-1cm.tar.bz2 1. unpack file to temporary directory (e.g. from the MSYS shell: "tar -jxvf libfcgi-2.4.0-1cm.tar.bz2") 1. copy fcgi.dll from the "bin" directory to c:\msys\1.0\local\bin 1. copy all the files from the "include" directory to c:\msys\1.0\local\include 1. copy libfcgi.a from the "lib" directory to c:\msys\1.0\local\lib a. gtk/glade 1. Untested in 2.9 on mingw 1. Patch bigloo_config.h with the patch below (otherwise bigloo will fail to find bigloo_dlopen_init at runtime for curl the extension).
{{{ — /usr/local/bigloo3.2b/lib/3.2b/bigloo_config.h 2009-08-13 08:33:21 -0400 +++ /usr/local/lib/bigloo/3.2b/bigloo_config.h 2009-09-28 10:53:24 -0400 @@ -353,7 +353,11 @@ #define BGL_EXPORTED_DECL extern
#undef BGL_EXPORTED_DEF +#ifdef BGL_BUILDING_DLL +#define BGL_EXPORTED_DEF __declspec(dllexport) +#else #define BGL_EXPORTED_DEF +#endif
#undef BGL_RUNTIME_DECL #define BGL_RUNTIME_DECL extern }}}
1. Download autoconf-2.61 or later from http://ftp.gnu.org/gnu/autoconf/ and build per instructions (./configure && make && make install) (or download binary from http://sourceforge.net/projects/mingw/files/) 1. Download gettext (latest version) from http://sourceforge.net/projects/mingw/files/ and install into /usr/local/ 1. Build pcc
{{{
cd $(PCC_ROOT)
autoconf ./configure –with-sqlite3 –prefix=“C:/msys/1.0/local” make CC=gcc safe # (assuming bigloo was built with safe) make safe install }}}