Page 1 of 1

wx compilation freezes ubuntu

Posted: Wed Sep 19, 2018 11:22 pm
by tigerbeard
I have to say I am new to Linux, so please bear with me.

I am trying to compile wxWidgets from tar.gz with configure/make -j to use my 4 cores. The problem is that my machine freezes after a few seconds.
My memory indicator goes straight up and then the machine is frozen after it reaching 100%. The HDD light remains on. It stays for hours in that state. I waited up to 5hrs. The only resort is hard reset.
I could compile with 'make' instead of 'make -j', but for all version its taking really long.

I tried to check all sorts of stuff but I can not see anything wrong. Everything else works fine.

So I am wondering,
Could Ubuntu run 'make -j' at all without crashing?
If so, what is normally supposed to happen when the memory bar goes up?
Am I missing some parameters that were never quoted because too obvious for experienced users?

I am glad for some feedback

Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 6:29 am
by doublemax
I'm no Linux expert, but to me it sounds like you're running out of memory. How much RAM does the PC have?

Try "make -j2" to use only 2 cores.

Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 9:20 am
by DavidHart

I get this often when building in under-resourced VirtualBox guests. Sometimes the build errors-out after a few minutes with a gcc 'internal error' message; sometimes it crashes the system, which has to be rebooted. It seems to have two reasons:

One possibility is too little swap space. I don't understand why that matters, but I've learned to allocate more, and/or clear swap when it occurs.

More often though, it's ram. I first noticed it when /tmp/ started being mounted on tmpfs; if the guest is given insufficient ram, tmpfs is too small to cope with too much concurrency. The fix is to pass (for me)
export TMPDIR=/home/david/
before building, so the build uses more disc-space and less ram.

It's unlikely to apply to you but, for completeness, the other /tmp/-related cause that I've found is the terminal. I normally use konsole. This allows (or allowed; the setting is missing in the current version) setting unlimited scrollback; useful for seeing where a build failed. However that data was stored in /tmp/ and eventually filled it.



Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 10:41 am
by tigerbeard
@doubelmax. The system got 8GB Ram, and 20GB of swap. I would have thought thats more than suffifient to run a massive compile job. Indeed I could use make -4 (4 cores), but if running make -j without a job number is dangerous, I am surprised that it is never mentioned anywhere in the descriptions. I am worried that I am forgetting a most obvious but crucial thing when compiling in Linux.

@David. Good to know that at least things like that happen to others sometimes. If temp is limited due to a too small own flie system and it is used by make that makes sense. I guess with console/terminal you mean the Ctrl-Alt-F1 vs. terminal in a window on the desktop. So 2 things to try.

Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 10:48 am
by DavidHart
I guess with console/terminal you mean
I mean a gui terminal-emulator like konsole or lxterminal or..., not the raw terminal that you get from Ctrl-Alt-F?.

Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 11:04 am
by tigerbeard

Thanks a lot @DavidHart.

With your tips compilation went through with 'make -j'. I amnot sure what of the 2 things solved it, though.

I put it here again in case I run into the problem again:
[*]open a text only console (Ctrl-Alt-F1)
[*]modiy the TEMPDIR variable with

Code: Select all

mkdir tmp
export /home/tigerbeard/tmp
Then compile it from the wxWidget folder

Code: Select all

mkdir buildgkt
cd buildgkt
../configure --prefix=$PWD --enable-gebug --disable-shared --enable-stl --with-opengl --with-libjpeg --with-libtiff --with-libxpm --with-libmspack
make -j
The system does not freeze, however, logging in into another console, e.g. Cltrl-Alt-F2 takes ages. So this compile process is able to slow down the PC so much for other users so you can not do anything else. Obviously, one can use 'make -j4' to reduce the job numbers used.

Re: wx compilation freezes ubuntu

Posted: Thu Sep 20, 2018 6:37 pm
by tigerbeard
Add on to the last post:

After compiling like that a few times, there is clearly a huge disadvantage on Xubuntu Linux to use the 'make -j' without a job number: The builds take a lot longer than running them without job number

Code: Select all

  make -j      // no job nnumber mean unlimited
  make -j4     // on a 4 core machine >4x faster than above  
It makes sense, because the system is still driven to the edge of memory and the (encryped) home filesystem capabilities. In the background more time is spent with killing tasks and swapping than acutual compilation. Although I am not sure that just my machine has some strange problem, it seems generally a better idea to use a specified job number.