public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* building old gcc3 for i386-linux on recent x86-linux?
@ 2016-02-18 17:21 Steffen Dettmer
  2016-02-18 17:31 ` LMH
  2016-02-21 18:12 ` Florian Weimer
  0 siblings, 2 replies; 6+ messages in thread
From: Steffen Dettmer @ 2016-02-18 17:21 UTC (permalink / raw)
  To: gcc-help

Hi,

in short:
How to build a gcc3 host=x86-linux target=i386-old-linux today?
Are there alternatives?

--long:
I'd have to build old 32 bit applications for old i386 Linux
systems and would like to use a recent 64 bit Linux system to do
so. I think I should be able to install an old gcc3 as
cross-compiler.

As first step I unpacked binutils-2.16.1a.tar.bz2 and
gcc-3.4.3.tar.gz, symlinked " bfd binutils gas gprof ld opcodes"
to gcc src dir in order to perform a "combined build", created an
objdir and ran configure --target=i386-myold-linux, which worked
(see below for the complete commands).

I wondered why I don't need any headers of the old glibc to be
used and so far no kernel headers... Did I miss something here?
(Note: in later attempts, I tried various combinations with
--sys-root, but had no success either). I expected that I'd build
bintuils+gcc+glibc (some older egclib) against the headers from
the old target kernel. Am I on the right way at all?

After configure, I tried "make", but it fails:

        gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
-o .libs/size size.o bucomm.o version.o filemode.o
../bfd/.libs/libbfd.so
-L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
-liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
-Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/lib
        gcc: error: ./../intl/libintl.a: No such file or directory
        Makefile:615: recipe for target 'size' failed

just guessing I tried:

        make -C intl libintl.a

which worked, so I repeated make. Now it fails a bit later with:

        gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
-o .libs/size size.o bucomm.o version.o filemode.o
../bfd/.libs/libbfd.so
-L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
-liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
-Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/libbucomm.o:
In function `make_tempname':
        /net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/binutils/../../gcc-3.4.3/binutils/bucomm.c:425:
warning: the use of `mktemp' is dangerous, better use `mkstemp' or
`mkdtemp'
        ../bfd/.libs/libbfd.so: undefined reference to `unlink_if_ordinary'
        collect2: error: ld returned 1 exit status
        Makefile:615: recipe for target 'size' failed

and indeed

        nm libiberty/libiberty.a |grep unlink_if_ordinary

finds nothing. Interestingly, when I build binutils in a
different object dir alone, I get a libiberty.a with:

        nm libiberty/libiberty.a |grep unlink_if_ordinary
        0000000000000000 T unlink_if_ordinary

so as I already was hacking I just used the whole folder in my
gcc build tree and re-run make. This time it runs some more
seconds until it fails with:

        ../../gcc-3.4.3/gcc/config/i386/linux.h:217:20: signal.h: No
such file or directory
        ../../gcc-3.4.3/gcc/config/i386/linux.h:218:26:
sys/ucontext.h: No such file or directory

in my kernel headers ("2.6.16.60-0.37_f594963d-bigsmp") I have
asm/ucontext.h, but no sys/ucontext.h. For a test, I copied
headers from target system to my inst/i386-vcu-linux/sys-include/
and some libs (crt*.o, libc.so and libm.so) to inst/i386-vcu-linux/lib.

Make progresses but then fails with:

        checking for main in -lm... configure: error: Link tests are
not allowed after GCC_NO_EXECUTABLES.
        Makefile:21960: recipe for target 'configure-target-libstdc++-v3' failed
        make: *** [configure-target-libstdc++-v3] Error 1

This time I had no idea what I could hack to progress.

I also tried to build with newer binutils versions
(binutils-2.19.1, binutils-2.22.tar.bz2), but they try to compile
with -Werror which fails because of gcc49 warnings.

I tried older (2.14), but had issues resulting in an attemp to
run flex. I also tried gcc-3.3.6 (which I actually would prefere)
without success.

I even tried to build a native gcc3 first (with make bootstrap),
but it also failed. First, with libiberty, as above, when copying
it from binutils build, I get:

        gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
-D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
-I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
-I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
../../gcc-3.3.6/gprof/sparc.c
        gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
