this post was submitted on 17 Apr 2024
47 points (87.3% liked)

Linux

48193 readers
1897 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hello, I'm a bit new to advanced linux and programming stuffs... Can someone explain me why compiling exists and what this process does and how to do it in the principals situations (I've heard that you can use the "makepkg" command). Thx to everyone who replied.

you are viewing a single comment's thread
view the rest of the comments
[–] jbrains@sh.itjust.works 18 points 7 months ago (1 children)

Computers don't directly understand the code that humans write. Humans find it extremely difficult to directly write the code that computers understand.

Compiling is how we convert the code that humans write into the code that computers can run. (It's more complicated than that, but that explanation is probably enough for now.)

Different computers understand different flavors of computer code. Each kind of computer can compile the same human code, but they produce the flavor of computer code specific to that kind of computer. That's why you sometimes need to compile the human code on your computer: it's easier for your computer to know how to compile human code than for a human to know how to compile human code for every kind of computer that exists now and might exist in the future. There are some common kinds of computer and many projects pre-compile human code so that you don't have to, but that's not always easy. Also, some people insist on compiling the code themself, rather than trust someone else to correctly compile the code for their computer.

As for how to compile, that can be complicated. When you find the human code ("source code") for a software project, the README often gives you instructions for how to compile that project's code. Many of the instructions look familiar, because they are similar between projects, but the detail can vary a lot from project to project. Moreover, different human programming languages have very different instructions for how to compile their flavor of human code into computer code.

[–] foremanguy92_@lemmy.ml 4 points 7 months ago (2 children)

ooh ok, so I've always aked myself "what is for the source code?". If I've understand, it's all the code writes in C, C++, Rust, etc. And then if you want to use the programm you just have to compile the source code. It's useful for the developer to do not have to compile for every OS. Is that right?

[–] EinfachUnersetzlich@lemm.ee 5 points 7 months ago

Yes, but for developers it's good to not have to program for each CPU architecture/OS.

I can write some C, C++ or Rust code and compile it for loads of platforms and have it do the same thing (simplified).