Problem Building 32-bit gcc native compiler

Bob Proulx bob@proulx.com
Wed Jul 20 16:45:00 GMT 2005


Bell, Timothy wrote:
> Also, my system is an HP-UX 11.11 rev U system.

I last built 3.3.2 on HP-UX and all of my information applies to it.
But I assume that 3.3.3 would be very similar.

* Ensure that you are using GNU make.  I compile it and put it in my
  path ahead of any other make programs.

* Ensure that you are using the GNU assembler.  This is very
  important.  Start by building binutils or later.  This must be done
  first.  (I believe I am using 2.14 at the moment.)

To build binutils I am using the following configure options.  So the
resulting binaries end up installed in /usr/bin/gas.

  ./configure \
    --prefix=/usr \
    --mandir=\${prefix}/share/man \
    --infodir=\${prefix}/share/info \
    --program-prefix=g \
    --disable-shared

[I have a note to myself that I must install libiberty.h from binutils
into the /usr/include directory.  I don't remember the details.  I
don't know if this is still needed.  It was for me.  YMMV.]

To build gcc-3.3.2 I used the following configure options.  This is a
scriptlet that I used to configure, build, and do a minor fix.

# The first time around without gcc available use these:
#   CC=cc CFLAGS="-O" LIBCXXFLAGS="-g -O2 -fno-implicit-templates"
# The second and later times with gcc available use these:
#   LIBCXXFLAGS="-g -O2 -fno-implicit-templates"

LIBCFLAGS="-O2" LIBCXXFLAGS="-O2 -fno-implicit-templates" \
  ./configure \
  --prefix=/usr \
  --mandir=\${prefix}/share/man \
  --infodir=\${prefix}/share/info \
  --program-suffix=-3.3 \
  --with-as=/usr/bin/gas \
  --with-gnu-as \
  --enable-version-specific-runtime-libs \
  --enable-languages=c,c++ \
  --enable-cxx-flags='-fPIC'

make -j2 bootstrap

# I was not able to deduce where in the process 'fixincludes' was to
# be able to fix it there.  That would be the better place.  But this
# place will do too.
# Change this:
#  define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _ISALPHA
# To this:
#  define isalpha(__c) (__SB_masks ? (int)__SB_masks[(int)__c] &
#  _ISALPHA

sed '/__SB_masks.__c/s/__c]/(int)__c]/' ./gcc/include/ctype.h \
  > ./gcc/include/ctype.h.new
mv ./gcc/include/ctype.h.new ./gcc/include/ctype.h

> We are only currently authorized to use gcc version 3.3.3. In
> addition, all of our other HP-UX 11.11 systems have version 3.3.3 of
> the gcc on them.

How were those other systems installed?  Wouldn't you just use the
same installation bits as install there?

> I know that each time we deployed the gcc to each of the systems by
> my predecessors, there was a problem. However, I don't have any
> notes as to how they finally were able to compile the gcc on those
> systems. Is there anyway that I could copy the gcc and libraries
> from the other systems to the new system since they are at the same
> HP-UX level. If so, what directories would I have to copy in order
> to get the gcc over to the new system?

Ah!  I see the problem.  The files are installed, but without a
package manager, and so you do not know what files you would need to
copy from one machine to another.  So your only recourse is build from
scratch to deduce those files.  Gotcha.

I am using a packager manager (RPM) on HP-UX to track my installed
files.  Let me share with you the list of files that I believe are
needed on my systems to install gcc.

The binutils files that you need (not counting man pages and other
docs) are:

  /usr/bin/gaddr2line
  /usr/bin/gar
  /usr/bin/gas
  /usr/bin/gc++filt
  /usr/bin/ggprof
  /usr/bin/gnm
  /usr/bin/gobjcopy
  /usr/bin/gobjdump
  /usr/bin/granlib
  /usr/bin/greadelf
  /usr/bin/gsize
  /usr/bin/gstrings
  /usr/bin/gstrip

The gcc-3.3 files that you need (not counting man pages and other
docs) are:

  /usr/bin/c++-3.3
  /usr/bin/cpp-3.3
  /usr/bin/g++-3.3
  /usr/bin/gcc-3.3
  /usr/bin/gccbug-3.3
  /usr/bin/gcov-3.3
  /usr/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.2/*

Note that I built binutils without shared libraries.  You would need
to track down any binutils shared libraries that you are using and
include them in the list too.

Obviously my prefix is /usr, but I am using a package manager and
distributing them on many machines.  You would to map those
directories and files to the names and locations that you used with
your installation.  But then it should be possible to tar up a
complete set of files and to transfer them to another machine.

Bob



More information about the Gcc-help mailing list