-D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
-I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
-I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
../../gcc-3.3.6/gprof/mips.c
        cc    -c -o flat_bl.o ../../gcc-3.3.6/gprof/flat_bl.m
        cc: error trying to exec 'cc1obj': execvp: No such file or directory
        <builtin>: recipe for target 'flat_bl.o' failed
        make[3]: *** [flat_bl.o] Error 1

(after several calls to gcc it calls cc?)

and when removing gprof from Makefile it progresses, but finally
I cannot link because it misses ctri.o (it is in
/usr/lib/x86_64-linux-gnu/crti.o).

How to build a gcc3 version today?

Any hint, help or FAQ pointers appreciated! Google is not so
helpful when looking for older information...

Steffen


------------------------------------------------------------------->8=======

#!/bin/bash
set -e

function warn() { echo "$@" >&2 ; }
function die() { warn "FATAL: $@" ; exit 2 ; }

#tar xjf binutils-2.16.1a.tar.bz2
#tar xzf gcc-3.4.3.tar.gz
#tar xzf glibc-2.3.4.tar.gz

( cd gcc-3.4.3/ && for d in bfd binutils gas gprof ld opcodes ; do ln
-sf ../binutils-2.16.1/$d . || die "failed to symlink binutils"; done
) || die "error"

test -d objdir || mkdir objdir
test -d binobjdir || mkdir binobjdir
test -d inst || mkdir inst

#TODO
# mkdir inst/i386-vcu-linux/sys-include
# cd ... && ln -s ../../../dehetucks-includes/* .
# mkdir inst/i386-vcu-linux/lib/
# ctr*o, lib[cm].so


inst="`pwd`/inst"
# seems unused (but check inst/i386-vcu-linux/sys-include/)
test -d inst/sys-include || mkdir inst/sys-include
( cd inst/sys-include && ln -sf
../../linux-2.6.16.60-0.37_f594963d-bigsmp/linux linux )
( cd inst/sys-include && ln -sf
../../asm-2.6.16.60-0.37_f594963d-bigsmp/asm asm )
#test -d sysroot || mkdir sysroot

PATH=/bin:/usr/bin
# TODO CHECK: should need old host triplet names?
# --with-system-zlib \
#  --prefix=/usr/local/ \
#  --with-local-prefix: Do not specify /usr
#  --with-sysroot
#  --with-clocale=generic https://gcc.gnu.org/ml/gcc-help/2014-09/msg00010.html
#  --with-cpu=generic   # original gcc-3.3.6 tells this, but not supported here?

cd objdir
../gcc-3.4.3/configure \
  --target=i386-vcu-linux \
  --prefix=$inst \
  --with-local-prefix=$inst \
  --enable-threads=posix \
  --enable-languages=c,c++ \
  --enable-ssp --disable-libssp \
  --enable-shared --enable-__cxa_atexit \
  --enable-libstdcxx-allocator=new \
  --enable-version-specific-runtime-libs \
  --without-system-libunwind

make -j8

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: building old gcc3 for i386-linux on recent x86-linux?
  2016-02-18 17:21 building old gcc3 for i386-linux on recent x86-linux? Steffen Dettmer
