2017-08-17 275 views
0

我在创建rpm包方面真的很新颖,并且需要帮助。我试图创建一个rpm包CentOS7机上GCC 5.2但收到这个错误:RPM构建错误:/var/tmp/rpm-tmp.xgXjYS(%构建)出现错误的退出状态

> > /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 <[email protected]> 5.2.0-1 
- Initial gcc Package for CentOS 7 

我被配置为使用来自YouTube教程配置规范文件。 我不确定我是否正确或不正确,或者我为什么会收到错误。

+0

可能重复的[crti.o文件丢失](https://stackoverflow.com/questions/91576/crti-o-file-missing) – dlmeetei

回答

1

我不推荐创建自己的gcc包。有很多可用的软件包。因此,无论

  • 找到一个已经编译包为您的平台
  • 找到一个类似的平台的src.rpm并尝试只是重建RPM(使用rpm --rebuild
  • 如果有必要的补丁从源或规范文件一个现有的src.rpm来编译它

所有这些步骤都会带给你更好更快的结果,选项听起来很容易降序......所以最好从第一个开始。 rpms例如在http://rpm.pbone.net/或只是谷歌...

+0

非常感谢。我会尽量按照你的步骤。 – mdamasrur