I tried to compile GCC 2.95.3 in docker.
Although I have solved so many issues, but still failed.
For getting GCC 2.95.3 in a docker container, here is the shortcut:
//Pull this docker image
docker pull lpenz/debian-etch-i386
//Create an docker container with this image and bash into it, run following command to install
docker run -v $PWD:/root -p 8202:8202 -it lpenz/debian-etch-i386 bash
apt-get update && apt-get install gcc-2.95
You will get gcc-2.95.4
If you are interested in building your own gcc 2.95.3 in docker ubuntu, the attach full story can be useful for you. I believe that I am quite close now. I have spent 3 days on this. It's enough for me.
=======================
Some useful commands
apt-get update && apt-get install gcc-4.9 flex gcc-multilib g++-multilib gperf autoconf make
rm /usr/bin/gcc
rm /usr/bin/cc
ln -s /usr/bin/gcc-5 /usr/bin/gcc
ln -s /usr/bin/gcc-5 /usr/bin/cc
linux32 bash
time ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
rm -rf texinfo
cp ../Makefile gcc/Makefile
time make bootstrap CC="gcc -std=gnu89"
export LIBRARY_PATH=/usr/lib/i386-linux-gnu
time make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89"
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89 -B/usr/lib/i386-linux-gnu/"
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89 -I../glibc-2.10.1"
export C_INCLUDE_PATH=/data/gcc-2.95.3/glibc-workaround/include
export INCLUDE_PATH=/data/gcc-2.95.3/glibc-workaround/include
This is the step which I failed.
/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -I/data/gcc-2.95.3/include -D_IO_MTSAFE_IO -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o
=========================================
Full story of fighting GCC 2.95.3 on docker containers
run gcc in docker, and map the source code folder as volume
unzip the source code
install patch
patch the code
root@33077097f066:/data/gcc-2.95.3# patch -Np1 -i ../gcc-2.95.3-2.patch
patching file gcc/c-common.c
patching file gcc/config/alpha/crtbegin.asm
patching file gcc/config/i386/i386.c
patching file gcc/config/i386/linux.h
patching file gcc/config/rs6000/rs6000.md
patching file gcc/configure
patching file gcc/crtstuff.c
patching file gcc/cse.c
patching file gcc/function.c
patching file gcc/rtl.h
patching file gcc/rtlanal.c
patching file gcc/stor-layout.c
patching file gcc/toplev.c
patching file gcc/varasm.c
root@33077097f066:/data/gcc-2.95.3# patch -Np1 -i ../gcc-2.95.3-no-fixinc.patch
patching file gcc/Makefile.in
root@33077097f066:/data/gcc-2.95.3# patch -Np1 -i ../gcc-2.95.3-returntype-fix.patch
patching file gcc/toplev.c
root@33077097f066:/data/gcc-2.95.3#
You can do above steps using any linux system.
configure failed
root@33077097f066:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Configuring for a x86_64-pc-linux-gnuoldld host.
Invalid configuration `x86_64-pc-linux-gnuoldld': machine `x86_64-pc' not recognized
Invalid configuration `x86_64-pc-linux-gnuoldld': machine `x86_64-pc' not recognized
Unrecognized host system name x86_64-pc-linux-gnuoldld.
root@33077097f066:/data/gcc-build#
change the config.sub file to add x86_64* |
../gcc-2.95.3/configure: 7: /tmp/cONf193.pos: cc: not found
*** The command 'cc -o conftest -g conftest.c' failed.
To build a gcc, you need to have a gcc first.... chicken first
A prebuild gcc needs to be installed.
So you need to has a linux with gcc
docker run -it -v %cd%:/data gcc:4 bash
better, but got this error:
Configuration x86_64-unknown-linux-gnu not supported
Configure in /data/gcc-build/gcc failed, exiting.
root@a77b0f2253d5:/data/gcc-build#
root@a77b0f2253d5:/data/gcc-build# cp /usr/share/libtool/config/config.{guess,sub} ../gcc-2.95.3
same error, doesn't help
Then used this command
../gcc-2.95.3/configure --prefix=/opt/i386/gcc/gcc-2.95.3 --enable-languages=c,c++ --enable-threads=posix --enable-shared --host i386-pc-linux-gnu
Or great, worked!!!
Then I do:
root@cfb1e30f20ef:/data/gcc-build# make bootstrap
Got error:
checking lex output file root... configure: error: cannot find output from lex; giving up
Makefile:1188: recipe for target 'config.status' failed
make[1]: *** [config.status] Error 1
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
It seems that I need to install flex
Not very confident with alpine, I then used another ubuntu docker and rollback config.sub and config.guess file. Same issue, I had to add x86_64* as well.
Then still got the same flex not found error. But his time it happen with the config command, not the make command.
Then I installed flex:
root@fb7cba64b1ba:/data/gcc-build# apt-get install flex
I got this error again:
Configuration x86_64-unknown-linux-gnu not supported
Configure in /data/gcc-build/gcc failed, exiting.
(this problem is solved using newer config.sub and config.guess file, I rolled back the file)
I had resolved above error with gcc:4, then this error happen again in ubuntu.
So, I may just need to install flex in gcc:4
I couldn't find apk in this container... strange
root@cfb1e30f20ef:/data/gcc-build# cat /proc/version
Linux version 4.9.87-linuxkit-aufs (root@95fa5ec30613) (gcc version 6.4.0 (Alpine 6.4.0) ) #1 SMP Wed Mar 14 15:12:16 UTC 2018
It looked like a alpine.
But ...
root@cfb1e30f20ef:/data/gcc-build# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
root@cfb1e30f20ef:/data/gcc-build# cat /etc/*issue*
Debian GNU/Linux 8 \n \l
Debian GNU/Linux 8
It's actually a Debian
That's better, I can use apt-get update && apt-get install flex to install flex
run make bootstrap again
Got error:
Bootstrapping the compiler
make[1]: Entering directory '/data/gcc-build/gcc'
make[1]: *** No rule to make target 'bootstrap'. Stop.
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1490: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
I tried to run:
../gcc-2.95.3/configure --prefix=/opt/i386/gcc/gcc-2.95.3 --enable-languages=c,c++ --enable-threads=posix --enable-shared --host i386-pc-linux-gnu
again, but it stopped working.
with this error again:
Configuration x86_64-unknown-linux-gnu not supported
Configure in /data/gcc-build/gcc failed, exiting.
I reset the source code
Run
cp /usr/share/libtool/config/config.{guess,sub} ../gcc-2.95.3
../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
../gcc-2.95.3/configure --prefix=/opt/i386/gcc/gcc-2.95.3 --enable-languages=c,c++ --enable-threads=posix --enable-shared --host i386-pc-linux-gnu
Then succeed again
Links are now set up to build a native compiler for i386-pc-linux-gnu
updating cache ../config.cache
creating ./config.status
creating Makefile
creating intl/Makefile
creating po/Makefile.in
creating fixinc/Makefile
creating cp/Makefile
creating auto-host.h
linking ../../gcc-2.95.3/gcc/intl/libgettext.h to intl/libintl.h
creating libintl.h
Configuring etc...
loading cache ../config.cache
checking for a BSD compatible install... (cached) /usr/bin/install -c
creating ./config.status
creating Makefile
Then much better!!!
Next time, I will install flex in the very beginning. It may need to be installed before config .
make bootstrap
Now we have different error:
In file included from /usr/include/stdlib.h:24,
from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/features.h:374: sys/cdefs.h: No such file or directory
/usr/include/features.h:398: gnu/stubs.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:41: bits/waitflags.h: No such file or directory
/usr/include/stdlib.h:42: bits/waitstatus.h: No such file or directory
/usr/include/stdlib.h:314: sys/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:955: bits/stdlib-float.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:202: bits/posix_opt.h: No such file or directory
/usr/include/unistd.h:206: bits/environments.h: No such file or directory
/usr/include/unistd.h:217: bits/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:609: bits/confname.h: No such file or directory
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
root@a3b750f09d90:/data/gcc-build#
Install more lib
apt-get install build-essential libc6-dev libc6-dev-i386
make bootstrap
In file included from /usr/include/sys/types.h:270,
from /usr/include/stdlib.h:314,
from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/bits/pthreadtypes.h:122: warning: unnamed struct/union that defines no instances
/tmp/cccmbriC.s: Assembler messages:
/tmp/cccmbriC.s:310: Error: invalid instruction suffix for `push'
/tmp/cccmbriC.s:313: Error: invalid instruction suffix for `push'
/tmp/cccmbriC.s:314: Error: invalid instruction suffix for `push'
/tmp/cccmbriC.s:333: Error: invalid instruction suffix for `pop'
/tmp/cccmbriC.s:334: Error: invalid instruction suffix for `pop'
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
root@a3b750f09d90:/data/gcc-build#
Still no luck.
Then I tried to use linux32 to enter 32bit emu
linux32 bash
../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Great, works with the original config command.
The linux32 command will cheat bash to run in 32bit mode.
But still same error when run make bootstrap
I reset the source code again and start again, see what happen with linx32
../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Works, don't need to copy the new config.sub and config.guess files.
make bootstrap
This error again:
In file included from /usr/include/stdlib.h:24,
from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/features.h:374: sys/cdefs.h: No such file or directory
/usr/include/features.h:398: gnu/stubs.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:41: bits/waitflags.h: No such file or directory
/usr/include/stdlib.h:42: bits/waitstatus.h: No such file or directory
/usr/include/stdlib.h:314: sys/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:955: bits/stdlib-float.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:202: bits/posix_opt.h: No such file or directory
/usr/include/unistd.h:206: bits/environments.h: No such file or directory
/usr/include/unistd.h:217: bits/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:609: bits/confname.h: No such file or directory
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
root@a3b750f09d90:/data/gcc-build# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-linux-gnu/4.9.4/lto-wrapper
Target: x86_64-linux-gnu
Configured with: /usr/src/gcc/configure --build=x86_64-linux-gnu --disable-multilib --enable-languages=c,c++,fortran,go
Thread model: posix
gcc version 4.9.4 (GCC)
Then I installed gcc-multilib with following command
apt-get install gcc-multilib g++-multilib
/tmp/ccFsRsnm.s: Assembler messages:
/tmp/ccFsRsnm.s:310: Error: invalid instruction suffix for `push'
/tmp/ccFsRsnm.s:313: Error: invalid instruction suffix for `push'
/tmp/ccFsRsnm.s:314: Error: invalid instruction suffix for `push'
/tmp/ccFsRsnm.s:333: Error: invalid instruction suffix for `pop'
/tmp/ccFsRsnm.s:334: Error: invalid instruction suffix for `pop'
/tmp/ccFsRsnm.s:336: Error: invalid instruction suffix for `pop'
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
...No clue
I will try 32bit ubuntu
docker pull 32bit/ubuntu:16.04
docker run --name 32bit-ubuntu -v $PWD:/data -w /data -p 8201:8201 -it 32bit/ubuntu:16.04 bash
apt-get update && apt-get install gcc-4.9 flex
root@ea0cdd18affd:/data# alias gcc=gcc-4.9
root@ea0cdd18affd:/data# gcc -v
Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.9/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.3-13ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.9.3 (Ubuntu 4.9.3-13ubuntu2)
Check the system, it looks like a 64bit ubuntu....not sure
root@ea0cdd18affd:/data/gcc-build# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
root@ea0cdd18affd:/data/gcc-build# uname -m
x86_64
root@ea0cdd18affd:/data/gcc-build# file -L /sbin/init
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=65f768924762c6f25e2e92d1ae907196a5f2344d, stripped
From the last command, it looks like it's a 32bit system. Then all the outputs of other commands are not reliable.
I tried the above command in a x64 system, got this.
root@cfb1e30f20ef:/data/gcc-build# file -L /sbin/init
/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=297641215ac3a7482d3f2cfeb38782a5c70e4b33, stripped
arch will become i686 if running linux32
root@ea0cdd18affd:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Config.guess failed to determine the host type. You need to specify one.
This linux doesn't have sub and guess file, I copied the one from gcc:4
root@ea0cdd18affd:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Configuring for a x86_64-unknown-linux-gnu host.
Created "Makefile" in /data/gcc-build using "mt-frag"
../gcc-2.95.3/configure: 7: /tmp/cONf165.pos: cc: not found
*** The command 'cc -o conftest -g conftest.c' failed.
*** You must set the environment variable CC to a working compiler.
From another linux, we can see cc is just soft link of gcc
root@a3b750f09d90:/data/gcc-build# which cc
/usr/bin/cc
root@a3b750f09d90:/data/gcc-build# ls -l /usr/bin/cc
lrwxrwxrwx 1 root root 20 Sep 13 2017 /usr/bin/cc -> /etc/alternatives/cc
root@a3b750f09d90:/data/gcc-build# ls -l /etc/alternatives/cc
lrwxrwxrwx 1 root root 18 Sep 14 2017 /etc/alternatives/cc -> /usr/local/bin/gcc
root@a3b750f09d90:/data/gcc-build# ls -l /usr/bin/gcc
ls: cannot access /usr/bin/gcc: No such file or directory
root@a3b750f09d90:/data/gcc-build# which gcc
/usr/local/bin/gcc
So, I create a alias for it
root@ea0cdd18affd:/data/gcc-build# alias gcc=gcc-4.9
root@ea0cdd18affd:/data/gcc-build# alias cc=gcc-4.9
not working
root@ea0cdd18affd:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Configuring for a x86_64-unknown-linux-gnu host.
Created "Makefile" in /data/gcc-build using "mt-frag"
../gcc-2.95.3/configure: 7: /tmp/cONf510.pos: cc: not found
*** The command 'cc -o conftest -g conftest.c' failed.
*** You must set the environment variable CC to a working compiler.
Remove alias
root@ea0cdd18affd:/data/gcc-build# unalias gcc cc
Create symbolic link
root@ea0cdd18affd:/data/gcc-build# ln -s /usr/bin/gcc-4.9 /usr/bin/gcc
root@ea0cdd18affd:/data/gcc-build# ln -s /usr/bin/gcc-4.9 /usr/bin/cc
run config again
root@ea0cdd18affd:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Exactly same error:
Configuration x86_64-unknown-linux-gnu not supported
Configure in /data/gcc-build/gcc failed, exiting.
root@ea0cdd18affd:/data/gcc-build# linux32 bash
root@ea0cdd18affd:/data/gcc-build# ../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
Good
root@ea0cdd18affd:/data/gcc-build# make bootstrap
bash: make: command not found
root@ea0cdd18affd:/data/gcc-build# apt-get install make
root@ea0cdd18affd:/data/gcc-build# make bootstrap
/usr/include/features.h:367: sys/cdefs.h: No such file or directory
/usr/include/features.h:391: gnu/stubs.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:41: bits/waitflags.h: No such file or directory
/usr/include/stdlib.h:42: bits/waitstatus.h: No such file or directory
/usr/include/stdlib.h:314: sys/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/usr/include/stdlib.h:954: bits/stdlib-float.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:205: bits/posix_opt.h: No such file or directory
/usr/include/unistd.h:209: bits/environments.h: No such file or directory
/usr/include/unistd.h:220: bits/types.h: No such file or directory
In file included from ../../gcc-2.95.3/gcc/libgcc2.c:42:
/usr/include/unistd.h:612: bits/confname.h: No such file or directory
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
apt-get install gcc-multilib g++-multilib
Let's install the libs
root@ea0cdd18affd:/data/gcc-build# make bootstrap
Now we have a different error:
/usr/include/bits/pthreadtypes.h:123: warning: unnamed struct/union that defines no instances
../../gcc-2.95.3/gcc/frame.c:55: extra brace group at end of initializer
../../gcc-2.95.3/gcc/frame.c:55: (near initialization for `object_mutex.__data')
../../gcc-2.95.3/gcc/frame.c:55: extra brace group at end of initializer
../../gcc-2.95.3/gcc/frame.c:55: (near initialization for `object_mutex.__data')
../../gcc-2.95.3/gcc/frame.c:55: warning: excess elements in struct initializer
../../gcc-2.95.3/gcc/frame.c:55: warning: (near initialization for `object_mutex.__data')
Makefile:1422: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3299: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1493: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Accidentally upgraded gcc to 5.4
got a different error
More patch
../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-shared --enable-languages=c,c++ --enable-threads=posix
make bootstrap CC="gcc -std=gnu89"
Back to [libgcc2.a] Error 1
Tried the same thing on Azure VM with docker,
run 32bit/ubuntu, install gcc, flex, multilibs, git pull modified source code.
run linux32 bash
run config and make
make bootstrap CC="gcc -std=gnu89"
Got this error:
gperf -L C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
-k1,3,$ ../../gcc-2.95.3/gcc/c-parse.gperf >tmp-gperf.h
/bin/sh: 1: gperf: not found
Makefile:2741: recipe for target '../../gcc-2.95.3/gcc/c-gperf.h' failed
make[2]: *** [../../gcc-2.95.3/gcc/c-gperf.h] Error 127
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:4349: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1490: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
root@9963ba3cce19:/data/gcc-build#
apt-get install gperf
and try again
Got error:
gcc -std=gnu89 -c -DIN_GCC -g -DHAVE_CONFIG_H -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95.3/gcc/../include ../../gcc-2.95.3/gcc/function.c
../../gcc-2.95.3/gcc/function.c:61:23: fatal error: protector.h: No such file or directory
compilation terminated.
Makefile:627: recipe for target 'function.o' failed
make[2]: *** [function.o] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:4349: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1490: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
I made a mistake. I rolled back the patched, but only applied 4 more. I should applied the total 7 patches.
patch -Np1 -i ../gcc-2.95.3-2.patch
patch -Np1 -i ../gcc-2.95.3-externaldef-1.patch
patch -Np1 -i ../gcc-2.95.3-fix_install-1.patch
patch -Np1 -i ../gcc-2.95.3-no_fixinc-1.patch
patch -Np1 -i ../gcc-2.95.3-returntype_fix-1.patch
patch -Np1 -i ../gcc-2.95.3-ssp-4.patch
patch -Np1 -i ../gcc-2.95.3-sspspecs-5.patch
I reset the source code and reapply all 7 patches
retry
Got error:
/bin/sh: 1: autoheader: not found
Makefile:2223: recipe for target '../../gcc-2.95.3/gcc/
cstamp-h.in' failed
make[2]: *** [../../gcc-2.95.3/gcc/
cstamp-h.in] Error 127
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:4349: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1490: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
apt-get install autoconf
try again and got this error
makeinfo: Removing output file `
cpp.info' due to errors; use --force to preserve.
Makefile:3676: recipe for target '
cpp.info' failed
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:4349: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1490: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Someone proved that cpp-2.95.3 can be built from Ubuntu 14.1
To fix the error message from the question above: I commented out all the sections of the Makefiles of gcc-2.95.3 that compiled or installed texinfo
or cpp.info
.
I remove info and texinfo things from both Makefile and Makefile.in, ./gcc/Makefile
rerun config, and remove generated texinfo folder
make again
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
Makefile:1786: recipe for target 'gencheck' failed
make[2]: *** [gencheck] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3267: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
root@9963ba3cce19:/data/gcc-build#
use find command to find that crt1.o is in /usr/lib32 folder
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89 -B/usr/libx32/"
/usr/bin/ld: skipping incompatible /usr/libx32/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/libx32/libc.a when searching for -lc
/usr/bin/ld: i386:x64-32 architecture of input file `/usr/libx32/crt1.o' is incompatible with i386 output
/usr/bin/ld: i386:x64-32 architecture of input file `/usr/libx32/crti.o' is incompatible with i386 output
/usr/bin/ld: i386:x64-32 architecture of input file `/usr/libx32/crtn.o' is incompatible with i386 output
/usr/bin/ld: BFD (GNU Binutils for Ubuntu) 2.26.1 assertion fail ../../bfd/elf32-i386.c:3598
/usr/bin/ld: /usr/libx32/crt1.o(.text+0x23): reloc against `__libc_start_main@@GLIBC_2.0': error 4
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:1786: recipe for target 'gencheck' failed
make[2]: *** [gencheck] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3267: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Then noticed another folder that contains this file
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89 -B/usr/lib/i386-linux-gnu/"
strange, same not found dissue
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
treid
export LIBRARY_PATH=/usr/lib/i386-linux-gnu
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89"
/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o
In file included from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory
In file included from ../../../gcc-2.95.3/libio/iolibio.h:1,
from ../../../gcc-2.95.3/libio/libioP.h:47,
from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/libio.h:167: bits/stdio-lock.h: No such file or directory
Makefile:264: recipe for target 'iogetline.o' failed
make[2]: *** [iogetline.o] Error 1
make[2]: Leaving directory '/data/gcc-build/i686-pc-linux-gnu/libio'
Makefile:1363: recipe for target 'all-target-libio' failed
make[1]: *** [all-target-libio] Error 2
make[1]: Leaving directory '/data/gcc-build'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
tar xzf glibc-2.10.1.tar.gzmkdir -p gcc-2.95.3/glibc-workaround/include/bitscp glibc-2.10.1/bits/stdio-lock.h gcc-2.95.3/glibc-workaround/include/bitscp glibc-2.10.1/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h gcc-2.95.3/glibc-workaround/include/bitssed -i -n '1h;1!H;${;g;s/\(__pthread_slist_t __list;\n[ \t]*}\)/\1 __gcc_295_workaround__/g;p;}' gcc-2.95.3/glibc-workaround/include/bits/pthreadtypes.h
doesn't help,
found out where gcc search for headers
root@9963ba3cce19:/data/gcc-build# `gcc -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/usr/lib/gcc/i686-linux-gnu/5/../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/i386-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/i686-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/5/include-fixed
/usr/include
End of search list.
Add to include path
export C_INCLUDE_PATH=/data/glibc-2.10.1
root@9963ba3cce19:/data/gcc-build# cpp -v
Using built-in specs.
COLLECT_GCC=cpp
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-linux-gnu/5/cc1 -E -quiet -v -imultiarch i386-linux-gnu - -mtune=generic -march=i686 -fstack-protector-strong -Wformat -Wformat-security
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/i686-linux-gnu/5/../../../../i686-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/data/glibc-2.10.1
/usr/lib/gcc/i686-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/i686-linux-gnu/5/include-fixed
/usr/include/i386-linux-gnu
/usr/include
End of search list.
make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89"
/data/glibc-2.10.1/bits/wordsize.h:1: #error "This file must be written based on the data type sizes of the target"
Makefile:1418: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3267: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Which means the files in C_INCLUDE_PATH take higher priority
So I set
export C_INCLUDE_PATH=/data/gcc-2.95.3/glibc-workaround/include
Still error, the pthreadtypes.h file copied from lib doesn't work. I removed it.
try agian
Got:
/usr/include/bits/pthreadtypes.h:123: warning: unnamed struct/union that defines no instances
../../gcc-2.95.3/gcc/frame.c:55: extra brace group at end of initializer
../../gcc-2.95.3/gcc/frame.c:55: (near initialization for `object_mutex.__data')
../../gcc-2.95.3/gcc/frame.c:55: extra brace group at end of initializer
../../gcc-2.95.3/gcc/frame.c:55: (near initialization for `object_mutex.__data')
../../gcc-2.95.3/gcc/frame.c:55: warning: excess elements in struct initializer
../../gcc-2.95.3/gcc/frame.c:55: warning: (near initialization for `object_mutex.__data')
Makefile:1432: recipe for target 'libgcc2.a' failed
make[2]: *** [libgcc2.a] Error 1
make[2]: Leaving directory '/data/gcc-build/gcc'
Makefile:3313: recipe for target 'bootstrap' failed
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory '/data/gcc-build/gcc'
Makefile:1468: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Open /usr/include/bits/pthreadtypes.h and give a name
Try again
/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o
In file included from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory
In file included from ../../../gcc-2.95.3/libio/libio.h:167,
from ../../../gcc-2.95.3/libio/iolibio.h:1,
from ../../../gcc-2.95.3/libio/libioP.h:47,
from ../../../gcc-2.95.3/libio/iogetline.c:26:
/data/gcc-2.95.3/glibc-workaround/include/bits/stdio-lock.h:23: bits/libc-lock.h: No such file or directory
/data/gcc-2.95.3/glibc-workaround/include/bits/stdio-lock.h:31: #error libio needs recursive mutexes for _IO_MTSAFE_IO
Makefile:264: recipe for target 'iogetline.o' failed
make[2]: *** [iogetline.o] Error 1
make[2]: Leaving directory '/data/gcc-build/i686-pc-linux-gnu/libio'
Makefile:1363: recipe for target 'all-target-libio' failed
make[1]: *** [all-target-libio] Error 2
make[1]: Leaving directory '/data/gcc-build'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Funny, libc-lock.h can't find itself.
I can see the xgcc command will search gcc-2.95.3/libio folder. Then I copied the bits folder into libi
cp -R glibc-workaround/include/bits libio/
try again
Same
checking whether the C compiler (/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -g -O2 ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make[2]: Entering directory '/data/gcc-build/i686-pc-linux-gnu/libio'
test x"yes" != xyes ||\
/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o
In file included from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory
In file included from ../../../gcc-2.95.3/libio/libio.h:167,
from ../../../gcc-2.95.3/libio/iolibio.h:1,
from ../../../gcc-2.95.3/libio/libioP.h:47,
from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/bits/stdio-lock.h:23: bits/libc-lock.h: No such file or directory
../../../gcc-2.95.3/libio/bits/stdio-lock.h:31: #error libio needs recursive mutexes for _IO_MTSAFE_IO
Makefile:264: recipe for target 'iogetline.o' failed
make[2]: *** [iogetline.o] Error 1
make[2]: Leaving directory '/data/gcc-build/i686-pc-linux-gnu/libio'
Makefile:1363: recipe for target 'all-target-libio' failed
make[1]: *** [all-target-libio] Error 2
make[1]: Leaving directory '/data/gcc-build'
Makefile:1471: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2
Check if xgcc is working, yes
root@9963ba3cce19:/data/gcc-build# /data/gcc-build/gcc/xgcc -v
Using builtin specs.
gcc version 2.95.3 20010315 (release)
I copied the libc-lock.h to /usr/include/bits/
root@9963ba3cce19:/data/gcc-2.95.3# cp glibc-workaround/include/bits/* /usr/include/bits/
try again
same error
export INCLUDE_PATH=/data/gcc-2.95.3/glibc-workaround/include
try again
same
can use this command to reproduce the issue, don't need to make everytime
root@9963ba3cce19:/data/gcc-build/i686-pc-linux-gnu/libio# /data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. -I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o
In file included from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory
In file included from ../../../gcc-2.95.3/libio/libio.h:167,
from ../../../gcc-2.95.3/libio/iolibio.h:1,
from ../../../gcc-2.95.3/libio/libioP.h:47,
from ../../../gcc-2.95.3/libio/iogetline.c:26:
../../../gcc-2.95.3/libio/bits/stdio-lock.h:23: bits/libc-lock.h: No such file or directory
../../../gcc-2.95.3/libio/bits/stdio-lock.h:31: #error libio needs recursive mutexes for _IO_MTSAFE_IO
check cpp0's include
root@9963ba3cce19:/data/gcc-build/i686-pc-linux-gnu/libio# ../../gcc/cpp0 -v
GNU CPP version 2.95.3 20010315 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/data/gcc-2.95.3/glibc-workaround/include
/usr/local/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/opt/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/../../../../include/g++-3
/opt/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/../../../../i686-pc-linux-gnu/include
/opt/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include
End of omitted list.
...
Then I noticed that there is another patch file I need to use the workround
follow this page:
Still failing...
../../gcc-2.95.3/gcc/frame │ #define TOOLDIR_BASE_PREFIX "/usr/local/"
../../gcc-2.95.3/gcc/frame.c:55: `__PTHREAD_SPINS' undeclared here (not in a function) │diff --git a/gcc-2.95.3/libio/config/
mtsafe.mt b/gcc-2.95.3/libio/config/
mtsafe.mt../../gcc-2.95.3/gcc/frame.c:55: initializer element is not constant │index 5848851..987a880 100755
../../gcc-2.95.3/gcc/frame.c:55: (near initialization for `object_mutex.__data.__gcc_295_workaround__.__s│--- a/gcc-2.95.3/libio/config/
mtsafe.mtpins')
rm ../gcc-2.95.3/glibc-workaround/include/bits/pthreadtypes.h
time make bootstrap CC="gcc -std=gnu89"
`if [ -f /data/gcc-build/gcc/../texinfo/makeinfo/Makefile ] ; then echo /data/gcc-build/gcc/../texinfo/ma│index 5848851..987a880 100755
keinfo/makeinfo ; else echo makeinfo ; fi` -I../../gcc-2.95.3/gcc -o
cpp.info ../../gcc-2.95.3/gcc/cpp.t│--- a/gcc-2.95.3/libio/config/
mtsafe.mt/bin/sh: 1: /data/gcc-build/gcc/../texinfo/makeinfo/makeinfo: not found
Ok, seem the new patch does fix this one, I fixed with my previous solution.
Now
stage1/xgcc -Bstage1/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -DIN_GCC -O2 -g -O2 -m32 -DHAVE_C│index 5848851..987a880 100755
ONFIG_H -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95.3/gcc/../include \ │--- a/gcc-2.95.3/libio/config/
mtsafe.mt ../../gcc-2.95.3/gcc/gencheck.c │+++ b/gcc-2.95.3/libio/config/
mtsafe.mtcc1: Invalid option `32' │@@ -1,2 +1,2 @@
Makefile:1790: recipe for target 'gencheck.o' failed │ # tell we want the mt-safe version
make[2]: *** [gencheck.o] Error 1 │-MT_CFLAGS = -D_IO_MTSAFE_IO
make[2]: Leaving directory '/data/gcc-build/gcc' │+MT_CFLAGS = -D_IO_MTSAFE_IO -D__extern_inline='extern __inline' -I${srcdir}/../glibc-workaround/include
Makefile:3267: recipe for target 'bootstrap' failed │diff --git a/gcc-2.95.3/libstdc++/config/
linux.mt b/gcc-2.95.3/libstdc++/config/
linux.mtmake[1]: *** [bootstrap] Error 2 │index 5848851..987a880 100755
make[1]: Leaving directory '/data/gcc-build/gcc' │--- a/gcc-2.95.3/libstdc++/config/
linux.mtMakefile:1472: recipe for target 'bootstrap' failed │+++ b/gcc-2.95.3/libstdc++/config/
linux.mtmake: *** [bootstrap] Error 2
exit linux32 mode
doesn't help
I then removed the -m32 added by the patch in Makefile.in
Now
gencheck.o ` case "obstack.o" in ?*) echo obstack.o ;; esac ` ` case "" in ?*) echo ;; esac ` ` case ""│
in ?*) echo ;; esac ` ` case "" in ?*) echo ;; esac ` ` case "" in ?*) echo ;; esac ` │INSTALL_DOSREL = install-dosrel-fake
/usr/bin/ld: cannot find crt1.o: No such file or directory │
/usr/bin/ld: cannot find crti.o: No such file or directory │AS = as
collect2: ld returned 1 exit status │AR = ar
Makefile:1786: recipe for target 'gencheck' failed │AR_FLAGS = rc
make[2]: *** [gencheck] Error 1 │CC = cc
make[2]: Leaving directory '/data/gcc-build/gcc' │
Makefile:3267: recipe for target 'bootstrap' failed │# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
make[1]: *** [bootstrap] Error 2 │# here so that they can be overridden by Makefile fragments.
make[1]: Leaving directory '/data/gcc-build/gcc' │HOST_CC = $(CC_FOR_BUILD)
Makefile:1472: recipe for target 'bootstrap' failed │HOST_PREFIX =
make: *** [bootstrap] Error 2
Ok, forgot to back to linux32 mode
linux32 bash
export LIBRARY_PATH=/usr/lib/i386-linux-gnu
time make bootstrap CC="gcc -I /data/gcc-2.95.3 -std=gnu89"
back to the same error
/data/gcc-build/gcc/xgcc -B/data/gcc-build/gcc/ -B/opt/gcc-2.95.3/i686-pc-linux-gnu/bin/ -c -g -O2 -I. │# INSTALL_PROGRAM_ARGS is changed by
configure.in to use -x for a
-I../../../gcc-2.95.3/libio -D_IO_MTSAFE_IO -D__extern_inline='extern __inline' -I../../../gcc-2.95.3/lib│# cygwin32 host.
io/../glibc-workaround/include -fpic ../../../gcc-2.95.3/libio/iogetline.c -o pic/iogetline.o │INSTALL_PROGRAM_ARGS =
In file included from ../../../gcc-2.95.3/libio/iogetline.c:26: │
../../../gcc-2.95.3/libio/libioP.h:38: bits/libc-lock.h: No such file or directory │INSTALL = $(SHELL) $$s/install-sh -c
In file included from ../../../gcc-2.95.3/libio/libio.h:167, │INSTALL_PROGRAM = $(INSTALL) $(INSTALL_PROGRAM_ARGS)
from ../../../gcc-2.95.3/libio/iolibio.h:1, │INSTALL_SCRIPT = $(INSTALL)
from ../../../gcc-2.95.3/libio/libioP.h:47, │INSTALL_DATA = $(INSTALL) -m 644
from ../../../gcc-2.95.3/libio/iogetline.c:26: │
../../../gcc-2.95.3/libio/../glibc-workaround/include/bits/stdio-lock.h:23: bits/libc-lock.h: No such fil│INSTALL_DOSREL = install-dosrel-fake
e or directory │
../../../gcc-2.95.3/libio/../glibc-workaround/include/bits/stdio-lock.h:31: #error libio needs recursive │AS = as
mutexes for _IO_MTSAFE_IO │AR = ar
Makefile:264: recipe for target 'iogetline.o' failed │AR_FLAGS = rc
make[2]: *** [iogetline.o] Error 1 │CC = cc
make[2]: Leaving directory '/data/gcc-build/i686-pc-linux-gnu/libio' │
Makefile:1364: recipe for target 'all-target-libio' failed │# Special variables passed down in EXTRA_GCC_FLAGS. They are defined
make[1]: *** [all-target-libio] Error 2 │# here so that they can be overridden by Makefile fragments.
make[1]: Leaving directory '/data/gcc-build' │HOST_CC = $(CC_FOR_BUILD)
Makefile:1472: recipe for target 'bootstrap' failed │HOST_PREFIX =
make: *** [bootstrap] Error 2
Gave up!!!!
Try to get working binary directory:
I found the deb version from:
ennng@fengUbuntu:~/deb$ sudo apt install ./gcc_2.95.2-13.1_i386.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'gcc:i386' instead of './gcc_2.95.2-13.1_i386.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc:i386 : Depends: libc6:i386 (>= 2.1.2) but it is not installable
Depends: cpp:i386 (>= 1:2.95.2-10) but it is not installable
Depends: cpp:i386 (< 1:2.95.3) but it is not installable
Depends: binutils:i386 (>= 2.9.5.0.12) but it is not installable
Recommends: libc-dev:i386 but it is not installable
E: Unable to correct problems, you have held broken packages.
I tried the following compiling sequences:
4.3.2 build 2.95.2 --- failed
4.3.2->3.3.6->2.7.2.3 --- success.
4.3.2 -> 2.7.2.3 --- success
3.3.6 -> 2.95.2 --- failed
Tried the following method and get gcc-3.4 installed successfully on ubuntu docker.
https://askubuntu.com/questions/39628/old-version-of-gcc-for-new-ubuntu
edit
/etc/apt/sources.list
for breezy, dapper, edgy, feisty, gutsy, hardy etc
deb http://old-releases.ubuntu.com/ubuntu/ hardy universe
deb-src http://old-releases.ubuntu.com/ubuntu/ hardy universe
apt update
apt install gcc-3.4
root@072407a24838:/# gcc-3.4 -v
Reading specs from /usr/lib/gcc/x86_64-linux-gnu/3.4.6/specs
Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug x86_64-linux-gnu
Thread model: posix
gcc version 3.4.6 (Ubuntu 3.4.6-6ubuntu3)
root@072407a24838:/#
Successfully got gcc-3.4 installed. But it doesn't seem to work well becuase a lot of dependent libs are missing.
docker pull lpenz/debian-etch-i386
apt-get update && apt-get install gcc-2.95
41bc3f4f5cb1:/# gcc-2.95 -v
Reading specs from /usr/lib/gcc-lib/i486-linux-gnu/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
Success.
Other Refs:
--
Feng
没有评论:
发表评论