Make Update Manager Compile Multi-Threaded


#1

Hello Community…

I notice when the Update Manager has to compile updates, it does so with a single CPU thread/core. Anyone have an idea on how to make Update Manager do this with multiple threads? It’s slow as heck and I have 24 threads at my disposal!

Are there any down-sides to multi-threaded software compiling?

Any input is appreciated!!!


#2

I think it uses makepkg under the hood for this. Edit /etc/makepkg.conf and add

  -j4

To MAKEFLAGS. Replace 4 with number of threads you want to use. This is safe option, because packages that have problems with this can override this setting.


#3

See also https://wiki.archlinux.org/index.php/makepkg#Improving_compile_times


#4

Thanks. Chrysostomus you are “The Man”!!!


#5

it happens to me also but I dont have that directory. the terminal says that theres no such directory


#6

What directory? /etc/makepkg.conf is a text file. If you don’t have /etc/, it is unlikely that you are running linux.

Maybe you accidentally mistyped /etc/makepkg.conf/ instead of /etc/makepkg.conf?


#7

@Chrysostomu then how can I edit it there? and where should I put the
-j4
sorry am really a newbie here


#8

Instead of -j4, you can do -j$(nproc), which should select the correct number of logical cores.

Insert after: MAKEFLAGS=

Some rare software doesn’t always respect makeflags. I think Firefox is one of these.


#9

If you want to keep a backup of the file, enter in a terminal cp /etc/makepkg.conf ~/makepkg.conf.back. This will create a copy with the name makepkg.conf.back in your home directory.

To edit the file, you need a an editor with superuser rights. The easiest way of getting this is to enter in a terminal the command sudo nano /etc/makepkg.conf, which allows you the edit the file in the terminal. If you want a graphical editor, just replace nano with the editor of your preference, since I am a KDE user, I replace it with kate.

The -j4 is added by replacing MAKEFLAGS="" by MAKEFLAGS="-j4". For me, the line was commented out by a #, which you have to delete for the command to take effect.


#10

thx for the hint. This should be the default setting though!?


#11

To be honest, I’ve never tried that setting, so I don’t know if it works :slight_smile: maybe someone can report back.


#12

in my case the compiling of the aur packages goes much faster with four cores.


#13

For me, difference can be something like 20 minutes vs 90 minutes


#14

The more cores you have, the higher the difference :slight_smile:
Can somebody check if -j$(nproc) works? It should:
https://linux.die.net/man/1/nproc


#15

According to arch wiki it should


#16

Wow did that ever improve things :grinning:

I used the -j$(nproc) and also added some threads for the compression by changing a line further down in the config file to COMPRESSXZ=(xz -c -z - --threads=4)

Works good thanks everyone, I wish I would have known this before upgrading qtwebkit yesterday.


#17

You should also check ccache if you often build same packages.


#18

Yes it works! :slight_smile:


#19

Yes, ccache helps with very large projects like AOSP or Firefox. It’s also very easy to use. But as you said, only useful if you recompile the same thing over and over again.


#20

Thank you so much for the help!
Now my Manjaro doesn’t too much of my CPU cause of it. Thank you so much again.