build的时候报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (psutils-compile) on project ambari-metrics-host-monitoring: An Ant BuildException has occured: exec returned: 1
[ERROR] around Ant part ..."true" dir="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil" executable="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap">... @ 4:275 in /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/target/antrun/build-psutils-compile.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (psutils-compile) on project ambari-metrics-host-monitoring: An Ant BuildException has occured: exec returned: 1
around Ant part ..."true" dir="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil" executable="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap">... @ 4:275 in /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/target/antrun/build-psutils-compile.xml
根据该错误信息,打开xml文件:
<project name="maven-antrun-" default="psutils-compile" >
<target name="psutils-compile">
<exec failonerror="true" dir="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil" executable="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap">
<arg value="setup.py"/>
<arg value="build"/>
<arg value="--build-platlib"/>
<arg value="/root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build"/>
exec>
target>
project>
带上参数执行了一下wrap:
[root@bluejoe0 apache-ambari-2.4.2-src]# /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/uniython-wrap setup.py build --build-platlib /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build
/usr/bin/python2: can't open file 'setup.py': [Errno 2] No such file or directory
[root@bluejoe0 apache-ambari-2.4.2-src]# cd /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/psutil
[root@bluejoe0 psutil]# /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/../../ambari-common/src/main/unix/ambari-python-wrap setup.py build --build-platlib /root/apache-ambari-2.4.2-src/ambari-metrics/ambari-metrics-host-monitoring/target/psutil_build
running build
running build_py
running build_ext
building '_psutil_linux' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.6/psutil/_psutil_linux.o
psutil/_psutil_linux.c:12:20: error: Python.h: No such file or directory
In file included from psutil/_psutil_linux.c:23:
psutil/_psutil_linux.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:14: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.h:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
psutil/_psutil_linux.c: In function ‘ioprio_get’:
psutil/_psutil_linux.c:50: warning: implicit declaration of function ‘syscall’
类似这样的错误,在网上查了一下,告知需要安装python-devel版本,因此:
yum install python-devel.x86_64
然后再重新build,问题消失了!!
ambari-agent start
/usr/sbin/ambari-agent: line 23: buildNumber: unbound variable
个人判断这是安装程序的bug,打开ambari-agent脚本,把${buildNumber}换成一个数字如:2.4.0.0即可。