Details
Description
Build fails when using gcc installed by homebrew.
Environments:
$ uname -sr
|
Darwin 20.5.0
|
$ gcc --version
|
gcc (Homebrew GCC 11.1.0_1) 11.1.0
|
Copyright (C) 2021 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.
|
$ g++ --version
|
g++ (Homebrew GCC 11.1.0_1) 11.1.0
|
Copyright (C) 2021 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.
|
$ cmake --version
|
cmake version 3.19.7
|
CMake suite maintained and supported by Kitware (kitware.com/cmake).
|
Build:
$ cd build
|
$ cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ ..
|
$ cmake --build . --config Debug -j 8
|
 |
.....
|
In file included from server/sql/structs.h:26,
|
from server/sql/handler.h:34,
|
from server/storage/innobase/include/trx0xa.h:27,
|
from server/storage/innobase/include/trx0trx.h:34,
|
from server/storage/innobase/btr/btr0pcur.cc:30:
|
server/include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)':
|
server/include/my_time.h:249:65: error: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value [-Werror=conversion]
|
249 | tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals);
|
.....
|
https://opensource.apple.com/source/xnu/xnu-4570.41.2/bsd/sys/_types/_timeval.h.auto.html
The reason is that the data type of the tv_usec member of the timeval structure used by gcc installed by homebrew is __darwin_suseconds_t, and __darwin_suseconds_t is declared as __int32_t.