0

I am really new at creating rpm packages and please need help. I was trying to create an rpm package for GCC 5.2 on CentOS7 machine but getting this error :

> > /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 file:

> 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

I configured the spec file using the configuration from a youtube tutorial. I am not sure if I did it right or not or why I am getting the errors.

mdamasrur
  • 1
  • 2
  • Possible duplicate of [crti.o file missing](https://stackoverflow.com/questions/91576/crti-o-file-missing) – dlmeetei Aug 18 '17 at 07:15

1 Answers1

1

I would not recommend creating your own gcc package. There are lots of packages available. So either

  • find an already compiled package for your platform
  • find a src.rpm for a similar platform and try to just rebuild the rpm (using rpm --rebuild
  • if necessary patch the sources or spec file from an existing src.rpm to get it compiled

all these steps will give you better and faster results. The options are listen in descending order of easiness... So better start with the first one. You can look for rpms for example on http://rpm.pbone.net/ or just google...

Chris Maes
  • 35,025
  • 12
  • 111
  • 136