RPM构建错误:/var/tmp/rpm-tmp.xgXjYS(%build)的退出状态错误

时间:2017-08-17 16:18:31

标签: gcc centos7 rpm

我真的很擅长创建rpm包,请需要帮助。我试图在CentOS7机器上为GCC 5.2创建一个rpm包,但是出现了这个错误:

> > /bin/ld: cannot find crti.o: No such file or directory
/bin/ld: cannot find -lc
/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make[5]: *** [libgcc_s.so] Error 1
make[5]: Leaving directory `/home/build/rpmbuild/BUILD/gcc-5.2.0/x86_64-redhat-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/home/build/rpmbuild/BUILD/gcc-5.2.0/x86_64-redhat-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/home/build/rpmbuild/BUILD/gcc-5.2.0/x86_64-redhat-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/build/rpmbuild/BUILD/gcc-5.2.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/build/rpmbuild/BUILD/gcc-5.2.0'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.xgXjYS (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.xgXjYS (%build)

SPEC文件:

> Name:           gcc
Version:        5.2.0
Release:        1%{?dist}
Summary:        GNU Compiler Collection 

License:        GPL
URL:            https://gcc.gnu.org/
Source0:        %{name}-%{version}.tar.gz    

BuildRequires:  gettext
Requires(post): info
Requires(preun): info

%description
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go, as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.

%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
%make_install
%find_lang %{name}
rm -f %{buildroot}/%{_infodir}/dir

%post
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun
if [ $1 = 0 ] ; then
/sbin/install-info
--delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

%files -f %{name}.lang
%doc README AUTHORS ChangeLog
%(_mandir)/manl/gcc.1.gz
%(_infodir)/%{name}.info.gz
%{_bindir}/gcc

%changelog
* Wed Aug 16 2017 masrur <mdmasrur3426@gmail.com> 5.2.0-1
- Initial gcc Package for CentOS 7

我使用youtube教程中的配置配置了spec文件。 我不确定我是否正确或为什么我得到错误。

1 个答案:

答案 0 :(得分:1)

我不建议您创建自己的gcc包。有很多可用的包。所以要么

  • 找到适合您平台的已编译软件包
  • 找到类似平台的src.rpm并尝试重建rpm(使用{{1}}
  • 如果需要,从现有的src.rpm修补源文件或spec文件以使其编译

所有这些步骤将为您提供更好,更快的结果。选项是按容易度的降序来听...所以最好从第一个开始。您可以在http://rpm.pbone.net/上查找rpms,或者只查看Google ...