LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-21-2006, 09:41 PM   #1
matazar42
Member
 
Registered: Dec 2004
Location: California
Distribution: Red Hat 9
Posts: 51

Rep: Reputation: 15
Why compile?


Hi everyone, I've been working with Linux for quite a while. I have this general question that I still havn't figured out, that is: why do we have to compile everything from sorce? I mean, in windows no new applications need compiling. They need to be installed. Files put in place regestry entries made etc. But not compiled. I know every distribution of Linux is different and that this means that in order to distribute software to many distributions it is necesarry to compile it for that individual distrobution. But why is this the case? I mean an executable is an executable, right? I can see you needing to configure and install something, but why compile?

Thanks,

-Matt
 
Old 06-21-2006, 10:10 PM   #2
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
basically, compilation means that you get software that is best optimized for your system. On the most basic level, all you need to do is
Code:
./configure
make
(as root and optional but recommended) 
make install
it's really easy. - and if you want to, you can make sure your machine is working at it's very best.

There are also other ways to package software- look up .rpm and .deb - these are like .exe in a way. Run once and bingo.

titanium_geek

EDIT: This is just a general answer, it doesn't answer your question in full. I think it has something to do with the fact that windows has more limited system requirements and also dll's (dynamic linked libraries) not sure.

Ooh- .exe is for the installer and for the runner, in windows, right? Unix doesn't need to have the .exe or .whatever to make a file executable.

I probably should know the answer here, but I'm just stabbing in the dark, really.

Last edited by titanium_geek; 06-21-2006 at 10:20 PM.
 
Old 06-21-2006, 11:28 PM   #3
tamoneya
Member
 
Registered: Jan 2005
Location: MA
Distribution: Ubuntu 7.10
Posts: 558

Rep: Reputation: 30
titanium geek is right. as for why windows doesnt do it.

1) windows doesnt have to work with the same variety of hardware configurations that linux uses. All windows computers either have a intel or athlon processor for the most part. Linux can have many more options. linux also has different partitioning options than windows. The more options you have the more you gain from optimization by compiling from source.
2)linux is primarily open source and therefore you can compile from source. If you have a non-open source program you cant compile from source because they wont give you the source
3)it is windows and sucks
 
Old 06-22-2006, 12:21 AM   #4
matazar42
Member
 
Registered: Dec 2004
Location: California
Distribution: Red Hat 9
Posts: 51

Original Poster
Rep: Reputation: 15
So, then it is possible to just distribute the executable for Linux. It's just not perferred because of the increased performance.

Although now that I'm thinking about it, Windows only runs on x86 architecture right? I know you definately need to recompile to change architectures because the processor commands are completely different. Linux can run on a veriety of architectures right? I bet that's the main reason. Even though probably the vast majority run on x86 because that's what's out there.

thanks
 
Old 06-22-2006, 01:07 AM   #5
daihard
Member
 
Registered: Jul 2003
Location: Lynnwood, WA
Distribution: Kubuntu 10.10
Posts: 912

Rep: Reputation: 32
Quote:
Originally Posted by matazar42
Although now that I'm thinking about it, Windows only runs on x86 architecture right? I know you definately need to recompile to change architectures because the processor commands are completely different. Linux can run on a veriety of architectures right? I bet that's the main reason. Even though probably the vast majority run on x86 because that's what's out there.
Most Linux programs need compiling because there's no single "version" of Linux available, like Windows 2000/XP. If a particular Windows app works on a Windows XP computer, it is pretty much guaranteed to work on other XP computers because all copies of XP have the exact same versions of the libraries and other OS components. OTOH, "Linux" has many different versions and flavours, which may very well have different versions of glibc, gtk-libs, etc.

That is why generic software for Linux usually comes in source code and build script, and precisely why binary (i.e. precompiled) packages are available for a particular distribution, such as Fedora Core and Mandriva.
 
Old 06-22-2006, 01:09 AM   #6
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,544
Blog Entries: 4

Rep: Reputation: 56
Just use your package manager to install programs. Most distrobutions have a binary package manager and even most source-based distros have an option to use binary packages.
 
Old 06-22-2006, 01:16 AM   #7
vikasumit
Member
 
Registered: Apr 2006
Location: Delhi, India
Distribution: Fedore , CentOs, Debian
Posts: 121

Rep: Reputation: 15
Hi,

