|
HowToBuild
How to build mod_pagespeed from source
PrerequisitesThe build has been tested on Ubuntu Hardy/Lucid and CentOS 5.4. It should work elsewhere; if you try it somewhere new, please leave a comment with your success or failure. We require Apache (>= 2.2), g++ (>= 4.1), Python (>= 2.6), subversion, gperf, and make.
To build on CentOS 5.4, you must install Python 2.6. You don't need to replace the system-provided Python 2.4 -- you just need to have "which python" point to python 2.6. For example: wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm sudo rpm -ivh epel-release-5-4.noarch.rpm cd ~/bin (or somewhere in your path) ln -s /usr/bin/python26 python Chromium depot toolsWe require the Chromium 'depot_tools', which are used to build multiple open-source projects with dependencies on other open-source projects. mkdir -p ~/bin cd ~/bin svn co http://src.chromium.org/svn/trunk/tools/depot_tools You will need to add the depot_tools to your path. i.e. in bash: export PATH=$PATH:~/bin/depot_tools Checking out mod_pagespeed and dependenciesmkdir ~/mod_pagespeed # any directory is fine cd ~/mod_pagespeed Either latest stable version: gclient config http://modpagespeed.googlecode.com/svn/branches/latest-beta/src gclient sync --force --jobs=1 # this will download all source code or the bleeding edge version gclient config http://modpagespeed.googlecode.com/svn/trunk/src gclient sync --force --jobs=1 # this will download all source code Running unit testscd ~/mod_pagespeed/src make BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test ./out/Release/mod_pagespeed_test ./out/Release/pagespeed_automatic_test You may get an error with Test Atime like: net/instaweb/util/file_system_test.cc:246: Failure Expected: (atime1) < (atime2), actual: 1335969574 vs 1335969574 net/instaweb/util/file_system_test.cc:253: Failure Expected: (atime2) < (atime1), actual: 1335969574 vs 1335969574 [ FAILED ] AprFileSystemTest.TestAtime (3004 ms) This happens when your file system is mounted with the noatime option. mod_pagespeed will still work, but it's cache will act as LRI (least recently inserted) instead of LRU (least recently used). This means the cache will be less effective, as it won't have statistics on what items are most accessed. mod_pagespeed will work best if you turn off 'noatime' in /etc/fstab. If you get any other errors while running tests, report a bug or send us an email at mod-pagespeed-discuss@googlegroups.com. Compiling mod_pagespeedcd ~/mod_pagespeed/src make BUILDTYPE=Release # BUILDTYPE defaults to 'Debug' To see the actual g++ commands, you can type make V=1. TODO: describe advanced compilation options such as compiling against system headers. Installing mod_pagespeedFor RPM/DEB platforms, you can use the packaging instructions in the "Building mod_pagespeed RPM/DEB packages" section below. For other platforms you can use the custom installer documented here: cd install If you built and installed the Apache web server from source (as opposed to installing using a deb/rpm package manager), you can use the install_apxs.sh script: ./install_apxs.sh The script will infer the proper installation locations for your system, based on information gathered from the Apache apxs tool. These defaults can be overridden on the command line by specifying environment variables. See the contents of the install_apxs.sh script for specific details on these environment variables. If you installed Apache in a non-default location, you may need to tell the script where to find the apxs tool, like so: # Specify the path to your apxs binary APXS_BIN=/usr/local/exampleapache/bin/apxs ./install_apxs.sh Alternatively, if you already know all of the installation details for your system, then you can run the Makefile with custom parameters for: APACHE_ROOT=/etc/httpd APACHE_MODULES=/etc/httpd/modules APACHE_CONTROL_PROGRAM=/etc/init.d/httpd APACHE_USER=www-data APACHE_DOC_ROOT=/var/www/html ... # see makefile for more options Run: make APACHE_ROOT=... ... staging sudo make ... install # Use make ... -n install to see the commands without executing sudo make ... stop start # Restart your apache server For the common configurations of Ubuntu and CentOS, we have included simple installer wrappers ubuntu.sh and centos.sh for your convenience. You can use these as examples to build scripts for your custom environment and then run them as: ./foo.sh staging sudo ./foo.sh install sudo ./foo.sh stop start Updating to a new versionYou can repeat the install process at any time to re-install mod_pagespeed. To update to the latest version, first configure to the latest tag, eg: gclient config http://modpagespeed.googlecode.com/svn/branches/latest-beta/src Then sync your client: gclient sync --force --jobs=1 Now you can re-build and install using the instructions above. Building mod_pagespeed RPM/DEB packagesYou can build packages using the following commands: make BUILDTYPE=Release linux_package_rpm or make BUILDTYPE=Release linux_package_deb The resulting package file will be in the out/Release directory. Monitoring a mod_pagespeed installationYou can view a simple set of real-time variables by visiting http://localhost/mod_pagespeed_statistics. By default, this page is only viewable from localhost; you can enable additional hosts in pagespeed.conf. mod_pagespeed on other systemsGentoo: http://en.gentoo-wiki.com/wiki/Apache2_mod_pagespeed (thanks to nikola.derikonjic) |
Please join http://groups.google.com/group/mod-pagespeed-discuss and email us with any questions and post issues to the issue tracker at http://code.google.com/p/modpagespeed/issues/list.
Comments placed here will be reviewed less often and are harder to respond to. Old comments have been moved to the discussion list and deleted here.
based on this (https://bugs.launchpad.net/ubuntu/+source/opencv/+bug/791527) I have added:
#include <stddef.h>
to 'third_party/opencv/src/opencv/include/opencv/cxcore.hpp' and the build finished OK. Maybe it is a bug?
I've bumped our OpenCV version in trunk to 2.3.1 which should hopefully fix the ptrdiff_t issue. However, as Shawn said, please report any issues to the mod-pagespeed-discuss group --- that sends us e-mail, so we'll see it a lot quicker than here (where it's basically a matter of scrolling all the way down on this page).
@juliocar...@gmail.com - Confirmed on Fedora 15 running Apache 2; compiling from source using latest Beta. Adding the header file fixed the issue. I had to install gperf to get as far as this error. It would seem you now need it for the lastest beta and not just the trunk.