Question

I recently had a bug in a gentoo linux package: The code did not compile properly if it was compiled in several threads. Often people report problems with compilation in parallel make jobs in gentoo, where all programs were build from source.

This lead me to the question, if it is true in general, that the compiler should create the same binaries when compiling with a different number of threads? (like MAKEOPTS="-j1" or MAKEOPTS="-j9")

If the binaries may differ, will the optimization effort (-O2) be the same?

Was it helpful?

Solution

  1. Compilers are not multi-threaded.
  2. Compilers are deterministic. The same compiler run on the same source code with the same options should produce identical object code apart from timestamps.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top