Bug #9166 Cluster compile failure on Solaris 10
Submitted: 14 Mar 2005 12:39 Modified: 16 Mar 2005 10:52
Reporter: Kent Boortz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:4.1.10, 5.0.3 OS:Solaris (solaris 10)
Assigned to: Tomas Ulin CPU Architecture:Any

[14 Mar 2005 12:39] Kent Boortz
Description:
Using cc-5.0 on Solaris the compile of " basestring_vsnprintf.c" fails with

  "/usr/include/sys/feature_tests.h", line 332: #error: 
    "Compiler or options invalid for pre-UNIX 03 X/Open 
     applications  and pre-2001 POSIX applications"

It is possible to force the code to compila if "-xc99=%none" is
added to CFLAGS, but it looks like a correction for IRIX in the
source file itself is causing this problem. The correction sets

  #define _XOPEN_SOURCE 500

before the system includes.

How to repeat:
Compile on Solaris 10, the source using

CC=cc-5.0 CXX=CC \\
ASFLAGS="-xarch=v9" \\
CFLAGS="-DBIG_TABLES -Xa -xstrconst -mt -D_FORTEC_ -xarch=v9" \\
CXXFLAGS="-DBIG_TABLES -noex -mt -D_FORTEC_ -xarch=v9" \\
LDFLAGS="-xarch=v9" \\
./configure --with-extra-charsets=complex --enable-thread-safe-client \\
--enable-local-infile --disable-shared --with-readline --with-ndbcluster

Suggested fix:
The IRIX correction in the source file should probably be 
controlled from configure.in or something, and be conditional
for IRIX or operating systems with this problem.  But I can't
really say.
[15 Mar 2005 15:00] Martin Skold
There is a SOLARIS define (used in mysqld.cc for example).
It does not seemed to be passed to cc when compiing this file
(this is a bug in the build scripts), but if this is modified, then the
#define _XOPEN_SOURCE 500
can be wrappen in a
#ifndef SOLARIS
...
#endif
However, since we probably have to modify the configure
script we might as well add an -DIRIX so we directly can
wrap it in
#ifdef IRIX
...
#endif
[15 Mar 2005 21: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/internals/23059
[16 Mar 2005 10:52] Martin Skold
Wrapped #define with
#ifdef __sgi
...
#endif