I'm trying to learn how to use Linux. What is compiling? I know you have to compile the kernel, but what is compiling itself, exactly?
Five answers:
The Phlebob
2011-05-27 12:05:29 UTC
"Compiling" means taking text-based source code written by the programmers and translating it into hardware instructions the particular machine understands. Before compilers, the programs that do compiling, were developed, programming was extremely difficult, tedious and error-prone. Modern compilers make it possible to produce much more capable code in less time.
Modern GUIs would be impossible without compilers. In fact, almost all modern software could not be produced without compilers.
Hope that helps.
jplatt39
2011-05-27 12:20:58 UTC
You do not HAVE to compile -- or recompile -- the kernel. There are plenty of kernels you can pick up off the internet. But C and C++ were two reasons I picked up Linux in the first place and programmers are a primary audience for Linux. The kernel -- the Linux kernel -- is a program which interfaces between the other programs in the OS and with the machinery you run it on. That's why whatever distribution I use I've been using I've used homebrew kernels for years. There are tutorials out there for recompiling it but if you can't write and compile your own (however simple) programs I do NOT recommend it it all. It is just too easy to make your computer unusable.
?
2016-10-17 08:37:24 UTC
Compiling Means
Dovregubben
2011-05-27 12:13:23 UTC
compiling is the process of taking the source code that is readable by us and converting it into machine code that the computer can understand.
For example here is a simple C program.
//hello.c
#include
void main()
{
printf("Hello World");
}
This code when ran would display Hello World
The computer does not understand this code. It would have to be compiled before it can be executed.
One compiler that comes with linux is gcc
to compile this program, run this in your command line
gcc hello.c -o hello
hello.c is the program, the -o says output this file, and hello is the output file
After comping, you would need to chmod the compiled program to make it executable
chmod 755 hello
the 755 refer to the permissions given to the owner, group, and all users.
for a complete explanation check out the man page for chmod
INS0MNI4C
2011-05-27 12:02:04 UTC
In short: You have a Source-Code and you make it into a Program (for Example, you just "make" it)
Hope that answered your Question.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.