Simon J Mudd wrote:

   ( cd obj
     %{l_make} %{l_mflags} install \
         INSTALL="%{l_shtool} install -c" \
         DESTDIR=$RPM_BUILD_ROOT
   ) || exit $?
   #   cleanup installation tree
   mv $RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a \
      $RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}-lib/${triple}/%{V_full}/
   for multilib in `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`; do
       subdir=`echo "$multilib" | sed -e 's/;.*$//'`
       [ ".$subdir" = .. ] && continue
       mv $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir/lib*.a \
          
$RPM_BUILD_ROOT%{l_prefix}/lib/gcc%{V_comp}-lib/${triple}/%{V_full}/$subdir/
       rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/$subdir
   done
  ...
The mv above is failing.
The %install section is used to "copy" the correctly built software
into the "right location" for the final package.  The directory tree
has a temporary prefix $RPM_BUILD_ROOT, but everything is otherwise
ok.  It looks like the gcc "libraries" are being "relocated" because
they can NOT be put in /lib,/usr/lib on the target platform, and are
so put under %{l_prefix}.
The question really comes down to is "where are the lib*.a files" as
if the mv fails they are NOT in the expected location of
$RPM_BUILD_ROOT%{l_prefix}/lib/lib*.a.
I'll see if I can get the compile to run on a box I have access to
and
see where the libraries really are.
Regards,
Simon
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
User Communication List                      openpkg-users@openpkg.org

The only reason the mv is failing is because an earlier cleanup killed
the parent directory. The pthread directory is being removed before
the pthread/power files are moved.


In that case the evaluation of
        `$RPM_BUILD_ROOT%{l_prefix}/bin/gcc --print-multi-lib`

seems to be providing the directory list in the wrong order and some
libraries are getting removed before they are copied.

That's what I think. Ralf must have written this and should know
better.  I'm pretty familiar with RPMs but have never looked at the
gcc build process which is obviously non-trivial.

I'm going to try building gcc 3.4 without binutils and if that fails
(I think you said that it did not work) just try and build a normal
gcc from the tar ball.  The compiler running on my 5.1 box is

$ gcc -v
Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.2/specs
Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld 
--disable-nls --enable-languages=c,c++ --prefix=/opt/freeware --enable-threads 
--enable-version-specific-runtime-libs --host=powerpc-ibm-aix5.1.0.0
Thread model: aix
gcc version 3.3.2

I'd like to build a newer gcc. It's a shame that IBM don't provide the
spec files for the rpms they provide on their website as maybe we
could see what "tricks" they had to apply (if any) to get "their" gcc
to build successfully.

Regards,

Simon
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
User Communication List                      openpkg-users@openpkg.org

Here's the .spec file for GCC 3.3.2:

Summary: GNU Compiler Collection
Name: gcc
Version: 3.3.2
Release: 5
Group: Development/Tools
License: GPL
URL: http://gcc.gnu.org/
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}/%{name}-core-%{version
}.tar.bz2
Source1: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}/%{name}-g++-%{version}
.tar.bz2
Patch0: gcc-3.3.2-debug.patch
# Unless you have a lot of space in /var/tmp, you will probably need to
# specify --buildroot on the command line to point to a larger filesystem.
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: sed, automake, libtool, autoconf, texinfo
Prereq: /sbin/install-info
Conflicts: g++ <= 2.9.aix51.020209-4

%ifos aix5.1
%define buildhost powerpc-ibm-aix5.1.0.0
Requires: AIX-rpm >= 5.1.0.0
%endif
%ifos aix5.2
%define buildhost powerpc-ibm-aix5.2.0.0
Requires: AIX-rpm >= 5.2.0.0
%endif
%ifos aix5.3
%define buildhost powerpc-ibm-aix5.3.0.0
Requires: AIX-rpm >= 5.3.0.0
%endif
%define gcclibdir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}

%description
The gcc package includes the gcc GNU compiler for compiling C code.

%package c++
Summary: C++ support for GCC
Group: Development/Languages
Requires: gcc = %{version}-%{release}
Requires: libstdc++-devel = %{version}-%{release}
Obsoletes: g++
%ifos aix5.1
Requires: AIX-rpm >= 5.1.0.0
%endif
%ifos aix5.2
Requires: AIX-rpm >= 5.2.0.0
%endif
%ifos aix5.3
Requires: AIX-rpm >= 5.3.0.0
%endif

