Click to See Complete Forum and Search --> : what do you mean by compile?


robenco
12-21-2003, 08:43 PM
I have been reading a bunch of post and i keep hearing about compile. i think it means put the files altogether and it makes the program and then u can run it right? also I read that it took a guy 4 days to compile mandrake 9.2 linux. Will it take me that long for me too? i mean it takes long enough to download the 3 cd's but then 4 days to compile it that's crazy! help me out here.

Homer119
12-21-2003, 08:55 PM
there is no need to compile a whole OS. when you download the cds and burn them u just need to install and it takes 45 min tops. compile is when u download a program and piece it together, it can take anywhere from 5 seconds and longer, for a normal sized program no more then 2 minutes. the compile command is simple

./compile
make install
make


and ur done, but id worry about getting linux installed first.

ps. usually people get freaked out by linux AFTER they install it....

juicelooser
12-21-2003, 09:34 PM
Originally posted by Homer119

./compile
make install
make

?

isn't it

$ ./configure
$ make
# make install

?

quip
12-21-2003, 09:42 PM
Originally posted by juicelooser
?

isn't it

$ ./configure
$ make
# make install

?
Yes, it is. And to compile just means to build the program from its source code. To do it, you need a compiler, usually gcc on linux. It is usually installed by default.
Much of the software developed for linux is distributed in this fashion. Firstly, it makes for a lot faster download and uses less bandwidth, as source code is just a text file. Secondly, it can fit itself to your system, which means it runs more efficiently and tells you if you need other software or hardware for it to run correctly. The result is a tailor-made program to your box.
There is no need to compile a whole OS in linux as they are readily avaliable already compiled (iso disk images) You can re-compile the kernel later if you want.
To compile just go to the directory (in the command line) that has the source code. Type the 3 commands listed above and you will be fine.

robenco
12-21-2003, 09:47 PM
wats a soucr code?? thanks for ur help and when i do download it does linux become like a program i have to select to use in XP or do i restart my laptop and then it gives me an option of wat OS i want to run?

Matatas
12-21-2003, 10:11 PM
A Linux distro is like any other OS (well, not quite). When you start you´re PC a menu will pop up asking you wich OS do you want to run.

templest
12-22-2003, 12:34 PM
wats a sourcecode?

Have you ever herd of a little something called C++? or Java? or about the occational Delphi & Perl? These are programming languages... You write a program with the language... and a compiler makes it a pretty-packaged linux binary. In the Windows world that would be an executable file or a ".EXE".

note before you ask: compiler is the program that "compiles" the code. Once you install the Distro (linux version) you'll have these installed. don't worry about that. The most common way to compile source-code (what the programmer wrote) is what was stated here:

./compile
make
make install

sometimes though, programs need their own way of compiling and these secifications would be stated in a README file of some sort. (or INSTALL).

Note... Each Binary isn't for every distribution. ie: something compiled with Mandrake might not run on Slackware. (different Linux Distro's). Or something compiled with Slackware might not run on another computer running slakcware that doesn't have dependancies (files required by a program for it to run properly). That's why it's recommended to compile stuff from source if you know how. It'll be compiled (built) to run specifically on your computer.

Last note: Ever herd of a so called "Open-Source Revolution"? or "Open-Source Movement"? Think of big project programs (of even a linux Operating System) being completely Open-Sourced where everyone can see that code that the programmer wrote. Everyone that wants to can work on it and expand on it, or make it work better. Any Oepn-Source program will get better, faster, and more stable/ reliable because everyone is working on it. Not just a select few. ;)

Hope a cleared up something. :) That's linux Compiling / Source-Code 101 for ya. :D :cool:

lagdawg
12-22-2003, 01:20 PM
There have been lots of questions about "What is compiling?" or "What is source code?". Most answers tell them what results from compiling source code, but not actually what compiling does or why it is really needed. Here is a basic rundown of compiling and other terms encountered.

Source Code
When you write a program you are giving the computer commands about how to run. These commands are written on different languages (C, C++, Perl, Python, Java, Lisp, Scheme). These commands are called the source code.

Machine Code
In order for the computer to be able to use these commands they have to be changed from the language they are written in, to a language that the computer can understand. This is called machine code.

Compiling
The process of changing source code into machine code is called compiling or building. In order to do this you have to have a compiler which is specifically designed for the language your source code is written in such as GCC for C and C++.

Binary Files
Binary files are machine code which someone has compiled on a certain system and distributed. These files can be run alot like .exe's are run on windows machines. These files don't need to be compiled because they have already been compiled by someone else. However, this code is based on the system on which the source code was compiled and may not work on your system due to conflicts. So in order to use a binary file it must be compatible with your system (hardware, software, linux distro, etc.) In order to completely avoid compatibility problems with binary files you can take the source code for a program and compile it on your own system.

templest
12-22-2003, 04:41 PM
Most answers tell them what results from compiling source code, but not actually what compiling does or why it is really needed

I think my post states quite clearly the benefits of compiling source-code thank you very much. :P

lagdawg
12-23-2003, 09:11 AM
Originally posted by templest
I think my post states quite clearly the benefits of compiling source-code thank you very much. :P

You are absolutely correct, that's why I used your ideas in describing the benefits. I have just seen alot of posts trying to explain what compliling is or what source code is but some people still don't really understand it. I wanted to help those who do not come from a programming background understand exactly why we have source code and compilers and binaries and sources. This way someone can look at one post and hopefully understand it rather than having to wade through many posts trying to answer their questions. I tried to give the most simplistic description I could.