@ 2016-02-18 17:31 ` LMH
  2016-02-18 17:59   ` Steffen Dettmer
  2016-02-21 18:12 ` Florian Weimer
  1 sibling, 1 reply; 6+ messages in thread
From: LMH @ 2016-02-18 17:31 UTC (permalink / raw)
  To: Steffen Dettmer, gcc-help

Steffen Dettmer wrote:
> Hi,
> 
> in short:
> How to build a gcc3 host=x86-linux target=i386-old-linux today?
> Are there alternatives?
> 
> --long:
> I'd have to build old 32 bit applications for old i386 Linux
> systems and would like to use a recent 64 bit Linux system to do
> so. I think I should be able to install an old gcc3 as
> cross-compiler.
> 
> As first step I unpacked binutils-2.16.1a.tar.bz2 and
> gcc-3.4.3.tar.gz, symlinked " bfd binutils gas gprof ld opcodes"
> to gcc src dir in order to perform a "combined build", created an
> objdir and ran configure --target=i386-myold-linux, which worked
> (see below for the complete commands).
> 
> I wondered why I don't need any headers of the old glibc to be
> used and so far no kernel headers... Did I miss something here?
> (Note: in later attempts, I tried various combinations with
> --sys-root, but had no success either). I expected that I'd build
> bintuils+gcc+glibc (some older egclib) against the headers from
> the old target kernel. Am I on the right way at all?
> 
> After configure, I tried "make", but it fails:
> 
>         gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
> -o .libs/size size.o bucomm.o version.o filemode.o
> ../bfd/.libs/libbfd.so
> -L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
> -liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
> -Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/lib
>         gcc: error: ./../intl/libintl.a: No such file or directory
>         Makefile:615: recipe for target 'size' failed
> 
> just guessing I tried:
> 
>         make -C intl libintl.a
> 
> which worked, so I repeated make. Now it fails a bit later with:
> 
>         gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
> -o .libs/size size.o bucomm.o version.o filemode.o
> ../bfd/.libs/libbfd.so
> -L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
> -liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
> -Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/libbucomm.o:
> In function `make_tempname':
>         /net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/binutils/../../gcc-3.4.3/binutils/bucomm.c:425:
> warning: the use of `mktemp' is dangerous, better use `mkstemp' or
> `mkdtemp'
>         ../bfd/.libs/libbfd.so: undefined reference to `unlink_if_ordinary'
>         collect2: error: ld returned 1 exit status
>         Makefile:615: recipe for target 'size' failed
> 
> and indeed
> 
>         nm libiberty/libiberty.a |grep unlink_if_ordinary
> 
> finds nothing. Interestingly, when I build binutils in a
> different object dir alone, I get a libiberty.a with:
> 
>         nm libiberty/libiberty.a |grep unlink_if_ordinary
>         0000000000000000 T unlink_if_ordinary
> 
> so as I already was hacking I just used the whole folder in my
> gcc build tree and re-run make. This time it runs some more
> seconds until it fails with:
> 
>         ../../gcc-3.4.3/gcc/config/i386/linux.h:217:20: signal.h: No
> such file or directory
>         ../../gcc-3.4.3/gcc/config/i386/linux.h:218:26:
> sys/ucontext.h: No such file or directory
> 
> in my kernel headers ("2.6.16.60-0.37_f594963d-bigsmp") I have
> asm/ucontext.h, but no sys/ucontext.h. For a test, I copied
> headers from target system to my inst/i386-vcu-linux/sys-include/
> and some libs (crt*.o, libc.so and libm.so) to inst/i386-vcu-linux/lib.
> 
> Make progresses but then fails with:
> 
>         checking for main in -lm... configure: error: Link tests are
> not allowed after GCC_NO_EXECUTABLES.
>         Makefile:21960: recipe for target 'configure-target-libstdc++-v3' failed
>         make: *** [configure-target-libstdc++-v3] Error 1
> 
> This time I had no idea what I could hack to progress.
> 
> I also tried to build with newer binutils versions
> (binutils-2.19.1, binutils-2.22.tar.bz2), but they try to compile
> with -Werror which fails because of gcc49 warnings.
> 
> I tried older (2.14), but had issues resulting in an attemp to
> run flex. I also tried gcc-3.3.6 (which I actually would prefere)
> without success.
> 
> I even tried to build a native gcc3 first (with make bootstrap),
> but it also failed. First, with libiberty, as above, when copying
> it from binutils build, I get:
> 
>         gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
> -D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
> -I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
> -I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
>   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
> ../../gcc-3.3.6/gprof/sparc.c
>         gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
> -D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
> -I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
> -I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
>   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
> ../../gcc-3.3.6/gprof/mips.c
>         cc    -c -o flat_bl.o ../../gcc-3.3.6/gprof/flat_bl.m
>         cc: error trying to exec 'cc1obj': execvp: No such file or directory
>         <builtin>: recipe for target 'flat_bl.o' failed
>         make[3]: *** [flat_bl.o] Error 1
> 
> (after several calls to gcc it calls cc?)
> 
> and when removing gprof from Makefile it progresses, but finally
> I cannot link because it misses ctri.o (it is in
> /usr/lib/x86_64-linux-gnu/crti.o).
> 
> How to build a gcc3 version today?
> 
> Any hint, help or FAQ pointers appreciated! Google is not so
> helpful when looking for older information...
> 
> Steffen
> 
> 
> ------------------------------------------------------------------->8=======
> 
> #!/bin/bash
> set -e
> 
> function warn() { echo "$@" >&2 ; }
> function die() { warn "FATAL: $@" ; exit 2 ; }
> 
> #tar xjf binutils-2.16.1a.tar.bz2
> #tar xzf gcc-3.4.3.tar.gz
> #tar xzf glibc-2.3.4.tar.gz
> 
> ( cd gcc-3.4.3/ && for d in bfd binutils gas gprof ld opcodes ; do ln
> -sf ../binutils-2.16.1/$d . || die "failed to symlink binutils"; done
> ) || die "error"
> 
> test -d objdir || mkdir objdir
> test -d binobjdir || mkdir binobjdir
> test -d inst || mkdir inst
> 
> #TODO
> # mkdir inst/i386-vcu-linux/sys-include
> # cd ... && ln -s ../../../dehetucks-includes/* .
> # mkdir inst/i386-vcu-linux/lib/
> # ctr*o, lib[cm].so
> 
> 
> inst="`pwd`/inst"
> # seems unused (but check inst/i386-vcu-linux/sys-include/)
> test -d inst/sys-include || mkdir inst/sys-include
> ( cd inst/sys-include && ln -sf
> ../../linux-2.6.16.60-0.37_f594963d-bigsmp/linux linux )
> ( cd inst/sys-include && ln -sf
> ../../asm-2.6.16.60-0.37_f594963d-bigsmp/asm asm )
> #test -d sysroot || mkdir sysroot
> 
> PATH=/bin:/usr/bin
> # TODO CHECK: should need old host triplet names?
> # --with-system-zlib \
> #  --prefix=/usr/local/ \
> #  --with-local-prefix: Do not specify /usr
> #  --with-sysroot
> #  --with-clocale=generic https://gcc.gnu.org/ml/gcc-help/2014-09/msg00010.html
> #  --with-cpu=generic   # original gcc-3.3.6 tells this, but not supported here?
> 
> cd objdir
> ../gcc-3.4.3/configure \
>   --target=i386-vcu-linux \
>   --prefix=$inst \
>   --with-local-prefix=$inst \
>   --enable-threads=posix \
>   --enable-languages=c,c++ \
>   --enable-ssp --disable-libssp \
>   --enable-shared --enable-__cxa_atexit \
>   --enable-libstdcxx-allocator=new \
>   --enable-version-specific-runtime-libs \
>   --without-system-libunwind
> 
> make -j8
> 