Quote:
Originally Posted by tamoneya
1) windows doesnt have to work with the same variety of hardware configurations that linux uses. All windows computers either have a intel or athlon processor for the most part. Linux can have many more options. linux also has different partitioning options than windows. The more options you have the more you gain from optimization by compiling from source.
Windows support many hardware platform, but since windows has different version for different hardware, they have a kind of Pre set enviornment, like Windows CE is for compact device where as general windows is for Desktop etc... If in general you see, you will find that windows and linux mostly used on same platform, i mean have you ever install in on your Mobile phone or your playstation ...Most of us answer it as no they only install Linux on Desktop machine (intel and athlon processors only)

Yes Linux is one package for different hardware, it means you can install Single Linux distro on totally different enviornment not just a desktop machine will be better wording

Quote:
Originally Posted by tamoneya
2)linux is primarily open source and therefore you can compile from source. If you have a non-open source program you cant compile from source because they wont give you the source
That doesn;t mean all linux user have to compile from source ?? does open source says you have to comiple it from source
You only need to compile from source if you want to customize your application as per your requirement... otherwise you can pick its binary from any system and run them (* condition applied explain later)

Quote:
Originally Posted by tamoneya
3)it is windows and sucks
Well I am not sure if you really compile Linux kernal to customize it according to your need... Windows is Non Techincal user Operating system... My Parents can use it like cake, but I am techincal and go software development so it might suite my requirement. Also Windows is commerical product Linux is Every ones product, whosoever want Comiple it without knowing what he is doing ...


Now on main question:-
In general you don't need to compile software for each distro, but since linux is open source, some who hate Windows develop there version of linux (distro) and change some base files location, like in my Red hat I have binary installed in /usr/sbin but in my Debian system it might be in /usr/bin so if a application is compiled using one path, it fails on other system. So we need to recomiple it from source to make it work...

If you make a application that doesn't use any system application like Copy command, or Su or any other, you can use single binary on any distro since they doesn't depend on your system, they are just a executable

Also , some hardware platforms are different in their core working so they need application to use their instruction set which they understand is one of old and main reason one look for open source, not just to blame windows.

and do not compare windows with linux you cannot compare Jet Plans with Fighter Plan they are for different purpose though can be used in same scope...
 
Old 06-22-2006, 01:38 AM   #8
2damncommon
Senior Member
 
Registered: Feb 2003
Location: Calif, USA
Distribution: Debian Wheezy
Posts: 2,838

Rep: Reputation: 48
Quote:
Why compile?
Because you can. You decide if you should.
 
Old 06-22-2006, 01:41 AM   #9
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,748

Rep: Reputation: 159Reputation: 159
Why compile?

Because we can!

Edit: Dammit. Beaten to the punch again.
 
Old 06-22-2006, 04:08 AM   #10
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Nobody is asking you to compile. You can use binary packages in most distros.
You have to compile when there is no binary package, that is nobody compiled it for you. In Windows, you pay someone to compile and package it for you (you is a group of several thousand people). You have to wait for the package to be ready and you have to pay the bucks and everything else is hidden. the package better suit your need because it is the only one. Hopefully you don't have exotic components.
In linux, you can pick a package already compiled, and you can see the latest version that has not already been packaged and even involve yourself in the development. Everything is open.
In other words, one has to compile in Windows too, but the people who do that do it in secret, whereas in linux they do that openly and you can do it as well. As a result, Windows looks like easier because you don't see everything.

Last edited by Agrouf; 06-22-2006 at 04:18 AM.
 
Old 06-22-2006, 06:25 AM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Originally Posted by matazar42
So, then it is possible to just distribute the executable for Linux. It's just not perferred because of the increased performance.
For the vast majority of applications, just using your package manager to install the SW will give you all the performance you need. You would never see the performance increase from compiling your own.

Good package managers (Synaptic in Ubuntu, Pacman in Arch) are far more efficient than the Windows install process.

As others have said, the option of "rolling your own" is there--but you might NEVER need to use it.
 
  


Reply

Tags
compile, install


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile madwifi, ... compile error , how can i do. ERBRMN Linux - Networking 3 03-08-2006 07:56 PM
Why doesn't it ever compile? Murdock1979 Linux - Software 11 01-11-2006 12:55 PM
compile .c p4inkill4 Linux - Newbie 4 10-28-2005 03:26 PM
ntop compile/post-compile problem? tjb Linux - Software 3 12-28-2004 04:22 PM
why won't this compile blackzone Programming 1 09-17-2004 04:51 AM


All times are GMT -5. The time now is 04:41 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration