Can't build from source on macOS Catalina

Hi,

I just tried to build the latest version of XGBoost from git on my Mac running Catalina, following the instructions at https://xgboost.readthedocs.io/en/latest/build.html#building-on-osx

When I run ‘make’ I get lots of errors (see below). I am pretty new to macOS (used Linux before) and no C/C++ expert. When I had problems building from source on Linux it was usually due to missing libraries and easy to fix. But this looks different to me. I simply paste the whole output (sorry, I am not sure which part is relevant):

Scanning dependencies of target rabit_empty
Scanning dependencies of target rabit
Scanning dependencies of target dmlc
[ 1%] Building CXX object rabit/CMakeFiles/rabit_empty.dir/src/engine_empty.cc.o
[ 2%] Building CXX object rabit/CMakeFiles/rabit.dir/src/allreduce_base.cc.o
[ 3%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/build_config.cc.o
Scanning dependencies of target objxgboost
[ 4%] Building CXX object src/CMakeFiles/objxgboost.dir/c_api/c_api.cc.o
/Users/patric/dev/xgboost/dmlc-core/src/build_config.cc:14:6: warning: #warning “Redefining fopen64 with std::fopen” [-Wcpp]
#warning “Redefining fopen64 with std::fopen”
^~~~~~~
[ 6%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/config.cc.o
[ 7%] Building CXX object rabit/CMakeFiles/rabit_empty.dir/src/c_api.cc.o
[ 8%] Linking CXX static library librabit_empty.a
[ 9%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/data.cc.o
[ 9%] Built target rabit_empty
[ 10%] Building CXX object rabit/CMakeFiles/rabit.dir/src/allreduce_robust.cc.o
Scanning dependencies of target rabit_mock_static
[ 12%] Building CXX object rabit/CMakeFiles/rabit_mock_static.dir/src/allreduce_base.cc.o
[ 13%] Building CXX object src/CMakeFiles/objxgboost.dir/c_api/c_api_error.cc.o
[ 14%] Building CXX object rabit/CMakeFiles/rabit_mock_static.dir/src/allreduce_robust.cc.o
[ 15%] Building CXX object src/CMakeFiles/objxgboost.dir/common/common.cc.o
[ 17%] Building CXX object rabit/CMakeFiles/rabit.dir/src/engine.cc.o
[ 18%] Building CXX object src/CMakeFiles/objxgboost.dir/common/hist_util.cc.o
[ 19%] Building CXX object rabit/CMakeFiles/rabit.dir/src/c_api.cc.o
[ 20%] Linking CXX static library librabit.a
[ 20%] Built target rabit
[ 21%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io.cc.o
[ 23%] Building CXX object rabit/CMakeFiles/rabit_mock_static.dir/src/engine_mock.cc.o
[ 24%] Building CXX object rabit/CMakeFiles/rabit_mock_static.dir/src/c_api.cc.o
[ 25%] Linking CXX static library librabit_mock_static.a
[ 25%] Built target rabit_mock_static
[ 26%] Building CXX object src/CMakeFiles/objxgboost.dir/common/host_device_vector.cc.o
Scanning dependencies of target rabit_base
[ 28%] Building CXX object rabit/CMakeFiles/rabit_base.dir/src/allreduce_base.cc.o
[ 29%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/recordio.cc.o
[ 30%] Building CXX object rabit/CMakeFiles/rabit_base.dir/src/engine_base.cc.o
[ 31%] Building CXX object src/CMakeFiles/objxgboost.dir/common/io.cc.o
[ 32%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/line_split.cc.o
Scanning dependencies of target rabit_mock
[ 34%] Building CXX object rabit/CMakeFiles/rabit_mock.dir/src/allreduce_base.cc.o
[ 35%] Building CXX object rabit/CMakeFiles/rabit_base.dir/src/c_api.cc.o
[ 36%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/recordio_split.cc.o
[ 37%] Building CXX object src/CMakeFiles/objxgboost.dir/common/json.cc.o
[ 39%] Linking CXX static library librabit_base.a
[ 39%] Built target rabit_base
[ 40%] Building CXX object rabit/CMakeFiles/rabit_mock.dir/src/allreduce_robust.cc.o
[ 41%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/indexed_recordio_split.cc.o
[ 42%] Building CXX object src/CMakeFiles/objxgboost.dir/common/timer.cc.o
[ 43%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/input_split_base.cc.o
[ 45%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/filesys.cc.o
[ 46%] Building CXX object src/CMakeFiles/objxgboost.dir/common/version.cc.o
[ 47%] Building CXX object rabit/CMakeFiles/rabit_mock.dir/src/engine_mock.cc.o
[ 48%] Building CXX object src/CMakeFiles/objxgboost.dir/data/data.cc.o
[ 50%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/local_filesys.cc.o
[ 51%] Building CXX object rabit/CMakeFiles/rabit_mock.dir/src/c_api.cc.o
[ 52%] Linking CXX shared library librabit_mock.dylib
[ 53%] Building CXX object src/CMakeFiles/objxgboost.dir/data/ellpack_page.cc.o
[ 53%] Built target rabit_mock
[ 54%] Building CXX object src/CMakeFiles/objxgboost.dir/data/ellpack_page_source.cc.o
[ 56%] Linking CXX static library libdmlc.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libdmlc.a(build_config.cc.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libdmlc.a(build_config.cc.o) has no symbols
[ 56%] Built target dmlc
[ 57%] Building CXX object src/CMakeFiles/objxgboost.dir/data/simple_csr_source.cc.o
[ 58%] Building CXX object src/CMakeFiles/objxgboost.dir/data/simple_dmatrix.cc.o
[ 59%] Building CXX object src/CMakeFiles/objxgboost.dir/data/sparse_page_dmatrix.cc.o
[ 60%] Building CXX object src/CMakeFiles/objxgboost.dir/data/sparse_page_raw_format.cc.o
[ 62%] Building CXX object src/CMakeFiles/objxgboost.dir/gbm/gblinear.cc.o
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/wait.h:110,
from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:66,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstdlib:75,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:10,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/resource.h:443:34: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/resource.h:449:39: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int setiopolicy_np(int, int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:128,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstdlib:75,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:10,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/malloc/_malloc.h:52:74: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstdlib:75,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:10,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:270:53: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:273:46: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
arc4random_uniform(uint32_t __upper_bound) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstdlib:75,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:10,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:292:45: error: expected initializer before ‘__OSX_AVAILABLE_BUT_DEPRECATED_MSG’
int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, “Use posix_spawn APIs instead.”) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:325:6: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdlib.h:333:6: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/_stdio.h:79,
from /usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:78,
from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:90,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cwchar:44,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/iosfwd:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/ios:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/istream:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/sstream:38,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:12,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/stdio.h:39:56: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:90,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cwchar:44,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/iosfwd:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/ios:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/istream:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/sstream:38,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:12,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:370:67: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int dprintf(int, const char * __restrict, …) __printflike(2, 3) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:371:79: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int vdprintf(int, const char * __restrict, __gnuc_va_list) __printflike(2, 0) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:90,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cwchar:44,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/iosfwd:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/ios:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/istream:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/sstream:38,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:12,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:372:123: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
ssize_t getdelim(char ** __restrict __linep, size_t * __restrict __linecapp, int __delimiter, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/lib/gcc/8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:373:105: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
ssize_t getline(char ** __restrict __linep, size_t * __restrict __linecapp, FILE * __restrict __stream) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cwchar:44,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/bits/postypes.h:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/iosfwd:40,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/ios:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/istream:38,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/sstream:38,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:12,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:197:67: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:198:76: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:199:34: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
wchar_t *wcsdup(const wchar_t ) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:200:54: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int wcscasecmp(const wchar_t , const wchar_t ) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:201:65: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int wcsncasecmp(const wchar_t , const wchar_t , size_t n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:202:49: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
size_t wcsnlen(const wchar_t , size_t) __pure __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/wchar.h:215:47: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
wchar_t fgetwln(FILE * __restrict, size_t ) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
[ 63%] Building CXX object src/CMakeFiles/objxgboost.dir/gbm/gbm.cc.o
In file included from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./base.h:206,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:25,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:234:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:244:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:249:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:255:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:262:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/inttypes.h:268:25: error: expected constructor, destructor, or type conversion before ‘(’ token
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
^
In file included from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h:21,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./json.h:24,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:26,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/execinfo.h:35:27: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int backtrace(void
,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/execinfo.h:41:44: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
char
backtrace_symbols(void
const
,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/execinfo.h:42:49: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void backtrace_symbols_fd(void
const
,int,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./json.h:24,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:26,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h: In function ‘std::__cxx11::string dmlc::StackTrace(size_t, size_t)’:
/Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h:71:17: error: ‘backtrace’ was not declared in this scope
int nframes = backtrace(stack.data(), static_cast(stack_size));
^~~~~~~~~
/Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h:71:17: note: suggested alternative: ‘StackTrace’
int nframes = backtrace(stack.data(), static_cast(stack_size));
^~~~~~~~~
StackTrace
/Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h:73:17: error: ‘backtrace_symbols’ was not declared in this scope
char **msgs = backtrace_symbols(stack.data(), nframes);
^~~~~~~~~~~~~~~~~
/Users/patric/dev/xgboost/dmlc-core/include/dmlc/././logging.h:73:17: note: suggested alternative: ‘stacktrace_os’
char **msgs = backtrace_symbols(stack.data(), nframes);
^~~~~~~~~~~~~~~~~
stacktrace_os
In file included from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstring:42,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/././any.h:14,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./json.h:33,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:26,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h: At global scope:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:131:62: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
char *stpncpy(char *__dst, const char *__src, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:132:45: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
char *strndup(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:133:48: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
size_t strnlen(const char *__s1, size_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:145:67: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
errno_t memset_s(void *__s, rsize_t __smax, int __c, rsize_t __n) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:155:94: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void *memmem(const void *__big, size_t __big_len, const void *__little, size_t __little_len) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstring:42,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/././any.h:14,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./json.h:33,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:26,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:156:75: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void memset_pattern4(void *__b, const void *__pattern4, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:157:75: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void memset_pattern8(void *__b, const void *__pattern8, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:158:77: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
void memset_pattern16(void *__b, const void *__pattern16, size_t __len) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:180,
from /usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cstring:42,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/././any.h:14,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/./json.h:33,
from /Users/patric/dev/xgboost/dmlc-core/include/dmlc/parameter.h:26,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:9:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/strings.h:85:17: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int ffsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/strings.h:86:23: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int ffsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/strings.h:87:15: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/strings.h:88:17: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int flsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/strings.h:89:23: error: expected initializer before ‘__OSX_AVAILABLE_STARTING’
int flsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/patric/dev/xgboost/include/xgboost/span.h:34,
from /Users/patric/dev/xgboost/include/xgboost/data.h:14,
from /Users/patric/dev/xgboost/include/xgboost/gbm.h:13,
from /Users/patric/dev/xgboost/src/gbm/gblinear.cc:10:
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:61:11: error: ‘::imaxabs’ has not been declared
using ::imaxabs;
^~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:62:11: error: ‘::imaxdiv’ has not been declared
using ::imaxdiv;
^~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:68:11: error: ‘::strtoimax’ has not been declared
using ::strtoimax;
^~~~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:69:11: error: ‘::strtoumax’ has not been declared
using ::strtoumax;
^~~~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:72:11: error: ‘::wcstoimax’ has not been declared
using ::wcstoimax;
^~~~~~~~~
/usr/local/Cellar/gcc@8/8.3.0/include/c++/8.3.0/cinttypes:73:11: error: ‘::wcstoumax’ has not been declared
using ::wcstoumax;
^~~~~~~~~
make[2]: *** [src/CMakeFiles/objxgboost.dir/gbm/gblinear.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [src/CMakeFiles/objxgboost.dir/all] Error 2
make: *** [all] Error 2

Did you run

mkdir build
cd build
CC=gcc-8 CXX=g++-8 cmake ..
make -j4

Yes, I followed the instructions exactly.

It looks like command line tools are not correctly set up. Try compiling the following C++ program

#include <iostream>

int main(void) {
  std::cout << "Hello World!" << std::endl;
}

by running g++-8.

This example compiles without errors…

I have no idea what went wrong. Can you try instructions from https://github.com/dmlc/xgboost/issues/4949 ?

Installing xgboost via conda works, but I wanted to compile the latest version.

I’m currently working on this issue. A pull request is in progress. You may soon see this issue fixed on the master branch.

BTW, a quick fix is to install and use gcc@9 instead of gcc@8. It’s a compatible bug of MacOS and gcc. It’s only fixed in brew gcc@9 currently.