Hello Steffen,

Many flavors of linux still have gcc3 available. It is often called
"legacy gcc" or something like that. I know that CentOS and OpenSUSE
still have it. You can sometimes get it for Ubuntu buy using an older
repository.

I still compile and use gcc3/g77 code for 64-bit linux and this works
just fine, so I would suggest finding an acceptable linux that still
supports gcc3 instead of doing something more complicated.

LMH

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: building old gcc3 for i386-linux on recent x86-linux?
  2016-02-18 17:31 ` LMH
@ 2016-02-18 17:59   ` Steffen Dettmer
  0 siblings, 0 replies; 6+ messages in thread
From: Steffen Dettmer @ 2016-02-18 17:59 UTC (permalink / raw)
  To: LMH; +Cc: gcc-help

Hi,

thank you for your quick reply. My final target is to reproduce an old
setup for i386 and powerpc, and I guess I need to tweak some command
line options. Once I tried to modify Debian compiler but I found it
was very complicated :)

Steffen


On Thu, Feb 18, 2016 at 6:31 PM, LMH <lmh_users-groups@molconn.com> wrote:
> Steffen Dettmer wrote:
>> Hi,
>>
>> in short:
>> How to build a gcc3 host=x86-linux target=i386-old-linux today?
>> Are there alternatives?
>>
>> --long:
>> I'd have to build old 32 bit applications for old i386 Linux
>> systems and would like to use a recent 64 bit Linux system to do
>> so. I think I should be able to install an old gcc3 as
>> cross-compiler.
>>
>> As first step I unpacked binutils-2.16.1a.tar.bz2 and
>> gcc-3.4.3.tar.gz, symlinked " bfd binutils gas gprof ld opcodes"
>> to gcc src dir in order to perform a "combined build", created an
>> objdir and ran configure --target=i386-myold-linux, which worked
>> (see below for the complete commands).
>>
>> I wondered why I don't need any headers of the old glibc to be
>> used and so far no kernel headers... Did I miss something here?
>> (Note: in later attempts, I tried various combinations with
>> --sys-root, but had no success either). I expected that I'd build
>> bintuils+gcc+glibc (some older egclib) against the headers from
>> the old target kernel. Am I on the right way at all?
>>
>> After configure, I tried "make", but it fails:
>>
>>         gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
>> -o .libs/size size.o bucomm.o version.o filemode.o
>> ../bfd/.libs/libbfd.so
>> -L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
>> -liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
>> -Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/lib
>>         gcc: error: ./../intl/libintl.a: No such file or directory
>>         Makefile:615: recipe for target 'size' failed
>>
>> just guessing I tried:
>>
>>         make -C intl libintl.a
>>
>> which worked, so I repeated make. Now it fails a bit later with:
>>
>>         gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2
>> -o .libs/size size.o bucomm.o version.o filemode.o
>> ../bfd/.libs/libbfd.so
>> -L/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/libiberty/pic
>> -liberty ../libiberty/libiberty.a ./../intl/libintl.a -Wl,--rpath
>> -Wl,/net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/inst/x86_64-unknown-linux-gnu/i386-vcu-linux/libbucomm.o:
>> In function `make_tempname':
>>         /net/dehecnas1/Homes/sdettmer/tmp/gcc3/3/objdir/binutils/../../gcc-3.4.3/binutils/bucomm.c:425:
>> warning: the use of `mktemp' is dangerous, better use `mkstemp' or
>> `mkdtemp'
>>         ../bfd/.libs/libbfd.so: undefined reference to `unlink_if_ordinary'
>>         collect2: error: ld returned 1 exit status
>>         Makefile:615: recipe for target 'size' failed
>>
>> and indeed
>>
>>         nm libiberty/libiberty.a |grep unlink_if_ordinary
>>
>> finds nothing. Interestingly, when I build binutils in a
>> different object dir alone, I get a libiberty.a with:
>>
>>         nm libiberty/libiberty.a |grep unlink_if_ordinary
>>         0000000000000000 T unlink_if_ordinary
>>
>> so as I already was hacking I just used the whole folder in my
>> gcc build tree and re-run make. This time it runs some more
>> seconds until it fails with:
>>
>>         ../../gcc-3.4.3/gcc/config/i386/linux.h:217:20: signal.h: No
>> such file or directory
>>         ../../gcc-3.4.3/gcc/config/i386/linux.h:218:26:
>> sys/ucontext.h: No such file or directory
>>
>> in my kernel headers ("2.6.16.60-0.37_f594963d-bigsmp") I have
>> asm/ucontext.h, but no sys/ucontext.h. For a test, I copied
>> headers from target system to my inst/i386-vcu-linux/sys-include/
>> and some libs (crt*.o, libc.so and libm.so) to inst/i386-vcu-linux/lib.
>>
>> Make progresses but then fails with:
>>
>>         checking for main in -lm... configure: error: Link tests are
>> not allowed after GCC_NO_EXECUTABLES.
>>         Makefile:21960: recipe for target 'configure-target-libstdc++-v3' failed
>>         make: *** [configure-target-libstdc++-v3] Error 1
>>
>> This time I had no idea what I could hack to progress.
>>
>> I also tried to build with newer binutils versions
>> (binutils-2.19.1, binutils-2.22.tar.bz2), but they try to compile
>> with -Werror which fails because of gcc49 warnings.
>>
>> I tried older (2.14), but had issues resulting in an attemp to
>> run flex. I also tried gcc-3.3.6 (which I actually would prefere)
>> without success.
>>
>> I even tried to build a native gcc3 first (with make bootstrap),
>> but it also failed. First, with libiberty, as above, when copying
>> it from binutils build, I get:
>>
>>         gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
>> -D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
>> -I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
>> -I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
>>   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
>> ../../gcc-3.3.6/gprof/sparc.c
>>         gcc -DHAVE_CONFIG_H -I. -I../../gcc-3.3.6/gprof -I.
>> -D_GNU_SOURCE -DDEBUG -I../bfd -I../../gcc-3.3.6/gprof/../include
>> -I../../gcc-3.3.6/gprof/../bfd -I../../gcc-3.3.6/gprof/../intl
>> -I../intl -I. -DLOCALEDIR="\"/net/dehecnas1/Homes/sdettmer/tmp/gcc3/2/native/share/locale\""
>>   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -c
>> ../../gcc-3.3.6/gprof/mips.c
>>         cc    -c -o flat_bl.o ../../gcc-3.3.6/gprof/flat_bl.m
>>         cc: error trying to exec 'cc1obj': execvp: No such file or directory
>>         <builtin>: recipe for target 'flat_bl.o' failed
>>         make[3]: *** [flat_bl.o] Error 1
>>
>> (after several calls to gcc it calls cc?)
>>
>> and when removing gprof from Makefile it progresses, but finally
>> I cannot link because it misses ctri.o (it is in
>> /usr/lib/x86_64-linux-gnu/crti.o).
>>
>> How to build a gcc3 version today?
>>
>> Any hint, help or FAQ pointers appreciated! Google is not so
>> helpful when looking for older information...
>>
>> Steffen
>>
>>
>> ------------------------------------------------------------------->8=======
>>
>> #!/bin/bash
>> set -e
>>
>> function warn() { echo "$@" >&2 ; }
>> function die() { warn "FATAL: $@" ; exit 2 ; }
>>
>> #tar xjf binutils-2.16.1a.tar.bz2
>> #tar xzf gcc-3.4.3.tar.gz
>> #tar xzf glibc-2.3.4.tar.gz
>>
>> ( cd gcc-3.4.3/ && for d in bfd binutils gas gprof ld opcodes ; do ln
>> -sf ../binutils-2.16.1/$d . || die "failed to symlink binutils"; done
>> ) || die "error"
>>
>> test -d objdir || mkdir objdir
>> test -d binobjdir || mkdir binobjdir
>> test -d inst || mkdir inst
>>
>> #TODO
>> # mkdir inst/i386-vcu-linux/sys-include
>> # cd ... && ln -s ../../../dehetucks-includes/* .
>> # mkdir inst/i386-vcu-linux/lib/
>> # ctr*o, lib[cm].so
>>
>>
>> inst="`pwd`/inst"
>> # seems unused (but check inst/i386-vcu-linux/sys-include/)
>> test -d inst/sys-include || mkdir inst/sys-include
>> ( cd inst/sys-include && ln -sf
>> ../../linux-2.6.16.60-0.37_f594963d-bigsmp/linux linux )
>> ( cd inst/sys-include && ln -sf
>> ../../asm-2.6.16.60-0.37_f594963d-bigsmp/asm asm )
>> #test -d sysroot || mkdir sysroot
>>
>> PATH=/bin:/usr/bin
>> # TODO CHECK: should need old host triplet names?
>> # --with-system-zlib \
>> #  --prefix=/usr/local/ \
>> #  --with-local-prefix: Do not specify /usr
>> #  --with-sysroot
>> #  --with-clocale=generic https://gcc.gnu.org/ml/gcc-help/2014-09/msg00010.html
>> #  --with-cpu=generic   # original gcc-3.3.6 tells this, but not supported here?
>>
>> cd objdir
>> ../gcc-3.4.3/configure \
>>   --target=i386-vcu-linux \
>>   --prefix=$inst \
>>   --with-local-prefix=$inst \
>>   --enable-threads=posix \
>>   --enable-languages=c,c++ \
>>   --enable-ssp --disable-libssp \
>>   --enable-shared --enable-__cxa_atexit \
>>   --enable-libstdcxx-allocator=new \
>>   --enable-version-specific-runtime-libs \
>>   --without-system-libunwind
>>
>> make -j8
>>
>
>
> Hello Steffen,
>
> Many flavors of linux still have gcc3 available. It is often called
> "legacy gcc" or something like that. I know that CentOS and OpenSUSE
> still have it. You can sometimes get it for Ubuntu buy using an older
> repository.
>
> I still compile and use gcc3/g77 code for 64-bit linux and this works
> just fine, so I would suggest finding an acceptable linux that still
> supports gcc3 instead of doing something more complicated.
>
> LMH

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: building old gcc3 for i386-linux on recent x86-linux?
  2016-02-18 17:21 building old gcc3 for i386-linux on recent x86-linux? Steffen Dettmer
  2016-02-18 17:31 ` LMH
@ 2016-02-21 18:12 ` Florian Weimer
  2016-03-02 16:36   ` Steffen Dettmer
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2016-02-21 18:12 UTC (permalink / raw)
  To: Steffen Dettmer; +Cc: gcc-help

* Steffen Dettmer:

> How to build a gcc3 host=x86-linux target=i386-old-linux today?
> Are there alternatives?

The best way is to replicate the old development environment, perhaps
using virtualization or emulation.

In general, there is no other way because GCC itself is not
sufficient, you also need the old libraries to link to, in compatible
versions.  The old environment has all that, and is the simplest
approach if some distribution-supplied environment was used in the
first place.

If not, it can be easier to patch the existing binaries to fix the
bugs or add the missing functionality, depending on how complex the
original environment was and how invasive the desired changes are.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: building old gcc3 for i386-linux on recent x86-linux?
  2016-02-21 18:12 ` Florian Weimer
