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.

  • @jbrains@sh.itjust.works
    link
    fedilink
    192 months ago

    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.

    • foremanguyOP
      link
      fedilink
      52 months ago

      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?