-
Notifications
You must be signed in to change notification settings - Fork 362
Building PSOL From Source
Most people will be fine using the binary distribution of PSOL to build ngx_pagespeed the standard way but if that isn't working for you or you want to make changes that require changing the PSOL core, then you need to build PSOL from source.
If you are running Centos5, or have come across this error https://github.com/pagespeed/mod_pagespeed/issues/1115.
LINK(target) out/Release/pagespeed_automatic_test
/usr/bin/ld: BFD 2.17.50.0.6-26.el5 20061020 internal error, aborting at ../../bfd/merge.c line 863 in _bfd_merged_section_offset
/usr/bin/ld: Please report this bug.
collect2: ld returned 1 exit status
You will need to install a newer version of binutils.
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz
$ tar xvf binutils-2.25.tar.gz
$ cd binutils-2.25
$ ./configure
$ make
$ sudo make install
First build mod_pagespeed at the tag we currently work at:
$ mkdir -p ~/bin
$ cd ~/bin
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=$PATH:~/bin/depot_tools
$ mkdir ~/mod_pagespeed
$ cd ~/mod_pagespeed
$ git clone https://github.com/pagespeed/mod_pagespeed.git src
$ gclient config https://github.com/pagespeed/mod_pagespeed.git --unmanaged --name=src
$ cd src/
$ git checkout ${BRANCH}
$ cd ..
$ gclient sync --force --jobs=1 # add --revision=xxxx for a specific git revision
$ make AR.host="$PWD/build/wrappers/ar.sh" \
AR.target="$PWD/build/wrappers/ar.sh" \
BUILDTYPE=Release \
mod_pagespeed_test pagespeed_automatic_test
(See mod_pagespeed: build from source if you run into trouble, or ask for help on the mailing list.)
Then build the pagespeed optimization library:
against trunk-tracking
$ cd ~/mod_pagespeed/src/pagespeed/automatic
$ make BUILDTYPE=Release \
-C ../../pagespeed/automatic \
AR.host="$PWD/../../build/wrappers/ar.sh" \
AR.target="$PWD/../../build/wrappers/ar.sh" \
all
or against master
or a 1.9.32.x
tag.
$ cd ~/mod_pagespeed/src/pagespeed/automatic
$ make BUILDTYPE=Release \
AR.host="$PWD/../../../build/wrappers/ar.sh" \
AR.target="$PWD/../../../build/wrappers/ar.sh" \
all
Check out ngx_pagespeed:
$ cd ~
$ git clone https://github.com/pagespeed/ngx_pagespeed.git
Download and build nginx:
$ cd ~
$ # check http://nginx.org/en/download.html for the latest version
$ wget http://nginx.org/download/nginx-1.8.0.tar.gz
$ tar -xvzf nginx-1.8.0.tar.gz
$ cd nginx-1.8.0/
$ MOD_PAGESPEED_DIR="$HOME/mod_pagespeed/src" ./configure \
--add-module=$HOME/ngx_pagespeed
$ make install
This assumes you put everything in your home directory; if not, change paths appropriately. All paths need to be absolute.
If ./configure
fails, check the error log in obj/autoconf.err
for details.
For a debug build change BUILDTYPE=Release
to BUILDTYPE=Debug
and add the flag --with-debug
to
./configure --add-module=...
.
If you're testing this and don't want to install this as root, which is a good
idea, you can use --prefix
, as in ./configure --add-module=... --prefix=$HOME/nginx
and then nginx will install to a single
directory inside your home directory.