@ 2016-03-02 16:36   ` Steffen Dettmer
  2016-09-18 14:29     ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Dettmer @ 2016-03-02 16:36 UTC (permalink / raw)
  To: gcc-help

On Sun, Feb 21, 2016 at 7:12 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> How to build a gcc3 host=x86-linux target=i386-old-linux today?
>
> The best way is to replicate the old development environment, perhaps
> using virtualization or emulation.

OK, for the time being, now I'm using a virtual box appliance.
This of course works.

> In general, there is no other way because GCC itself is not
> sufficient, you also need the old libraries to link to, in compatible
> versions.

Yes sure, of course! This is a main purpose of the planned toolchains.

On recent linux, as required by recent hardware (for example,
supporting 70 GB RAM), libs are usually advanced and even
language (C++) is. So when using a recent linux dev env, we would
need to port the applications to old versions, which is far away
from fun (developers don't like downgrading own code to old
libs), so I think it is essential to develop with no newer
version than needed. Also, we like to met as much bugs as
possible on our simulation environment, because it is easier to
debug than the embedded target.

> The old environment has all that, and is the simplest approach
> if some distribution-supplied environment was used in the first
> place.

The old environment has all that only because it has the
appropriate GNU cross compiling toolchain. So I think the idea to
run the same GNU cross compiling toolchain also on the new host
system. Well, and then I hope it should be easy to cross-compile
to the simulators (technically, VirtualBox hosts), too. Should be
same, except that not intel but powerpc.

For the long term, I'd like to compile for multiple targets on
the same compile farm servers.

> If not, it can be easier to patch the existing binaries to fix
> the bugs or add the missing functionality, depending on how
> complex the original environment was and how invasive the
> desired changes are.

I didn't understand this part. I see no resonable way to patch an
application binary, of course the source code must be changed and
recompiled?

Steffen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: building old gcc3 for i386-linux on recent x86-linux?
  2016-03-02 16:36   ` Steffen Dettmer
