How to speed up compilation with Pacman

Hi, this time I bring you a little tip (that many probably already know), but that several people who usually use distros based on Pacman they probably don't know, and for worse: are using a single kernel to compile.

I highly recommend read the "Considerations for compilation" before compiling crazy and silly

Let's do it…

Know our number of processors

First we are going to see how many processors we have available (the most experts do not be scared, there are obviously differences between threads and physical processors, but makepkg uses the execution threads as parameters), for that we execute:

lscpu | grep '^ CPU (s):'

In my case it returns:

[x11tete11x @ Jarvis ~] $ lscpu | grep '^ CPU (s):' CPU (s): 8 [x11tete11x @ Jarvis ~] $

This is because in the case of processors Intel with HyperThreading it also shows the threads of execution.

Edit the /etc/makepkg.conf File

We edit the file /etc/makepkg.conf to tell makepkg to use all available processors; In terms of this, according to the wiki Gentoo, the amount of "jobs" to be carried out comes from the following account:

Number of processors + HT (HiperThreading in case of Intel supported) + 1

We edit:

sudo nano /etc/makepkg.conf

and we modify the line MAKEFLAGS (uncommenting ) with the corresponding value, in my case it would look like this:

MAKEFLAGS = "- j9"

We save the changes and voila, we can now compile our packages using various cores within any of our distros based on Pacman

Next I am attaching a video in which you can see how «simplescreenrecorder» is compiled in each case, with the MAKEFLAGS (MAKEFLAGS = »- j9 ″), and without the MAKEFLAGS(#MAKEFLAGS = »- j9 ″):


27 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Yoyo said

    Uncle this is, as we say in my town «the dick in vinegar» I mean, very good 😛

    I have a 4 cores, I get 4, I guess I'll have to put a 5 right?

    By the way, correct makekpg.conf, that if you will not drive copy / pastero crazy, it is makepkg.conf

    Pacman rules !!!! 😛

    1.    x11tete11x said

      I just saw the little mistake xD, I already sent the boys to correct it xD
      effectively, in your case it would be 5 xD.

      I knew you were going to like this article xD hahaha

      1.    Manual of the Source said

        Corrected. 🙂

        1.    Manual of the Source said

          My user agent betrays me, now I'm in Arch ...

          All for using the same Firefox profile on both distros. 😛

      2.    roader said

        I take this opportunity to comment that if you use BFS (if you don't know what it is then you don't use it) the maximum performance is achieved with the number of cores as is, without adding anything.

      3.    ShutdownN said

        And if he throws me that I have "2" I put 3 right?

      4.    x11tete11x said

        Exact @ShutdowN

      5.    Azureus said

        I fucking love you, I did it when you got the article, now I'm using it because I didn't know how to compile hahaha.
        It's nice because conky tells me that all 4 threads on my i3 are 100% and when I edited it I think I had only one thread configured. I love this, I'm compiling my own kernel right now, let's see how it works: v

    2.    thalskart said

      I agree with Yoyo, although in my town it is not said, it is «the dick in vinegar» !! As soon as I get home I try it.

      1.    chub said

        What do you taste when you get home ... the dick? hahaha
        You made me laugh …
        abrazo

  2.   Yoyo said

    I knew there were 5 because I said in this post about how to compile the Kernel for Debian by hand hahaha

    http://yoyo308.com/2013/11/22/como-compilar-e-instalar-el-ultimo-kernel-3-12-1-en-crunchbang-waldorf-debian-wheezy/

    1.    x11tete11x said

      damn car spamero xD hahaha

      1.    Manual of the Source said

        Don't worry, I already have it in my banhammer's sights, muahahahaha.

      2.    dwarf said

        "My banhammer", don't make me punch you too to get your fumes down <3

        1.    Manual of the Source said

          Get out of here, radish head, keep working or I'll get the stick.

      3.    elav said

        Hahaha .. oh my, I love this Community.

  3.   roader said

    Ccache is also very useful, but that requires a previous compilation to speed up the compilation.

    1.    thalskart said

      I did not understand, do you compile to speed up the compilation?

      1.    roader said

        ccache is a tool (widely used by gentoo users) that allows saving intermediate files from the compilation of an archive, resulting in the next compilation of that executable much, much faster. Also useful for application developers and for people who constantly build and update their own kernel.

      2.    yukiteru said

        ccache is a compilation cache, when you activate it the first compilation you make lasts as long as it should (if it is Java, Firefox and LibreOffice together you ensure a few hours of compilation if your hardware is not very powerful), but the second compilation of the same software (the same version, with some changes in its compilation options or patches) will be much faster because the ccache verifies that many of what is compiled is ready and it reduces compilation time. However, sometimes it gives problems (not because of something in the Gentoo Wiki they put the warning) and in the FirefoxOS list they also do it, so if you are going to cache do it with the same version, if you go to another, clear the cache and start again.

      3.    thalskart said

        Thank you both for the information, I did not know

  4.   Eduardo said

    I've been in Arch for a year and a half and I had never heard of this tip, thank you.

  5.   hjoaco said

    being poor sucks!
    hahahahahahaha

  6.   userarch said

    Thank you. this data is very good

  7.   Luis square said

    I have a question…

    I've been using this option for a while (the number that he threw me was 4 so it remains #MAKEFLAGS = »- j5 ″)

    but I notice that when I update some programs, the CPU goes to 100% and it is difficult to use other programs while this happens ...

    can i do something in between ?? for example, put a #MAKEFLAGS = »- j3 ″ ???? or is it something that is on or off without a middle ground?

    greetings.

    1.    x11tete11x said

      Luis, yes, you can put -j3 without problems, what this parameter does is define in how many «threads» (to not go into detail, let's say that the threads are in how many «parallel portions» you are going to process what you are going to do) will be used for this process

  8.   Anonymous said

    perfect, now I put it. Thanks old!