%description c++
The gcc-c++ package adds C++ support to the GNU C compiler. It includes support
for most of the current C++ specification, including templates and exception
handling. The static standard C++ library and C++ header files are included.

%package -n libgcc
Summary: GCC compiler dynamic runtime library
Group: Development/Libraries
%ifos aix5.1
Requires: AIX-rpm >= 5.1.0.0
%endif
%ifos aix5.2
Requires: AIX-rpm >= 5.2.0.0
%endif
%ifos aix5.3
Requires: AIX-rpm >= 5.3.0.0
%endif

%description -n libgcc
libgcc is required at runtime for programs dynamically linked with GCC.

%package -n libstdc++
Summary: G++ compiler dynamic runtime library
Group: Development/Libraries
Requires: libgcc
%ifos aix5.1
Requires: AIX-rpm >= 5.1.0.0
%endif
%ifos aix5.2
Requires: AIX-rpm >= 5.2.0.0
%endif
%ifos aix5.3
Requires: AIX-rpm >= 5.3.0.0
%endif

%description -n libstdc++
libstdc++ is required at runtime for programs dynamically linked with G++.

%package -n libstdc++-devel
Summary: Include files and libraries required for G++ development.
Group: Development/Libraries
Requires: libstdc++
%ifos aix5.1
Requires: AIX-rpm >= 5.1.0.0
%endif
%ifos aix5.2
Requires: AIX-rpm >= 5.2.0.0
%endif
%ifos aix5.3
Requires: AIX-rpm >= 5.3.0.0
%endif

%description -n libstdc++-devel
This package contains headers and libraries for the GNU G++ library.
Required for compiling G++ code.


%prep
%setup -q -b 1
%patch -b .debug

%build
# Seems to help build faster, using bash
export CONFIG_SHELL=/opt/freeware/bin/bash
export CONFIGURE_ENV_ARGS=/opt/freeware/bin/bash

rm -rf objdir
mkdir objdir
cd objdir
CC=cc \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LIBCFLAGS="-O2" \
LIBCXXFLAGS="-O2 -fno-implicit-templates" \
../configure \
--with-as=/usr/bin/as \
--with-ld=/usr/bin/ld \
--disable-nls \
--enable-languages=c,c++ \
--prefix=%{_prefix} \
--enable-threads \
--enable-version-specific-runtime-libs \
--host=%{buildhost}
gmake bootstrap-lean

%install
# Seems to help build faster, using bash
export CONFIG_SHELL=/opt/freeware/bin/bash
export CONFIGURE_ENV_ARGS=/opt/freeware/bin/bash

