problem in building gcc-7.2.0 rpm from source

Issues related to applications and software problems
Post Reply
rahulvishwa81
Posts: 8
Joined: 2014/03/07 05:19:05

problem in building gcc-7.2.0 rpm from source

Post by rahulvishwa81 » 2020/06/06 08:53:44

hi to all, I've centos 7.5 and gcc-7.2.0 (tarball) in VM. i am trying to building gcc-7.2.0.rpm from source code.
i installed rpmbuild and supported packages. and having following directories in /root/rpmbuild/
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS

i've given following command :

Code: Select all

rpmbuild -v -bb gcc.7.2.0.spec 

and having following error :-

*** ERROR: No build ID note found in /root/rpmbuild/BUILDROOT/gcc-7.2.0-1.x86_64/libgo/go/debug/elf/testdata/gcc-amd64-linux-exec
error: Bad exit status from /var/tmp/rpm-tmp.7hyCrE (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.7hyCrE (%install)
mine spec file is :-

Code: Select all

Name:           gcc
Version:        7.2.0
Release:        1
Summary:        gcc-7.2.0.tar.gz installtion file

License:        GPL
            
Source0:        gcc-7.2.0.tar.gz

BuildRoot:	%{_tmppath}/%{name}-buildroot

%description	
install gcc.7.2.0 in form of rpm

%prep
%setup -q


%build


%install
make -p "$RPM_BUILD_ROOT"
cp -R * "$RPM_BUILD_ROOT"

%clean
rm -rf $RPM_BUILD_ROOT
%make_install


%defattr(-,root,root,-)
how to build rpm of gcc.
i googled and i changed SPEC file as follows :-

Code: Select all

 
 Name:           gcc
Version:        7.2.0
Release:        1%{?dist} 
Summary:        gcc-7.2.0.tar.gz installtion file

License:        GPL
            
Source0:        %{name}-%{version}.tar.gz

BuildRequires:	gcc 

BuildRoot:	%{_tmppath}/%{name}-buildroot

%description	
install gcc.7.2.0 in form of rpm

%prep
%setup -q


%build
%configure 
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
%make_install

%clean

%files
%doc
/usr/%{name} 

%defattr(-,root,root,-)
 

and ran command as follows :-

Code: Select all

#  rpmbuild -v -ba gcc.7.2.0.spec 
gives this error :-
 
 make[3]: *** [c/c-decl.o] Error 1
make[3]: *** Waiting for unfinished jobs....
Shared 30074 out of 59977 states by creating 7944 new states, saving 22130
/bin/sh ../.././gcc/../move-if-change tmp-recog.c insn-recog.c
echo timestamp > s-recog
/bin/sh ../.././gcc/../move-if-change tmp-attrtab.c    insn-attrtab.c
/bin/sh ../.././gcc/../move-if-change tmp-dfatab.c     insn-dfatab.c
/bin/sh ../.././gcc/../move-if-change tmp-latencytab.c insn-latencytab.c
echo timestamp > s-attrtab
/bin/sh ../.././gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm gcc.pod
make[3]: Leaving directory `/root/rpmbuild/BUILD/gcc-7.2.0/host-x86_64-redhat-linux-gnu/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/root/rpmbuild/BUILD/gcc-7.2.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/root/rpmbuild/BUILD/gcc-7.2.0'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.txYLjQ (%build)


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

 

User avatar
TrevorH
Forum Moderator
Posts: 29955
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: problem in building gcc-7.2.0 rpm from source

Post by TrevorH » 2020/06/06 12:24:48

First: don't use CentSO 7.5. It's already 3 point releases behind and is over two years old. If you already have it installed then run yum update to get up to date on 7.8.

Second, we already package and make available various gcc versions. Use one of those. First yum install centos-release-scl then yum list devtoolset\*gcc\* should show you various gcc versions including 7.3.1, 8.3.1 and 9.1.1.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

rahulvishwa81
Posts: 8
Joined: 2014/03/07 05:19:05

Re: problem in building gcc-7.2.0 rpm from source

Post by rahulvishwa81 » 2020/06/07 16:01:04

As you said I tried to install gcc-9.3.0, I copied spec file from gcc-4.3.0.src.rpm. I copied
binutils-2.33.1-x86_64
cloog-0.18.1.tar.gz
fastjar-0.97.tar.gz
gmp-6.1.0.tar.gz
isl-0.16.1.tar.gz
mpc-1.0.3.tar.gz
mpfr-3.1.4
gcc-9.3.0.tar.gz

IN SOURCES directory.in SPECS directories i wrote file gcc.spec like this :-

( most of parts are copied from gcc.4.8.0 spec file)

Code: Select all

%global gcc_release 39
Summary: Various compilers (C, C++, Objective-C, Java, ...)
Name: gcc
Version: 9.3.0
Release: %{gcc_release}%{?dist}

License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Group: Development/Languages

Source0: gcc-%{version}.tar.bz2
%global isl_version 0.18
Source1: isl-0.18.tar.gz
%global cloog_version 0.18.1
Source2: cloog-0.18.1.tar.gz
Source3: gmp-6.1.tar.gz
%global fastjar_ver 0.97
Source4:fastjar-0.97.tar.gz
%global gmp_ver 6.1
Source5: gmp-6.1.tar.gz
%global mpc_ver 1.0.3
Source6: mpc-1.0.3.tar.gz
%global mpfr_ver 3.1.4
Source7: mpfr-3.1.4.tar.gz
Source8: binutils-2.33.1-x86_64.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: binutils >= 2.20.51.0.2-12
# While gcc doesn't include statically linked binaries, during testing
# -static is used several times.
BuildRequires: glibc-static
BuildRequires: zlib-devel, gettext, dejagnu, bison, flex, sharutils
BuildRequires: texinfo, texinfo-tex, /usr/bin/pod2man
BuildRequires: systemtap-sdt-devel >= 1.3
%if %{build_go}
BuildRequires: hostname
%endif
# For VTA guality testing
BuildRequires: gdb
%if %{build_java}
BuildRequires: /usr/share/java/eclipse-ecj.jar, zip, unzip
%if %{bootstrap_java}
Source10: libjava-classes-%{version}-%{release}.tar.bz2
%else
BuildRequires: gcc-java, libgcj
%endif
%endif

BuildRequires: glibc-devel >= 2.4.90-13
BuildRequires: elfutils-devel >= 0.147
BuildRequires: elfutils-libelf-devel >= 0.147
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
# Make sure glibc supports TFmode long double
BuildRequires: glibc >= 2.3.90-35
%endif
%ifarch %{multilib_64_archs} sparcv9 ppc
# Ensure glibc{,-devel} is installed for both multilib arches
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
%endif
%if %{build_ada}
# Ada requires Ada to build
BuildRequires: gcc-gnat >= 3.1, libgnat >= 3.1
%endif
%ifarch ia64
BuildRequires: libunwind >= 0.98
%endif
%if %{build_libstdcxx_docs}
BuildRequires: doxygen >= 1.7.1
BuildRequires: graphviz, dblatex, texlive-collection-latex, docbook5-style-xsl
%endif
Requires: cpp = %{version}-%{release}

Requires: binutils >= 2.20.51.0.2-12
# Make sure gdb will understand DW_FORM_strp
Conflicts: gdb < 5.1-2
Requires: glibc-devel >= 2.2.90-12
%ifarch ppc ppc64 ppc64le ppc64p7 s390 s390x sparc sparcv9 alpha
# Make sure glibc supports TFmode long double
Requires: glibc >= 2.3.90-35
%endif
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%ifarch %{arm}
Requires: glibc >= 2.16
%endif
%endif
Requires: libgcc >= %{version}-%{release}
Requires: libgomp = %{version}-%{release}
%if !%{build_ada}
Obsoletes: gcc-gnat < %{version}-%{release}
Obsoletes: libgnat < %{version}-%{release}
%endif
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
AutoReq: true
Provides: bundled(libiberty)
%if "%{version}" != "%{gcc_version}"
Provides: gcc = %{gcc_provides}
%endif
when i atrated making rpm using this command

Code: Select all

 rpmbuild -ba  gcc.spec

this stuck here :-

Code: Select all

libtool: link: (cd ".libs" && rm -f "libquadmath.so.0" && ln -s "libquadmath.so.0.0.0" "libquadmath.so.0")
libtool: link: (cd ".libs" && rm -f "libquadmath.so" && ln -s "libquadmath.so.0.0.0" "libquadmath.so")
libtool: link: ar rc .libs/libquadmath.a  math/x2y2m1q.o math/acoshq.o math/fmodq.o math/acosq.o math/frexpq.o math/rem_pio2q.o math/asinhq.o math/hypotq.o math/remainderq.o math/asinq.o math/rintq.o math/atan2q.o math/isinfq.o math/roundq.o math/atanhq.o math/isnanq.o math/scalblnq.o math/atanq.o math/j0q.o math/scalbnq.o math/cbrtq.o math/j1q.o math/signbitq.o math/ceilq.o math/jnq.o math/sincos_table.o math/complex.o math/ldexpq.o math/sincosq.o math/copysignq.o math/lgammaq.o math/sincosq_kernel.o math/coshq.o math/llroundq.o math/sinhq.o math/cosq.o math/log10q.o math/sinq.o math/cosq_kernel.o math/log1pq.o math/sinq_kernel.o math/erfq.o math/logq.o math/sqrtq.o math/expm1q.o math/lroundq.o math/tanhq.o math/expq.o math/modfq.o math/tanq.o math/fabsq.o math/nanq.o math/tgammaq.o math/finiteq.o math/nextafterq.o math/truncq.o math/floorq.o math/powq.o math/fmaq.o math/logbq.o math/exp2q.o math/issignalingq.o math/lgammaq_neg.o math/lgammaq_product.o math/tanq_kernel.o math/tgammaq_product.o math/casinhq_kernel.o math/cacoshq.o math/cacosq.o math/casinhq.o math/casinq.o math/catanhq.o math/catanq.o math/cimagq.o math/conjq.o math/cprojq.o math/crealq.o math/fdimq.o math/fmaxq.o math/fminq.o math/ilogbq.o math/llrintq.o math/log2q.o math/lrintq.o math/nearbyintq.o math/remquoq.o math/ccoshq.o math/cexpq.o math/clog10q.o math/clogq.o math/csinq.o math/csinhq.o math/csqrtq.o math/ctanq.o math/ctanhq.o printf/addmul_1.o printf/add_n.o printf/cmp.o printf/divrem.o printf/flt1282mpn.o printf/fpioconst.o printf/lshift.o printf/mul_1.o printf/mul_n.o printf/mul.o printf/printf_fphex.o printf/printf_fp.o printf/quadmath-printf.o printf/rshift.o printf/submul_1.o printf/sub_n.o strtod/strtoflt128.o strtod/mpn2flt128.o strtod/tens_in_limb.o
libtool: link: ranlib .libs/libquadmath.a
libtool: link: ( cd ".libs" && rm -f "libquadmath.la" && ln -s "../libquadmath.la" "libquadmath.la" )
make[3]: Leaving directory `/root/rpmbuild/BUILD/gcc-9.3.0/x86_64-redhat-linux-gnu/libquadmath'
make[2]: Leaving directory `/root/rpmbuild/BUILD/gcc-9.3.0/x86_64-redhat-linux-gnu/libquadmath'
make[1]: Leaving directory `/root/rpmbuild/BUILD/gcc-9.3.0'
make: *** [all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.3SJSeX (%build)


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

User avatar
jlehtone
Posts: 3183
Joined: 2007/12/11 08:17:33
Location: Finland

Re: problem in building gcc-7.2.0 rpm from source

Post by jlehtone » 2020/06/07 16:32:07

rahulvishwa81 wrote:
2020/06/07 16:01:04
As you said I tried to install gcc-9.3.0, I copied spec file ...
That is not what he said.

You should have done:

Code: Select all

sudo yum install centos-release-scl
sudo yum install devtoolset-9-toolchain
scl enable devtoolset-9 bash
# now you are in a bash session that has GCC 9

rahulvishwa81
Posts: 8
Joined: 2014/03/07 05:19:05

Re: problem in building gcc-7.2.0 rpm from source

Post by rahulvishwa81 » 2020/06/08 06:27:14

i didn't get your pooint my question is that how to build rpm from source code of gcc-9.3.0. how to do that.

User avatar
TrevorH
Forum Moderator
Posts: 29955
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: problem in building gcc-7.2.0 rpm from source

Post by TrevorH » 2020/06/08 10:29:57

And our point is that you do not need to do that since we already provide correctly built packages that you can just install.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

rahulvishwa81
Posts: 8
Joined: 2014/03/07 05:19:05

Re: problem in building gcc-7.2.0 rpm from source

Post by rahulvishwa81 » 2020/06/08 16:26:55

ok but i want to build gcc rpm by my hand

User avatar
jlehtone
Posts: 3183
Joined: 2007/12/11 08:17:33
Location: Finland

Re: problem in building gcc-7.2.0 rpm from source

Post by jlehtone » 2020/06/09 08:14:46

Code: Select all

make: *** [all] Error 2
This does not show the actual error. It has occurred earlier in the compilation.

Building an RPM has essentially two steps:
1. Create content from sources (compile, etc)
2. Package content into RPM-file

Your error is in the first step and therefore might not be related to building a RPM in any way.

I recall building GCC some two decades ago. (Not to RPM, just a compile.) It was arduous.
First, there was a bootstrap step to compile a compiler that actually can compile the GCC.
Hopefully, that has improved?


Take note that the Developer Toolsets are Software Collections (SCL). Their files do not replace
base packages. SCLs co-install to different location. If you do create a GCC RPM, then you must
make it a SCL, because you can't let your "regular RPM" to replace base system's GCC.

Post Reply

Return to “CentOS 7 - Software Support”