Bug #55721 AIX 5.1.50 build failing, cannot locate bzero
Submitted: 3 Aug 2010 21:14 Modified: 21 Sep 2011 1:58
Reporter: Karen Langford Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.50 OS:IBM AIX (5.3)
Assigned to: Davi Arnaut CPU Architecture:Any
Tags: AIX, bzero

[3 Aug 2010 21:14] Karen Langford
Description:
The aix build is failing on calls to bzero made in mysql.cc. 
Note 5.1.49 build worked fine, and the build host has not changed recently.

This error may have been caused by the fix to bug#53445

log output:
source='mysql.cc' object='mysql.o' libtool=no \
DEPDIR=.deps depmode=aix /bin/sh ../depcomp \
xlC_r -DMYSQL_CLIENT_NO_THREADS -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\"" -DMYSQL_DATADIR="\"/usr/local/mysql/data\"" -I. -I../include -I../include -I../include -I../regex     -g  -DSAFE_MUTEX -g  -ma -qstrict -qoptimize=0 -qmaxmem=8192   -c -o mysql.o mysql.cc
"/usr/include/alloca.h", line 34.9: 1540-1401 (I) An unknown "pragma __alloca" is specified.
"mysql.cc", line 1149.3: 1540-0274 (S) The name lookup for "bzero" did not find a declaration.
"mysql.cc", line 3959.3: 1540-0274 (S) The name lookup for "bzero" did not find a declaration.
"mysql.cc", line 4094.3: 1540-0274 (S) The name lookup for "bzero" did not find a declaration.
gmake[2]: *** [mysql.o] Error 1
r 5.1.50 is failing

How to repeat:
Build 5.1.50 on aix53.mysql.com
[3 Aug 2010 21:33] Joerg Bruehe
The original code, still used (and working) in 5.1.49, looks like a dirty hack, seems the author wanted to use standard function names but then redefine them to an (assumed ?) faster implementation.

After a recent cleanup, the prototype is missing.

Sadly, we do not have PB2 coverage for AIX, that's why this bug is detected only during build.
[3 Aug 2010 22:05] Davi Arnaut
The prototype would be wrong in this case, as strings/bzero.c was never built. It must have been the changes below:

-#ifdef _AIX
-#undef HAVE_BCMP
-#endif

-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n)		memcpy((d), (s), (n))
-# define bcmp(A,B,C)		memcmp((A),(B),(C))
-# define bzero(A,B)		memset((A),0,(B))
-# define bmove_align(A,B,C)     memcpy((A),(B),(C))
 #endif

and the check left is:

#if !defined(bzero) && !defined(HAVE_BZERO)
# define bzero(A,B)             memset((A),0,(B))
#endif

So, somehow AIX has bzero but its not in strings.h?
[3 Aug 2010 22:09] Davi Arnaut
To get the build going, remove the #if condition around bzero so it will be mapped to memset.
[3 Aug 2010 22:22] Davi Arnaut
Hum, it only exports the prototype if _XOPEN_SOURCE_EXTENDED, yet the autoconf check will work since it does not require a prototype. I guess it would be better to just unconditionally map bzero to memset, and get rid of bzero entirely in trunk.
[4 Aug 2010 1:28] Karen Langford
I created a patch to update include/m_strings.h and remove the #ifdef stmt around the line:

# define bzero(A,B)             memset((A),0,(B))

I am currently doing a test build on aix 32 for Community and so far so good.

BTW the i5os platform is also failing with this bug, so I'm testing with the above patch.

Will update you tomorrow on whether builds on both these platforms succeed.
[9 Aug 2010 16:04] Karen Langford
Both aix and i5os builds ran successfully with patch.
[21 Sep 2011 1:58] Paul DuBois
Noted in 5.1.58 changelog.

Compilation failed on AIX due to a missing bzero() prototype.