Thank you Andrew and Andrey.
The cpupower utility can be used to set minimum and maximum cpu frequencies and frequency scaling governor.  I use it on my intel and amd laptops. With some governor you can't set frequencies, try to change them.
I hope this helps.
Yes, this helped - laptop was cooler when I used the "powersave" governor and it was OK that the build took longer since I wanted to do other things at the same time.


echo 25 > /sys/devices/system/cpu/intel_pstate/max_perf_pct

this sets max frequency to 800 mhz instead of 2.5/3.0 ghz as usual.

note that 25 is percentage, and on different core iXXX processors results can be different.
...
I hope this might help Phyllis with her overheating intel laptop .....

Yes, this motivated me to find a solution. I had to use cpupower utility because it was an AMD laptop instead of intel.