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 |
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 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. |
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 |
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 |
Quote:
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. |
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.
|
Hi,
Quote:
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:
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:
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... |
Quote:
|
Why compile?
Because we can! :D Edit: Dammit. Beaten to the punch again. |
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. |
Quote:
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. |
All times are GMT -5. The time now is 10:49 AM. |