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.

  • f00f/eris@startrek.website
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    7 months ago

    Open-source software is distributed primarily as source code in a human-readable programming language. Computers can’t actually read these programming languages directly; they need to be translated into the machine language of their CPU (such as x86_64). For some languages, like Python, code can be “interpreted” on the fly; for others, like C, programs must be “compiled” into a separate file format. Additionally, most programs consist of multiple files that need to be compiled and linked together, and installed in certain folders on your system, so the compiler and additional tools work to automate that process.

    Most users of Linux rarely if ever have to compile anything, because the developers of Linux distros, and some third parties like Flathub, curate collections of (mostly) open-source software that has already been compiled and packaged into formats that are easy to install and uninstall. As part of this process, they usually add some metadata and/or scripts that can automate compiling and packaging, so it only requires a single command (makepkg on Arch, dpkg-buildpackage on Debian.) However, some newer or more obscure software may not be packaged by your distribution or any third-party repo.

    How to compile depends on the program, its programming language and what tools the developers prefer to use to compile it. Usually the README file included with source code explains how to compile the software. The most common process uses the commands ./configure; make; sudo make install after installing all of the program’s dependencies and cd-ing to the source code directory. Other programs might include the metadata needed for something like makepkg to work, be written in an interpreted language and thus require no compilation, or use a different toolchain, like CMake.