While compiling a custom version of PHP (5.6.14) on a Redhat 6.5 I got the following error:
configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no
Looking around on the net didn’t find a lot of information about it.
Using a bit of logic and understanding that flock is the file locking mechanism at file system level, I thought about a missing devel header in my system about file system locking mechanism.
File lock is implemented by libtool package
yum search libtool
============================================================================================== N/S Matched: libtool ===============================================================================================
libtool-ltdl.i686 : Runtime libraries for GNU Libtool Dynamic Module Loader
libtool-ltdl.x86_64 : Runtime libraries for GNU Libtool Dynamic Module Loader
libtool-ltdl-devel.i686 : Tools needed for development using the GNU Libtool Dynamic Module Loader
libtool-ltdl-devel.x86_64 : Tools needed for development using the GNU Libtool Dynamic Module Loader
libtool.x86_64 : The GNU Portable Library Tool
Then, by just doing a simple installation of the required package (libtool-ltdl-devel) solved the issue and PHP configure process completed like a charm.
yum install libtool-ltdl-devel
I decided to document it since I noticed that many people went for the easy solution and disabled the opcache support. This has serious performance penalties and IMHO should be avoided at all costs.