Bug #46642 Build fails w/ error "mf_iocache.c:1372: structure has no member named `rc_pos'"
Submitted: 11 Aug 2009 1:21 Modified: 25 Jan 2013 11:08
Reporter: Don Davis Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C Severity:S2 (Serious)
Version:6.0.1, 6.0.2 OS:Solaris (OpenSolaris 2009.06 Build 111)
Assigned to: Assigned Account CPU Architecture:Any
Tags: mysql connector build failure

[11 Aug 2009 1:21] Don Davis
Description:
MySQL Connector/C build fails while compiling mf_iocache.c. The compile line and the error message are shown below. GCC compiler was used to compile the source code. Sun Studio C compiler showed similar error message. Probably other platforms may exhibit similar behavior -- but I didn't test.

...
[ 13%] Building C object mysys/CMakeFiles/mysys.dir/mf_iocache.c.o
cd /tmp/mysql-connector-c-6.0.1/mysys && /usr/bin/gcc  -DHAVE_YASSL -DYASSL_PURE_C -DHAVE_OPENSSL -I/tmp/mysql-connector-c-6.0.1/extlib/zlib -I/tmp/mysql-connector-c-6.0.1/include -I/tmp/mysql-connector-c-6.0.1/mysys   -o CMakeFiles/mysys.dir/mf_iocache.c.o   -c /tmp/mysql-connector-c-6.0.1/mysys/mf_iocache.c
/tmp/mysql-connector-c-6.0.1/mysys/mf_iocache.c: In function `_my_b_async_read':
/tmp/mysql-connector-c-6.0.1/mysys/mf_iocache.c:1372: error: structure has no member named `rc_pos'

Additional details:

% gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-20050802)

% cat /etc/release
                         OpenSolaris 2009.06 snv_111b X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                              Assembled 07 May 2009

How to repeat:
Repeat-by:

% cd /tmp
% wget ftp://mirror.anl.gov/pub/mysql/Downloads/Connector-C/mysql-connector-c-6.0.1.tar.gz
% gunzip -c mysql-connector-c-6.0.1.tar.gz | tar -xf - 
% cd mysql-connector-c-6.0.1
% cmake --version
cmake version 2.6-patch 4
% cmake -DCMAKE_INSTALL_PREFIX=/tmp/MySQLconnectorC
% export VERBOSE=1
% make
[11 Aug 2009 4:56] Don Davis
This error is reproducible with version 6.0.2 as well.
[12 Aug 2009 17:50] MySQL Verification Team
Not repeatable on Linux Ubuntu:

Linking C executable mysql_config
cd /tmp/mysql-connector-c-6.0.1/mysql_config && /usr/bin/cmake -E cmake_link_script CMakeFiles/mysql_config.dir/link.txt --verbose=1
/usr/bin/gcc   -Wall   CMakeFiles/mysql_config.dir/mysql_config.c.o  -o mysql_config -rdynamic ../libmysql/libmysqlclient.a -lpthread -lm 
make[2]: Leaving directory `/tmp/mysql-connector-c-6.0.1'
/usr/bin/cmake -E cmake_progress_report /tmp/mysql-connector-c-6.0.1/CMakeFiles  100
[100%] Built target mysql_config
make[1]: Leaving directory `/tmp/mysql-connector-c-6.0.1'
/usr/bin/cmake -E cmake_progress_start /tmp/mysql-connector-c-6.0.1/CMakeFiles 0
miguel@luz:/tmp/mysql-connector-c-6.0.1$ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

miguel@luz:/tmp/mysql-connector-c-6.0.1$ cmake --version
cmake version 2.6-patch 2
miguel@luz:/tmp/mysql-connector-c-6.0.1$
[12 Aug 2009 18:04] Sveta Smirnova
Thank you for the report.

Verified as described on Opensolaris x86. Not repeatable with Solaris 10 on sparc box.
[13 Aug 2009 9:01] Don Davis
>> Not repeatable with Solaris 10 on sparc box.

In fact, I could not reproduce the failure on systems running Solaris 10 (SPARC and x86/x64). It fails only on systems running OpenSolaris. However it does not mean that the builds are bug free on Solaris 10.

CMake fails to find aiowait on Solaris 10 systems even though it is available in libaio library. The following outputs are captured from a Solaris 10 system (these outputs are similar on SPARC & x86/x64 platforms).

% cmake -DCMAKE_INSTALL_PREFIX=/tmp/MySQLconnectorC
...
-- Looking for aiowait
-- Looking for aiowait - not found
..

% nm /lib/libaio.so.1 | grep aiowait
[61]    |     99880|       4|OBJT |LOCL |2    |18     |_aiowait_flag
[207]   |      8780|     960|FUNC |GLOB |0    |10     |aiowait

% nm /usr/lib/libc.so.1 | grep aiowait
% 

Due to CMake's failure to find aiowait, the following code block [in which the offending structure member rc_pos was referenced] is being completely ignored by the compiler's preprocessor -- hence we do not see the error.

Filename: mysql-connector-c-6.0.2/mysys/mf_iocache.c

  1279  #ifdef HAVE_AIOWAIT
  1297  int _my_b_async_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
  1298  {
		...
		...
  1372      info->read_end=info->rc_pos+read_length;
		...
  1468  } /* _my_b_async_read */
  1469  #endif

To reproduce the error on Solaris 10, CMake's test program must link against libaio. (Unfortunately I do not know how to add -laio to CMake platform test program's link line).

On the other hand, CMake was able to find the symbol aiowait in libc itself on OpenSolaris. It appears that most of the functions in libaio were moved to libc on OpenSolaris. Based on the explanation in above paragraph, now it is easy to figure out why the build failed on OpenSolaris.

The following outputs were captured from an OpenSolaris 2009.06 system:

% cmake -DCMAKE_INSTALL_PREFIX=/tmp/MySQLconnectorC
...
-- Looking for aiowait
-- Looking for aiowait - found
...

% nm /lib/libaio.so.1 | grep aiowait
[21]    |         0|         0|FUNC |GLOB |0    |ABS    |aiowait

% nm /usr/lib/libc.so.1 | grep aiowait
[4401]  |    635280|        67|FUNC |LOCL |0    |13     |_aiowait_cleanup
[279]   |   1387728|         4|OBJT |LOCL |2    |21     |_aiowait_flag
[8269]  |    635355|       916|FUNC |GLOB |3    |13     |aiowait
[18 Aug 2009 22:21] 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/81027

2861 Jim Winstead	2009-08-18
      Remove iocache and keycache code from mysys, as it's not used by the
      client library or clients. (Bug #46642)
[24 Jan 2011 13:08] Ulf Wendel
Georg, can this be closed? Patch has been comitted, JimW is no longer with MySQL/Sun/Oracle...
[25 Jan 2013 11:08] Paul DuBois
Noted in 6.0.3 changelog.

mf_iocache.c failed to compile on some platforms.