Desktop | Mobile
Saturday, November 29, 2014, 07:33 AM JST
Posted by Yanto Suryono
I tried to build nginx from source to install it in my OpenShift.
It should be easy and straightforward, but I got problem because of my carelessness.

When I configure it, I got the following error:

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

I actually have the PCRE installed as I installed Octave before, which also requires PCRE, and without carefully reading the message, I added --with-pcre with the path to my PCRE installation and something wrong begins.

The configure completed sucessfully but when I ran make, it failed almost immediately giving:

make -f objs/Makefile
make[1]: Entering directory `<my-openshift-data-dir>/tmp/nginx-1.7.7'
cd <pcre-install-dir> \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: line 2: ./configure: No such file or directory
make[1]: *** [<pcre-install-dir>/Makefile] Error 127
make[1]: Leaving directory `<my-openshift-data-dir>/tmp/nginx-1.7.7'
make: *** [build] Error 2

Whoa... what has just happened ? Why it tried to cd to other dir and run configure again?
Took me somewhile (because of my laziness in the first place) to realize that by specifying --with-pcre, I actually specified the PCRE source dir to build instead of its installation dir!

So, for anyone who fell into the same problem like me, if you have PCRE installed instead of specifying --with-pcre, you need to tell where it is installed:

configure --with-cc-opt=-I<pcre-install-dir>/include --with-ld-opt=-L<pcre-install-dir>/lib

Leave a Comment

Fields with * are required.