LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-03-2021, 05:36 AM   #1
lamincrb
LQ Newbie
 
Registered: May 2021
Posts: 6

Rep: Reputation: Disabled
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.
 
Old 08-03-2021, 06:52 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by lamincrb View Post
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
 
Old 08-03-2021, 08:09 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
do you really need that old compiler?
 
Old 08-03-2021, 08:40 AM   #4
lamincrb
LQ Newbie
 
Registered: May 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
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?
 
Old 08-03-2021, 08:43 AM   #5
lamincrb
LQ Newbie
 
Registered: May 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
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
 
Old 08-03-2021, 09:27 AM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
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.

Last edited by shruggy; 08-03-2021 at 09:30 AM.
 
1 members found this post helpful.
Old 08-04-2021, 02:53 AM   #7
lamincrb
LQ Newbie
 
Registered: May 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shruggy View Post
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.

Last edited by lamincrb; 08-04-2021 at 02:56 AM.
 
Old 08-04-2021, 09:40 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
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.
 
Old 08-05-2021, 11:20 PM   #9
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by lamincrb View Post
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...
 
Old 08-07-2021, 03:30 AM   #10
lamincrb
LQ Newbie
 
Registered: May 2021
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rnturn View Post
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.
 
  


Reply

Tags
ubuntu 20.04



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
step 5.10 gcc/limitx.h gcc/glimits.h gcc/limity.h no such file or directory iambrj Linux From Scratch 7 08-07-2018 11:22 AM
LXer: GCC 4.9 vs. GCC 5.1 vs. GCC 6.0 SVN Compiler Benchmarks LXer Syndicated Linux News 0 06-08-2015 01:00 PM
Compiling Old Kernel with Old GCC d4n4mp Linux - Newbie 1 11-03-2014 01:55 PM
LXer: GCC Turns 25 Years Old, GCC 4.7 Released LXer Syndicated Linux News 0 03-22-2012 04:30 PM
[SOLVED] SEGMENTATION FAULT using gcc 4.4.4 -O2 , works with gcc 4.1.0 -O2 or gcc 4.4.4 -O1 amir1981 Programming 36 07-26-2010 06:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration