我试图在C中构建一个包含短源代码的RPM,并期待RPM从中创建编译后的二进制文件,然后安装。我的spec文件(剪切版)看起来像这样:
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
%define _unpackaged_files_terminate_build 0
%prep
%setup -q
%build
%pre
if [ ! -d /opt/appdynamics/monitors ]
then echo "AppD Machine Agent is not installed"
exit 1
fi
exit 0
%install
gcc -o $RPM_BUILD_ROOT/RabbitMQCustomMonitor/rabbitmq-cluster-status -O2 $RPM_BUILD_ROOT/RabbitMQCustomMonitor/rabbitmq-cluster-status.c
install -o rabbitmq -g rabbitmq -m 0750 -s -v RabbitMQCustomMonitor/rabbitmq-cluster-status $RPM_BUILD_ROOT/usr/sbin/rabbitmq-cluster-status
在获取rpmbuild期间:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.gQZG8g
+ umask 022
+ cd /home/tomasv/rpmbuild/BUILD
+ cd /home/tomasv/rpmbuild/BUILD
+ rm -rf appdynamics-rabbitmq-1.1.0
+ /bin/tar -xf /home/tomasv/rpmbuild/SOURCES/appdynamics-rabbitmq-1.1.0.tar.gz
+ cd appdynamics-rabbitmq-1.1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.9nRliO
+ umask 022
+ cd /home/tomasv/rpmbuild/BUILD
+ cd appdynamics-rabbitmq-1.1.0
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.khTusl
+ umask 022
+ cd /home/tomasv/rpmbuild/BUILD
+ cd appdynamics-rabbitmq-1.1.0
+ gcc -o /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status -O2 /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status.c
gcc: error: /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: Bad exit status from /var/tmp/rpm-tmp.khTusl (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.khTusl (%install)
有什么想法?感谢
答案 0 :(得分:0)
移动了" gcc -o ...."部分到%构建部分。 rpmbuild:
时出现此错误Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.Qw5TQ3
+ umask 022
+ cd /home/tomasv/rpmbuild/BUILD
+ cd /home/tomasv/rpmbuild/BUILD
+ rm -rf appdynamics-rabbitmq-1.1.0
+ /bin/tar -xf /home/tomasv/rpmbuild/SOURCES/appdynamics-rabbitmq-1.1.0.tar.gz
+ cd appdynamics-rabbitmq-1.1.0
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.woqxXP
+ umask 022
+ cd /home/tomasv/rpmbuild/BUILD
+ cd appdynamics-rabbitmq-1.1.0
+ gcc -o /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status -O2 /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status.c
gcc: error: /home/tomasv/rpmbuild/BUILDROOT/appdynamics-rabbitmq-1.1.0-1.x86_64/RabbitMQCustomMonitor/rabbitmq-cluster-status.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: Bad exit status from /var/tmp/rpm-tmp.woqxXP (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.woqxXP (%build)