Bug #66811 Build fails on OSX 10.8 due to non-UTF8 characters and sed
Submitted: 13 Sep 2012 17:07 Modified: 24 Apr 2018 11:55
Reporter: Paul Price Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.65 OS:MacOS (>= 10.8)
Assigned to: CPU Architecture:Any
Tags: sed UTF8

[13 Sep 2012 17:07] Paul Price
Description:
Multiple sed commands in the build on Mac OSX 10.8 (but not 10.7) fail with the error "sed: RE error: illegal byte sequence".  We've traced this to the use of non-UTF8 characters in at least two files (server-cfg.sh and crash-me.sh).  The workaround is to set LANG=C when building.

Further information is available in the LSST ticket: http://dev.lsstcorp.org/trac/ticket/2318

How to repeat:
On Mac OSX 10.8:

./configure --prefix=/usr/lsst/DarwinX86/external/mysqlclient/5.1.50+1 --without-server --enable-thread-safe-client --enable-local-infile
make

Ends with:

sed: RE error: illegal byte sequence
make[1]: *** [server-cfg] Error 1
make[1]: *** Waiting for unfinished jobs....
/bin/chmod +x innotest2-t
/bin/chmod +x innotest2a-t
sed: RE error: illegal byte sequence
make[1]: *** [crash-me] Error 1
/bin/mv innotest2-t innotest2
/bin/mv innotest2a-t innotest2a
make: *** [all-recursive] Error 1

(The "innotest*" are a red herring, due to running a parallel make.)

Suggested fix:
Either edit the two identified files to remove non-UTF8 characters (for server-cfg.sh, this is in a comment; for crash-me.sh, this is in executed code), or changing the Makefile to use "LANG=C sed" instead of plain "sed".
[13 Sep 2012 17:13] Paul Price
P.S.  This could turn out to be a Mac bug in sed rather than MySQL, but it would be useful if the workaround could be applied regardless, as it would make the build more robust.
[13 Sep 2012 17:46] Sveta Smirnova
Thank you for the report.

Which version of sed do you have?
[13 Sep 2012 18:02] Paul Price
Regrettably, sed doesn't seem to accept a "--version" argument, and I've not been able to discover the version.  From googling, it seems that this is a common problem due to the OSX 10.8 version of sed being strict, with the same simple fix reported here.

http://www.openwall.com/lists/john-dev/2012/08/18/18
https://trac.macports.org/ticket/35462
https://trac.macports.org/ticket/35536
https://github.com/diaspora/diaspora/pull/3481
[20 Feb 2013 18:52] Sveta Smirnova
Thank you for the feedback.

Please try with current version 5.1.68 and inform us if problem still exists.

Anyway workaround is to use GNU sed.
[8 Mar 2013 21:23] Paul Price
User reports no change in behaviour (fails with LANG=en_US.UTF-8, but works if LANG explicitly set to 'C').

https://dev.lsstcorp.org/trac/ticket/2318
[12 Mar 2013 16:31] MySQL Verification Team
I am not able to repeat this bug.

My Mac version is "Mac OS X 10.6.8", while it's kernel version is reported as " Darwin 10.8.0" !!!!

`sed` that I use is FreeBSD license, hence it is not GNU version. MySQL that I used is 5.1.68.

I used the exact configure as in the bug and make works perfectly OK, without a single warning or error.

So, please let us know if Mac version or kernel version should be different.
[12 Mar 2013 17:12] Paul Price
Yes, this appears to work on Mac versions < 10.8, but is broken for 10.8.
[12 Mar 2013 18:48] MySQL Verification Team
Verified. Changing only LANG does not help in all cases, changing also LC_CTYPE to C solves the problem, so this works 

EXPORT LANG=C
EXPORT LC_CTYPE=C
make
[24 Apr 2018 11:55] Yngve Svendsen
Posted by developer:
 
Obsolete OS/MySQL version.