Building From Source

Environment Variables

The following environment variables are used during the make process, and while running and debugging pcc:

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.

Building On Unix

Prerequisites

Optional (Extensions)

  1. Either download a snapshot or get the latest source tree with subversion. Instructions are here.
  2. run "./configure"
    1. it will try to detect which extensions can be built
    2. run "./configure --help" for help on adding/removing support for extensions manually
  3. Build:
    1. To build a production version, type "make"
    2. To build a debug enabled version, type "make debug"
  4. To run the stand alone test suite (quick), type "make test"
  5. To install, type "make install"
  6. 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 run the compiler test suites to verify success. If you have any trouble building or running the test suite, try DeveloperSupport

Unix Troubleshooting

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_*
  1. 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
  1. 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.

Building On Windows

Prerequisites

Optional

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 MinGW/MSYS environment. If you don't have one, follow these steps:
    1. Install MinGW. During install, check (at least) the options "MinGW base tools", "MinGW Make" and "g++ compiler". This guide assumes installation to C:\MinGW
    2. Install MSYS. This guide assumes installation to C:\msys\1.0
    3. 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.
    4. 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
    5. 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=~/pcc
      BIGLOO_HOME=~/bigloo
      BIGLOO_VERSION=3.0c
      
      # 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
      
    6. 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
  2. Download the biglooX.X.tar.gz source package file to your home directory (c:\msys\1.0\home\USERNAME as per above)
  3. If you don't have an MSYS shell open yet, open it, then unpack bigloo with the command: "tar -zxvf biglooX.X.tar.gz"
  4. Change to the bigloo source tree directory: "cd biglooX.X"
  5. Configure bigloo. Note that to provide bigloo with a path for installation, we use the MinGW 'forward slash hack': "./configure --prefix=c:/msys/1.0/home/USERNAME/bigloo"
  6. Start bigloo build: "make". Wait.
  7. Install bigloo: "make install"
  8. Unpack a snapshot, or check out the latest code from subversion into your home directory. This HOWTO assumes the source directory "pcc"
  9. In the pcc tree, copy the correct Makefile.config: "cp Makefile.mingw Makefile.config"
  10. You now need to install several supporting libraries before the compiler and extensions will build:
    1. In the MSYS shell, type "mkdir -p /usr/local/lib /usr/local/include /usr/local/bin"
    2. libgw32c.a: place the "lib/libgw32c.a" file from the zip file into c:\msys\1.0\local\lib
    3. 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)
    4. zlib lib: unpack the zipfile to a temporary location, then:
      1. copy "bin/libz.*" to c:\msys\1.0\local\lib
    5. 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.]
    6. openssl lib: unpack the zipfile to a temporary location, then:
      1. copy "lib/*" to c:\msys\1.0\local\lib
    7. 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)
      2. copy "lib/libcurl.la", "lib/libcurl.a", "lib/libcurl.dll.a" to c:\msys\1.0\local\lib
      3. copy "lib/libcurl-4.dll" to c:\msys\1.0\local\bin
    8. 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
      2. copy all the files from the "lib" directory to c:\msys\1.0\local\lib
    9. 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
    10. 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)
      2. copy all the files from the "lib" directory to c:\msys\1.0\local\lib
    11. 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
    12. 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
    13. mysql:
      1. Make sure you're aware of the MySQL licensing policy
      2. Download at least the "Windows Essentials" package and make sure you select the Custom install and include the "C Include Files / Lib Files"
      3. 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)
      4. Download the premade libmysqlclient.a library. Copy libmysqlclient.a to c:\msys\1.0\local\lib
    14. fastcgi:
      1. rename file to libfcgi-2.4.0-1cm.tar.bz2
      2. unpack file to temporary directory (e.g. from the MSYS shell: "tar -jxvf libfcgi-2.4.0-1cm.tar.bz2")
      3. copy fcgi.dll from the "bin" directory to c:\msys\1.0\local\bin
      4. copy all the files from the "include" directory to c:\msys\1.0\local\include
      5. copy libfcgi.a from the "lib" directory to c:\msys\1.0\local\lib
    15. gtk/glade
      1. Untested in 2.9 on mingw
  11. type "make" in the root source tree