Bug #71268 configure.cmake improperly checks for C++ header cxxabi.h
Submitted: 1 Jan 2014 22:15 Modified: 4 Feb 2014 21:55
Reporter: Rical Jasan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.15 OS:Linux (3.2.0-57-generic-x86_64)
Assigned to: CPU Architecture:Any
Tags: C++, check_include_files, checkincludefiles, cmake, cpp, cxx, cxxabi.h

[1 Jan 2014 22:15] Rical Jasan
Description:
When running cmake, the check for cxxabi.h in configure.cmake will always fail due to use of the improper module CheckIncludeFiles. Running 'cmake . -L' in <srcdir>:

-- Running cmake version 2.8.7
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
...
-- MySQL 5.6.15
...
-- Looking for include files HAVE_CXXABI_H
-- Looking for include files HAVE_CXXABI_H - not found.
...

Note that CMake was able to find ABI info in its self-test.

Looking in CMakeFiles/CMakeError.log:

...
Determining if files cxxabi.h exist failed with the following output:
Change Dir: <srcdir>/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
make[1]: Entering directory `<srcdir>/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report <srcdir>/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/CheckIncludeFiles.c.o
/usr/bin/gcc   -Wall     -o CMakeFiles/cmTryCompileExec.dir/CheckIncludeFiles.c.o   -c <srcdir>/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
<srcdir>/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:20: fatal error: cxxabi.h: No such file or directory
compilation terminated.
make[1]: *** [CMakeFiles/cmTryCompileExec.dir/CheckIncludeFiles.c.o] Error 1
make[1]: Leaving directory `<srcdir>/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec/fast] Error 2

Source:
/* */
#include <cxxabi.h>

int main(){return 0;}

Which is the correct behaviour for a call to CHECK_INCLUDE_FILES() (after examining the source in <pathto>/cmake-2.8/Modules/CheckIncludeFiles.cmake) as is done in <srcdir>/configure.cmake on line 253:

CHECK_INCLUDE_FILES (cxxabi.h HAVE_CXXABI_H)

I have this header:

$ find /usr -name 'cxxabi.h'
/usr/include/c++/4.6/cxxabi.h

So the compiler just isn't finding it. If I create a file "test.c" with the exact same contents as the test source file, I can obtain the following:

$ gcc -Wall -c test.c ; echo $?
test.c:1:20: fatal error: cxxabi.h: No such file or directory
compilation terminated.
1
$ cp test.c test.cpp
$ gcc -Wall -c test.cpp ; echo $?
0
$ g++ -Wall -c test.c ; echo $?
0

There is a CMake module, CheckIncludeFileCXX. Editing configure.cmake to include the module and use it to check for cxxabi.h, such that:

INCLUDE(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)

and running `cmake . -L' again (after removing CMakeCache.txt), gives:

...
-- Looking for C++ include cxxabi.h
-- Looking for C++ include cxxabi.h - found
...

This behaviour was also verified in the latest available source mysql-5.7.3-m13.tar.gz.

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

How to repeat:
Run cmake on the source.

Suggested fix:
In configure.cmake, add the line:

INCLUDE(CheckIncludeFileCXX)

and change:

CHECK_INCLUDE_FILES (cxxabi.h HAVE_CXXABI_H)

to:

CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)
[28 Jan 2014 19:01] Sveta Smirnova
Thank you for the report.

Verified as described.
[4 Feb 2014 21:55] Paul DuBois
Noted in 5.7.4 changelogs.

During configuration, CMake improperly checked for the C++ header
file cxxabi.h.