Note for English Readers

If I write the articles in Indonesian, I will write a summary in English so that you can read my articles too. After you read the summary and you feel that you need more information about that, please do not hesitate to contact me via e-mail that can be found in my profile.

Thank you for reading my blogs.

Tuesday, April 10, 2012

Beware when compiling using -jN option

When I compiled lilypond-2.15.36, I found this error:
cat out/feta-braces-a.otf-table out/feta-braces-b.otf-table out/feta-braces-c.otf-table out/feta-braces-d.otf-table out/feta-braces-e.otf-table out/feta-braces-f.otf-table out/feta-braces-g.otf-table out/feta-braces-h.otf-table out/feta-braces-i.otf-table > out/emmentaler-brace.otf-table
echo '(design_size . 20)' > out/emmentaler-brace.otf-gtable
echo feta-braces-d feta-braces-c feta-braces-i feta-braces-e feta-braces-h feta-braces-a feta-braces-g feta-braces-f feta-braces-b > out/emmentaler-brace.subfonts
printf 'emmentaler-brace' > out/emmentaler-brace.fontname
cd ./out && /usr/bin/fontforge -script emmentaler-11.pe
Copyright (c) 2000-2011 by George Williams.
 Executable based on sources from 13:48 GMT 22-Feb-2011-ML-TtfDb.
 Library based on sources from 13:48 GMT 22-Feb-2011.
Cannot open /usr/local/src/Music/lilypond-2.15.36/build/mf/out/feta11.pfb
The requested file, feta11.pfb, does not exist
MergeFonts: Can't find font: feta11.pfb
Called from...
 emmentaler-11.pe: line 17
make[1]: *** [out/emmentaler-11.svg] Error 1
make[1]: *** Waiting for unfinished jobs..... 

This error is caused by the use of -jN option when compiling lilypond (I used this instruction: make -j4 all). I used that option in order to maximize CPU cores utilization, however, this option can lead the compilation process into race condition. In the case of lilypond compilation, feta11.pfb is needed by one of compilation thread/stream before other thread/stream compiles it. When I omitted the -jN option, the compilation was successful.

In conclusion, be careful when we use the -jN option. This option can make the compilation process faster because the compilation process uses more than one CPU core, however, the race condition can occur in some cases.

1 comment:

Richard said...

Hi. I believe I read somewhere that the N option should be one more than the number of (virtual) CPU's in the system. I own an Intel Quad Core system and always specify -j5 as an argument to the compiler, and have yet to have any problems compiling the Linux kernel this way. YMMV.