← Back to team overview

maria-developers team mailing list archive

Re: Clang build failure

 

Terin Stock <terinjokes@xxxxxxxxx> writes:

> MariaDB 5.3.5, 5.2.10 and possibly other versions, fails to compile using Apple's Clang compiler. As of Xcode 4.3, Clang is the default compiler, replacing LLVM-GCC. 
>
> The issue seems to occur when checking for an ABI incompatibility in mysql.h. As Clang preprocesses the file differently than GCC, the output is different, which fails the abi_check.
>
> MariaDB compiles fine using the non-default LLVM-GCC compiler.
>
> https://gist.github.com/1944688 

+ /usr/bin/diff -w include/mysql.h.pp ./abi_check.out
3,4d2
< #include "mysql_version.h"
< #include "mysql_com.h"
147d144
< #include "mysql_time.h"
160d156
< #include "my_list.h"
201,202d196
< #include "typelib.h"
< #include "my_alloc.h"
242d235
< #include "my_alloc.h"

It looks like Clang does not support the -dI switch.

But this ABI check is only supposed to be activated when using GCC. From
configure.in:

if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
then
  ABI_CHECK=""
else
  ABI_CHECK="abi_check"
fi

The AC_PROG_CC macro sets $GCC to "yes" if it detects GCC.

Could it be that Clang is lying to autoconf in Xcode 4.3, pretending to be
GCC? Maybe it would be worth investigating, and filing a bug against Clang or
Autoconf, if appropriate.

But either way, it would be good to have a fix in MariaDB. I am not familiar
with Clang/Xcode, but maybe you could suggest an extra check in the above
configure.in snippet that could be used to detect that the compiler is really
Clang?

 - Kristian.


References