Bug #16282 Parallel 'make -j' builds fail
Submitted: 8 Jan 2006 6:42 Modified: 4 Oct 2006 2:50
Reporter: Kristian Nielsen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1, 5.0, 5.1 OS:Solaris (Solaris 10 sparc)
Assigned to: Kristian Nielsen CPU Architecture:Any

[8 Jan 2006 6:42] Kristian Nielsen
Description:
On Solaris 10 SPARC, with the Sun compiler, parallel builds (make -j4) often fail with the error:

    cg error (as) : write error on output file "gcc.o" : No such file or directory

The reason is this line in ndb/config/common.mk.am, which puts a .cpp file on the linker command line:

    LDADD = $(top_srcdir)/storage/ndb/src/common/portlib/gcc.cpp $(LDADD_LOC)

So if two linker commands run in parallel, they both try to write the file gcc.o simultaneously, causing a conflict. Apparently the GNU linker tolerates this, while the Sun linker gets the above error.

The problem is a bit silly since the file gcc.cpp no longer serves any purpose, it has no meaningfull content:

    #if 0
    extern "C" { int __cxa_pure_virtual() { return 0;} }
    #endif

This happened in this changeset:

ChangeSet
  1.1773.251.1 05/05/04 13:29:15 joreland@mysql.com +2 -0
  bug#10330 - linking with ndb fails
    changes to handling of new/delete cxa_pure_virtual has changed in mysys
    remove "ndb"'s own impl. as they are no longer needed as we link mysys at all places

  ndb/src/common/util/new.cpp
    1.6.1.1 05/05/04 13:29:12 joreland@mysql.com +1 -1
    remove "ndb" new/delete

  ndb/src/common/portlib/gcc.cpp
    1.2.1.1 05/05/04 13:29:12 joreland@mysql.com +1 -1
    remove ndb __cxa_pure_virtual

How to repeat:
make -j4 on Solaris 10 SPARC, using the Sun compiler

Suggested fix:
I suggest simply removing the file gcc.cpp. I will commit this change for review.
[8 Jan 2006 6:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/748
[11 Jan 2006 13:11] Kristian Nielsen
Fix pushed for 5.0.16 and 5.1.6-alpha.

For documentation: This fixes a problem seen on Solaris (with the Solaris compiler), where parallel make (make -j4) would fail.
[13 Jan 2006 0:37] Mike Hillyer
Added to 5.0.19 and 5.1.6 changelogs:

      <listitem>
        <para>
          Parallel builds occasionally failed on Solaris. (Bug #16282)
        </para>
      </listitem>
[11 Sep 2006 14:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/11695

ChangeSet@1.2535, 2006-09-11 16:49:44+02:00, knielsen@ymer.(none) +4 -0
  BUG#16282
  
  Build gcc.o as a small library, instead of passing .cpp sources to the
  linker command (causes problems with parallel make on Solaris).
  
  This fix is for 4.1. In 5.0 and up a different fix is used.
[12 Sep 2006 7:49] Kristian Nielsen
This bug also affects 4.1, but a different fix is needed than in 5.0 and 5.1.

I have committed a new 4.1 patch for review.
[21 Sep 2006 19:48] Kristian Nielsen
Pushed to mysql-4.1-maint.
Null-merged to mysql-5.0-maint.
[3 Oct 2006 20:03] Chad MILLER
Available in 5.0.26.
[3 Oct 2006 20:10] Chad MILLER
Available in 5.1.12-beta.
[3 Oct 2006 21:37] Kristian Nielsen
For documentation: just to clarify, this bug was already fixed in 5.0 and 5.1 some time ago. There is a different fix for 4.1, this fix was null-merged to 5.0 and 5.1, but the new changelog entry should only be for 4.1 I believe.
[4 Oct 2006 2:50] Paul Dubois
Noted in 4.1.22 changelog.

Parallel builds occasionally failed on Solaris.
[4 Oct 2006 13:57] Chad MILLER
Available in 4.1.22.