LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how to install an old gcc 3.3 in UBUNTU 20.04 (https://www.linuxquestions.org/questions/programming-9/how-to-install-an-old-gcc-3-3-in-ubuntu-20-04-a-4175698651/)

lamincrb 08-03-2021 05:36 AM

how to install an old gcc 3.3 in UBUNTU 20.04
 
Hello Every one.
I want to install an old compiler (gcc 3.0, 3.1, 3.2 or 3.3) in UBUNTU 20.04
I tried with
sudo apt-get install gcc-3
But I get an error "E: Unable to locate package gcc-3"
and sudo apt-get install g++-3 gives me :
"E: Unable to correct problems, you have held broken packages"
I googled it and I add some sources to source.list
but nothing
the whole thing is that I add an old script (created in 2002) to my NS2.35 and when I try to compile it with "make" or "./install" it gives me problems like
(list.h no such file or directory) I searched for this header and I find one in "usr/src/linux-headers-5.4.0-48/scripts/kconfig/list.h" but when I use it it still gives me errors with some variables like "‘visitlist_’ was not declared in this scope" etc..
can anyone help me.

rtmistler 08-03-2021 06:52 AM

Quote:

Originally Posted by lamincrb (Post 6272087)
Hello Every one.
I want to install an old compiler (gcc 3.0, 3.1, 3.2 or 3.3) in UBUNTU 20.04
I tried with
sudo apt-get install gcc-3
But I get an error "E: Unable to locate package gcc-3"
and sudo apt-get install g++-3 gives me :
"E: Unable to correct problems, you have held broken packages"
I googled it and I add some sources to source.list
but nothing
the whole thing is that I add an old script (created in 2002) to my NS2.35 and when I try to compile it with "make" or "./install" it gives me problems like
(list.h no such file or directory) I searched for this header and I find one in "usr/src/linux-headers-5.4.0-48/scripts/kconfig/list.h" but when I use it it still gives me errors with some variables like "‘visitlist_’ was not declared in this scope" etc..
can anyone help me.

Recommend you download the source for the version you want, build it, and install it. There's a readme file which will tell you what to do and any pre-requisites needed. Typically you will run a configure script, run make, then run a make install using sudo:
Code:

./configure
make
sudo make install


pan64 08-03-2021 08:09 AM

do you really need that old compiler?

lamincrb 08-03-2021 08:40 AM

Quote:

Originally Posted by rtmistler (Post 6272100)
Recommend you download the source for the version you want, build it, and install it. There's a readme file which will tell you what to do and any pre-requisites needed. Typically you will run a configure script, run make, then run a make install using sudo:
Code:

./configure
make
sudo make install


can you give a link where I can download the GCC 3.0 source?

lamincrb 08-03-2021 08:43 AM

Quote:

Originally Posted by pan64 (Post 6272119)
do you really need that old compiler?

Yes, because the model that I want to add to NS2, cannot be compiled only with an old version of GCC, as I said above some Headers does not exist in the latest version,
I will be very greatful if you give any other solution

shruggy 08-03-2021 09:27 AM

The easiest way is probably to fetch the source from Debian Archive:
Code:

dget -u http://archive.debian.org/debian/pool/main/g/gcc-3.3/gcc-3.3_3.3.6ds1-27.2.dsc
cd gcc-3.3-*
sed -i '/DH_COMPAT/s/=2$/=5/' debian/rules
sed -i '/= gcc /s/gcc/&-7/' debian/rules2
sed -i 's/realpath[^,]*/gcc-7/' debian/control
pdebuild

But the problem is you cannot build gcc 3.3 with any gcc compiler present in Ubuntu 20.04 repos. As you can see above, I tried gcc-7 which is the oldest version available there. Nevertheless, I got
Code:

../../src/gcc/unwind-dw2.c: In function `uw_frame_state_for':
../../src/gcc/unwind-dw2.c:954: error: dereferencing pointer to incomplete type

You may try to directly install binary deb files for gcc 3.3 from Debian Archive. If that won't do the trick, you'll be left with two options: either patch GCC sources so it can be built with at least gcc-7 (unfortunately, the fix referenced there, is not available anymore), or bootstrap it by building say gcc-5 first, and then gcc-3 with freshly built gcc-5.

lamincrb 08-04-2021 02:53 AM

Quote:

Originally Posted by shruggy (Post 6272152)
The easiest way is probably to fetch the source from Debian Archive:
Code:

dget -u http://archive.debian.org/debian/pool/main/g/gcc-3.3/gcc-3.3_3.3.6ds1-27.2.dsc
cd gcc-3.3-*
sed -i '/DH_COMPAT/s/=2$/=5/' debian/rules
sed -i '/= gcc /s/gcc/&-7/' debian/rules2
sed -i 's/realpath[^,]*/gcc-7/' debian/control
pdebuild

But the problem is you cannot build gcc 3.3 with any gcc compiler present in Ubuntu 20.04 repos. As you can see above, I tried gcc-7 which is the oldest version available there. Nevertheless, I got
Code:

../../src/gcc/unwind-dw2.c: In function `uw_frame_state_for':
../../src/gcc/unwind-dw2.c:954: error: dereferencing pointer to incomplete type

You may try to directly install binary deb files for gcc 3.3 from Debian Archive. If that won't do the trick, you'll be left with two options: either patch GCC sources so it can be built with at least gcc-7 (unfortunately, the fix referenced there, is not available anymore), or bootstrap it by building say gcc-5 first, and then gcc-3 with freshly built gcc-5.

Thank you!
I had download the package, and I am now adding the headers one by one and recompile.
is this the right way?
when I finish it I will tell you.

hazel 08-04-2021 09:40 AM

If you do actually get it to build, make sure you set a program prefix or suffix when configuring to distinguish the result from your regular gcc.

rnturn 08-05-2021 11:20 PM

Quote:

Originally Posted by lamincrb (Post 6272137)
can you give a link where I can download the GCC 3.0 source?

One of the Gnu mirrors will have it. I found it at http://mirror.team-cymru.com/gnu/gcc/

Hope this helps...

lamincrb 08-07-2021 03:30 AM

Quote:

Originally Posted by rnturn (Post 6272954)
One of the Gnu mirrors will have it. I found it at http://mirror.team-cymru.com/gnu/gcc/

Hope this helps...

Hello,
Thanks, the problem is fixed, I downloaded gcc-g ++ - 3.4.4.tar.bz2 from your link and added the headers.
compilation is completed correctly.


All times are GMT -5. The time now is 10:11 PM.