Sunday, April 02, 2006

Install gcc on Ubuntu

If you only install gcc, you will get an error saying that standard libraries are lacking.

You have to install an other package: build-essential.

To install gcc:

sudo apt-get install gcc build-essential

43 Comments:

Anonymous Anonymous said...

Which does not help what so fscking ever on computers lacking an ethernet port or internet.

5:25 PM  
Anonymous Anonymous said...

Thanks, just what I needed.

10:21 PM  
Anonymous Anonymous said...

thanks, will try that tonight.

3:49 AM  
Anonymous Anonymous said...

this works. Thanks a LOT

4:22 AM  
Anonymous Anonymous said...

Thanks for your help.
I'll try it.

8:09 AM  
Anonymous Anonymous said...

thanks, i could not figure out why my stuff was not working, this was exactly what was wrong.

2:17 PM  
Anonymous Anonymous said...

Thank you very much for this tip. Much faster than searching solution on ubuntu guides.

3:00 PM  
Anonymous Anonymous said...

Great advice. Thanks.
Just wanted to point out that it fixes the following problem as well:
>"C compiler cannot create executables. "

3:32 PM  
Anonymous Anonymous said...

Yes, that worked. gcc couldn't find header files on a newly installed ubuntu 6.10 from cd. gcc was there but all the header files were missing. It installed 30+ Meg of other stuff but at least it'll compile a hello.c prog now.

8:39 AM  
Anonymous Anonymous said...

Does it work if i want to install gcc from ubuntu install cd without internet access?

3:56 AM  
Blogger Eric said...

tnx a lot! how nice =D

7:13 AM  
Anonymous Anonymous said...

Thanks a lot for the solution. Damn, if only I had bumped into this 2 hours ago, I'd not have wasted 2 hours of my life googling.

Like anonymous said, 30+ Meg of bull, yet it at least compiles a helloworld.c LOL... nice... phew.

7:49 PM  
Anonymous Anonymous said...

great, everything is solved by just a line of command

5:54 PM  
Anonymous Anonymous said...

Thanks, it seems to have worked. Where did you learn how to write that command? How would I install other software?

Also, your command set up version 4.0 while it appears version 4.1 is current. How do I install the latest? I have it downloaded but I frankly don't know what to do next.

Finally, where did your command install it? I see no new entry in the menus under programming, etc. How do I start it?

1:55 PM  
Blogger Unknown said...

Reading package lists... Done
Building dependency tree... Done
gcc is already the newest version.
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:
build-essential: Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: gcc (>= 4:4.1.1) but 4:4.0.3-1 is to be installed
Depends: g++ (>= 4:4.1.1) but it is not going to be installed Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
E: Broken packages
i get the following message can u help

10:55 PM  
Anonymous Anonymous said...

i was having a "no such file or directory" error meaning that lbrary was missing, this fixed. Thanks.

2:39 PM  
Anonymous Anonymous said...

Thank you! gcc is now able to compile other programs

3:43 PM  
Anonymous Anonymous said...

cheers, tried downloading ubuntu dapper gcc 4.0 which was a nightmare to try and configure, who would have thought something as vital as gcc would have been left out

4:20 AM  
Anonymous Anonymous said...

Spasibo!

4:38 AM  
Anonymous Anonymous said...

Thank you! Now I get to hunt down dependancies for the file I'm configuring...

8:04 PM  
Anonymous Anonymous said...

THANKS A LOT! I've been looking all over the place for this!

3:15 AM  
Anonymous Anonymous said...

thank you!

1:10 AM  
Anonymous Anonymous said...

I'm really so thankful to you ... It fixes the following error.
"C compiler cannot create executables "

4:37 AM  
Blogger Massi said...

Thank you very very much

7:44 AM  
Anonymous Anonymous said...

Many, many thanks. I would never have figured this out on my own.

6:07 PM  
Anonymous Anonymous said...

Excellent. It works very well on my laptop.
PS - I had to solve the access to internet through the wireless funtion. The solution is to use the NAT share option

12:28 PM  
Anonymous Anonymous said...

thanks! working for me

9:12 PM  
Anonymous Anonymous said...

thank you very much for this "magic" command!

8:50 AM  
Anonymous Anonymous said...

thanks a lot!! worked fine for me :-D

1:25 PM  
Blogger nitya said...

thanx a lot!!!!!!!

6:49 AM  
Anonymous Anonymous said...

I couldn't compile, but now everything works. Thanks for the help!

5:03 AM  
Anonymous Anonymous said...

Thanks for sharing your insight! Amazing how tricky setting up a Linux system is to this day, any novice will spend (waste) a lot of time trying to figure this out.

9:17 AM  
Anonymous Anonymous said...

Thanks.
In June 2008 it is still not fixed, you still have to install build-essential.

But...how are you supposed to know.

Ubuntu developers please note.

5:07 AM  
Anonymous Anonymous said...

2 hours? I wasted 2 days playing with c++ compilig on linux (task that is easy like walking in windows ). Tried 4 different linuxes liveCD and installation on 3 different virtualization softs. I hope this will finaly work... You know, this OS is really a nightmare for me sometimes.

3:32 PM  
Anonymous Anonymous said...

GOD Bless you so much, you just made my assignment in school much easier.

10:41 AM  
Anonymous Anonymous said...

just what i wanted..awesome!

10:50 PM  
Anonymous Anonymous said...

well guys.....instead of installing....ubuntu,i just switched over to graphical features available on the screen while booting....as long as cd is in the rom mY computer is working on linux,but when i tr y to compile c programs using "gcc" it gave me an error as"gcc command not found" then i used these commands to update....

1)sudo apt-get update
2)sudo apt-get install build-essential


then it took around 40min to update....now everything is working fine.....but if i restart my computer all those downloaded files are being erased and giving me same error GCC comand not found...!how can i get rid of this problem???

is it possible without using internet....


'm using UBUNTU 6.0.1...

PLEASE HELP ME...

THANKS IN ADVANCE,


REGARDS,

ANUDEEP

8:37 PM  
Blogger Anna said...

Yet another thank you!

8:57 AM  
Anonymous Tati said...

Another thanks very much! I tried so much but it was your simple addition of gcc to the build-essential that got this package working for me. Amazing. Btw I commented out all other repositories in my /etc/apt/sources.list besides

deb http://ftp.us.debian.org/debian lenny main non-free contrib

because I was getting "unmet dependencies" errors otherwise. I think the reason for this is that I installed Flash Player 10 which does something to the libc6.

4:47 PM  
Blogger Motiur Rahman said...

Hey do you know where to keep the files such .php using xampp.And also how to say that here is a php file ,parse it,using terminal.

4:12 PM  
Anonymous Anonymous said...

For thos not having access to internet, you have build essential on your install disk. Just enable disk under update manager and settings. It should search for the build essentials there when you issues the apt-get command.

Happy compiling

6:38 AM  
Blogger gumuruhsspj said...

OMG...!! my ubuntu-10.04-netbook-i386

seems says NO with the GCC.
Everytime When I already Install the Linux and I try to insert the CD
and start executing command

sudo apt-get install build-essential

it always responded with,

"
Reading package Lists...Done
Building Dependency tree
Reading State Information... Done
E: Couldn't find package build-essential
"

anyone could help me?
What should I do?

should I get the GCC Installer
(tar) manually from the Internet ??

OMG. my internet isn't configured yet.

8:31 PM  
Blogger Kaushal Subedi said...

Great! It Worked!! Thanks For Posting :) I could not install cpanel in my home server due to gcc, and now i have it :)

11:43 AM  

Post a Comment

<< Home