[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
cd objdir
gmake install DESTDIR=$RPM_BUILD_ROOT

# Remove unneeded links in bin/
rm -f $RPM_BUILD_ROOT%{_prefix}/bin/c++*
rm -f $RPM_BUILD_ROOT%{_prefix}/bin/powerpc*

# Don't need to ship gccbug
rm -f $RPM_BUILD_ROOT%{_prefix}/bin/gccbug

# Strip compiler binaries
strip $RPM_BUILD_ROOT%{_prefix}/bin/* 2>/dev/null || :
for file in cc1 cc1plus collect2; do
  strip $RPM_BUILD_ROOT%{gcclibdir}/$file 2>/dev/null || :
done

# Strip utilities
strip $RPM_BUILD_ROOT%{gcclibdir}/install-tools/fix-header 2>/dev/null || :
strip $RPM_BUILD_ROOT%{gcclibdir}/install-tools/fixincl 2>/dev/null || :

# Remove unrelated man pages
rm -rf $RPM_BUILD_ROOT%{_prefix}/man/man7

# Remove libiberty.a library which is not used directly by gcc.
rm -f $RPM_BUILD_ROOT%{_prefix}/lib/libiberty.a
for dir in power powerpc ppc64 pthread; do
  rm -rf $RPM_BUILD_ROOT%{_prefix}/lib/$dir
done

# Remove libtool files
for arch in . power powerpc ppc64; do
  rm -f $RPM_BUILD_ROOT%{gcclibdir}/$arch/*.la
  rm -f $RPM_BUILD_ROOT%{gcclibdir}/pthread/$arch/*.la
done

# Remove zutil.h which is not installed by default on AIX systems
rm -f $RPM_BUILD_ROOT%{gcclibdir}/include/zutil.h

# Remove empty include directory
rmdir $RPM_BUILD_ROOT%{_prefix}/include || :

# Gzip info pages
gzip --best $RPM_BUILD_ROOT%{_prefix}/info/*.info

# Create links in /usr/bin
(
    cd $RPM_BUILD_ROOT
    mkdir -p usr/bin
    cd usr/bin
    for fname in cpp gcc gcov g++; do
        ln -sf ../..%{_prefix}/bin/$fname .
    done
)

%post
/sbin/install-info %{_prefix}/info/cpp.info.gz %{_prefix}/info/dir
/sbin/install-info %{_prefix}/info/cppinternals.info.gz %{_prefix}/info/dir
/sbin/install-info %{_prefix}/info/gcc.info.gz %{_prefix}/info/dir
/sbin/install-info %{_prefix}/info/gccint.info.gz %{_prefix}/info/dir

%preun
if [ "$1" = 0 ]; then
/sbin/install-info --delete %{_prefix}/info/cpp.info.gz %{_prefix}/info/dir /sbin/install-info --delete %{_prefix}/info/cppinternals.info.gz %{_prefix}/
info/dir
/sbin/install-info --delete %{_prefix}/info/gcc.info.gz %{_prefix}/info/dir /sbin/install-info --delete %{_prefix}/info/gccint.info.gz %{_prefix}/info/d
ir
fi

%files
%defattr(-,root,system)
%{_prefix}/bin/gcc
%{_prefix}/bin/gcov
/usr/bin/gcc
/usr/bin/gcov
%dir %{_prefix}/lib/gcc-lib
%dir %{_prefix}/lib/gcc-lib/%{buildhost}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64
%ifos aix5.1
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc/libgcc_eh.a
%endif
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64/libgcc.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/libgcc_eh.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64/libgcc_eh.a

%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/collect2

%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/README
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/*.h
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/X11
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/net
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/netinet
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/root
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/rpc
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/sys
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/install-tools

%{_mandir}/man1/gcc.1
%{_mandir}/man1/gcov.1
%doc COPYING* BUGS FAQ MAINTAINERS gcc/README*

# Below are files that are sometimes put into separately installed
# packages.  As they are almost always installed with gcc and are
# not much bigger, let's keep them within the "gcc" package.
#
# The "gcc-info" package
%{_infodir}/cpp*
%{_infodir}/gcc*
#
# The "cpp" package
%{_mandir}/man1/cpp.1
%{_prefix}/bin/cpp
/usr/bin/cpp
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/cc1
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/specs


%files c++
%defattr(-,root,system)
%dir %{_prefix}/lib/gcc-lib
%dir %{_prefix}/lib/gcc-lib/%{buildhost}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}
%{_prefix}/bin/g++
/usr/bin/g++
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/cc1plus
%{_mandir}/man1/g++.1
%doc COPYING*


%files -n libgcc
%defattr(-,root,system)
%dir %{_prefix}/lib/gcc-lib
%dir %{_prefix}/lib/gcc-lib/%{buildhost}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/libgcc_s*.a
%doc COPYING.LIB

%files -n libstdc++
%defattr(-,root,system)
%dir %{_prefix}/lib/gcc-lib
%dir %{_prefix}/lib/gcc-lib/%{buildhost}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64/libstdc++.a
%ifos aix5.1
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power/libstdc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc/libstdc++.a
%endif
%doc COPYING.LIB


%files -n libstdc++-devel
%defattr(-,root,system)
%dir %{_prefix}/lib/gcc-lib
%dir %{_prefix}/lib/gcc-lib/%{buildhost}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64
%ifos aix5.1
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power
%dir %{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/power/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/powerpc/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/power/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/powerpc/libsupc++.a
%endif
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/ppc64/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/pthread/ppc64/libsupc++.a
%{_prefix}/lib/gcc-lib/%{buildhost}/%{version}/include/c++
%doc COPYING*


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%changelog
* (removed by me)
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
User Communication List                      openpkg-users@openpkg.org

Reply via email to