Bug #74166 compile error
Submitted: 30 Sep 2014 21:55 Modified: 7 Oct 2014 17:40
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.5 OS:Any
Assigned to: CPU Architecture:Any

[30 Sep 2014 21:55] Mark Callaghan
Description:
I get this error from sql/mysqld.cc

/s/bld/orig575/sql/mysqld.cc: In function ‘void my_init_signals()’:
/s/bld/orig575/sql/mysqld.cc:2044:21: error: aggregate ‘my_init_signals()::rlimit rl’ has incomplete type and cannot be defined
/s/bld/orig575/sql/mysqld.cc:2045:33: error: ‘RLIM_INFINITY’ was not declared in this scope
/s/bld/orig575/sql/mysqld.cc:2046:21: error: ‘RLIMIT_CORE’ was not declared in this scope
/s/bld/orig575/sql/mysqld.cc:2046:37: error: ‘setrlimit’ was not declared in this scope

The 5.7.5 code is not protected by ifdefs:

    if (test_flags & TEST_CORE_ON_SIGNAL)
    {
      // Change limits so that we will get a core file.
      struct rlimit rl;
      rl.rlim_cur= rl.rlim_max= RLIM_INFINITY;
      if (setrlimit(RLIMIT_CORE, &rl))
        sql_print_warning("setrlimit could not change the size of core files to"
                          " 'infinity';  We may not be able to generate a"
                          " core file on signals");
    }

The similar 5.6 code was protected and the file included <sys/resource.h>

#ifdef HAVE_GETRLIMIT
  if (test_flags & TEST_CORE_ON_SIGNAL)
  {
    /* Change limits so that we will get a core file */
    STRUCT_RLIMIT rl;
    rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
    if (setrlimit(RLIMIT_CORE, &rl) && log_warnings)
      sql_print_warning("setrlimit could not change the size of core files to 'infinity';  We may not be able to generate a core file on signals");
  }
#endif                                                                                             

How to repeat:
run cmake, make

Suggested fix:
include <sys/resource.h>
[2 Oct 2014 13:18] MySQL Verification Team
Mark,

It is quite evident that the conditional compilation is missing. However, for full verification of the bug I do require the info on OS, its version, and versions of cmake, make and C / C++ compiler.

Thanks in advance.
[3 Oct 2014 16:02] Mark Callaghan
gcc 4.7.1
glibc 2.14
cmake 2.8.3
Linux kernel 3.2.51
CentOS 6.3
[3 Oct 2014 16:44] MySQL Verification Team
Indeed, it is the error in missing a conditional compilation.

Fully verified.
[7 Oct 2014 17:40] Paul DuBois
Noted in 5.7.6 changelog.

The -DENABLED_PROFILING=0 CMake option resulted in compilation
errors.