@ 2016-09-18 14:29     ` Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2016-09-18 14:29 UTC (permalink / raw)
  To: Steffen Dettmer; +Cc: gcc-help

* Steffen Dettmer:

> On recent linux, as required by recent hardware (for example,
> supporting 70 GB RAM), libs are usually advanced and even
> language (C++) is. So when using a recent linux dev env, we would
> need to port the applications to old versions, which is far away
> from fun (developers don't like downgrading own code to old
> libs), so I think it is essential to develop with no newer
> version than needed. Also, we like to met as much bugs as
> possible on our simulation environment, because it is easier to
> debug than the embedded target.

Often, system administrators carve out a dedicated VM from the whole
system which runs legacy applications.

If the application is not really legacy and needs to be ported so that
the separate VM isn't required, we certainly do not expect a huge
effort.  At least as far as the toolchain is concerned; it's typically
possible to get current compilers into a mode where they still can
process rather questionable code.  GUI libraries are a different
matter.  I also expect that some of the effort in such porting
projects stems from a desire to clean up technically unrelated issues
in the code base.

If your experience is different, it would be interesting to know what
the pain points are.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-18 14:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18 17:21 building old gcc3 for i386-linux on recent x86-linux? Steffen Dettmer
2016-02-18 17:31 ` LMH
2016-02-18 17:59   ` Steffen Dettmer
2016-02-21 18:12 ` Florian Weimer
2016-03-02 16:36   ` Steffen Dettmer
2016-09-18 14:29     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).