Bug #37808 "make_binary_distribution" does not always generate correct names
Submitted: 2 Jul 2008 15:07 Modified: 10 Aug 2009 22:39
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.0 and up OS:Mac OS X (10.5 x86 + x86_64)
Assigned to: Joerg Bruehe
Triage: Triaged: D4 (Minor) / R2 (Low) / E2 (Low)

[2 Jul 2008 15:07] Joerg Bruehe
Description:
Found in the 5.1.26 build:

If "make_binary_distribution" is not called using "--platform"
on OS X 10.5 (x86 + x86_64),
it will call the CPU "i686" for both builds.

1) This deviates from our platform designations.

2) This causes overwrites - the last (slower) one wins.

But this script should work without the "--platform" parameter if possible,
so as to reduce complexity and make it self-contained.

How to repeat:
Just try it ...

Suggested fix:
For now, we use "--platform", so (current and future) builds do work.

In the long run, find a better value than "MACHINE_TYPE" to use.

"CFLAGS" should be the ideal thing:
1) it is available already,
2) it is using to generate the binaries,
   so its value is guaranteed to match the binaries,
3) a "case" statement on "CFLAGS" contents would match
   all machines using the same compiler.

We *must* start this at 5.0,
because once this is established we will drop the "--platform" setting in the tools (which are identical for all versions).
[9 Jun 2009 11:08] Joerg Bruehe
I'm working on a patch to "make_binary_distribution.sh"
which will analyze CFLAGS and use it to override the "machine" setting.

The more general approach would be to do that directly in "configure.in",
to override the (inexact) "uname" result from the very beginning.

Whatever we do, it must be aligned with the change in our tools
(drop the explicit "--platform" setting),
so it should be done for all active versions (5.0 and up).
[24 Jun 2009 19:29] Joerg Bruehe
First approach did not work,
it seems the shell does not really accept a multi-word string as the variable in a "case" statement.

Improved the approach to extract the "-arch XYZ" argument from CFLAGS and use this single word. First tests look promising.
[26 Jun 2009 9:59] 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/77300

2776 Joerg Bruehe	2009-06-26
      This is a fix for bug#37808
         "make_binary_distribution" does not always generate correct names
      
      Originally, we solved deficiencies of the predefined "autoconf" macros
      (at least on OS X 10.5, they do not correctly differ between "x86" and
      "x86_64") by providing explicit "--platform" arguments.
      
      With this patch, "make_binary_distribution" evaluates CFLAGS, so it
      "just works" because CFLAGS contains information about the target CPU.
      
      This patch is accompanied by a change in our build tools that drops the
      setting of "--platform" arguments.
     @ scripts/make_binary_distribution.sh
        This is a fix for bug#37808
           "make_binary_distribution" does not always generate correct names
        
        Our platform names are the combination of operating system, architecture (CPU),
        and a possible suffix (typically "64bit", if a CPU is available in 32 bit too).
        We get these values from some predefined "autoconf" macros.
        
        However, these macros are not perfect, especially on OS X 10.5 they do not
        differ correctly between x86 (32 bit) and x86_64 (64 bit).
        Originally, we solved that by providing an explicit "--platform" argument,
        but it is better to get rid of that and ensure the script "just works".
        
        The best indication we have about the CPU is the "CFLAGS" value provided
        with "configure" and used in "make": It describes for which CPU the
        binaries are generated, not just which one was running the build.
        This approach should work even if we implement cross-compilation.
        
        So this patch evaluates CFLAGS and extracts its "-arch XYZ" part.
        
        When touching the file, I also replaced some tab characters by blanks.
[21 Jul 2009 16:51] 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/79115

2959 Joerg Bruehe	2009-07-21 [merge]
      Merge the fix for bug#37808 into 5.1-build.
[21 Jul 2009 19:04] Joerg Bruehe
Thge patch is queued in 5.0-build, 5.1-build, and azalea-bugfixing (for 5.4).
[23 Jul 2009 10:24] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090723102221-ps4uaphwbxzj8p0q) (version source revid:joerg@mysql.com-20090721143504-4xo4lztuoyn1f88m) (merge vers: 5.4.4-alpha) (pib:11)
[4 Aug 2009 13:31] Bugs System
Pushed into 5.0.85 (revid:joerg@mysql.com-20090730150354-h0c0cob2212sjs30) (version source revid:joerg@mysql.com-20090721173728-wkvs1dno8z250khh) (merge vers: 5.0.85) (pib:11)
[4 Aug 2009 13:32] Bugs System
Pushed into 5.1.38 (revid:joerg@mysql.com-20090730152409-ko4up2l6jceuszgf) (version source revid:joerg@mysql.com-20090721164942-ms7fzkl162nmpu4m) (merge vers: 5.1.38) (pib:11)
[10 Aug 2009 22:39] Paul Dubois
Noted in 5.0.85, 5.1.38, 5.4.4 changelogs.

make_binary_distribution did not always generate correct distribution
names.
[24 Aug 2009 13:53] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090824135126-2rngffvth14a8bpj) (version source revid:joerg@mysql.com-20090805185305-g7obi1157h314xk1) (merge vers: 5.4.4-alpha) (pib:11)
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[8 Oct 2009 20:13] Paul Dubois
The 5.4 fix has been pushed to 5.4.2.