I just ran into this same problem and tracked down the root cause: the C_INCLUDE_PATH
environment variable. Mine happened to be set as follows:
% printenv C_INCLUDE_PATH
C_INCLUDE_PATH=/home/me/REDACTED/include:
This came from a login script somewhere that was doing something like
export C_INCLUDE_PATH=$HOME/REDACTED/include:$C_INCLUDE_PATH
while setting up my environment. That looks correct at first glance; unfortunately, it seems to be the case that foo:
is equivalent to foo:.
in this context-- that is, the empty string in that two-item colon-separated list seems to be implicitly treated the same as .
. Which effectively adds the current directory to the system include path, which makes #include <poll.h>
do the same thing as #include "poll.h"
, which is bad.
In Perl's case, the rogue include path causes Perl's poll.h
to include itself instead of /usr/include/poll.h
. Since Perl's poll.h
has a guard against multiple inclusion, the second include silently does nothing, and you end up with no poll.h
at all, which quickly leads to the compiler error we both saw. This also explains why your patch makes the problem go away: there is no ./sys/poll.h
in the build directory, so the compiler ends up finding /usr/include/sys/poll.h
, which ultimately happens to be what you wanted.
My solution was to get rid of the stray colon in C_INCLUDE_PATH
. In my case, I found the script that was setting it incorrectly and fixed it so that it explicitly checks for the case where the previous C_INCLUDE_PATH
was empty, and not add a colon in that case. Of course, as a quick one-off fix, I could also have manually run export C_INCLUDE_PATH=/home/me/REDACTED/include
or just unset C_INCLUDE_PATH
before building Perl.
On CentOS you should be able to just run yum install php-dom
or yum install php-xml
. That will install php-xml and any dependencies (such as libxslt) and give you support for dom.
In older versions of CentOS such as 4 you had to use the --enablerepo=centosplus
but this is not required in 5.
Best Answer
You can use the Remi repository (http://rpms.famillecollet.com/enterprise/7/) or the Red Hat Software Collections (somewhat harder to configure/enable, but more "trusty" as they directly come from Red Hat).