So I’m trying to (cross-)compile xgboost 1.0.2 on musl, and failing.
Here’s what I did:
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}"
make
The output of cmake can be seen here
On running make, I get errors like this
[ 1%] Building CXX object src/CMakeFiles/objxgboost.dir/c_api/c_api.cc.o
cd /workspace/srcdir/xgboost/build/src && /opt/bin/x86_64-linux-musl-g++ --sysroot=/opt/x86_64-linux-musl/x86_64-linux-musl/sys-root/ -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_BUILTIN_PREFETCH_PRESENT=1 -DXGBOOST_MM_PREFETCH_PRESENT=1 -D_MWAITXINTRIN_H_INCLUDED -I/workspace/srcdir/xgboost/include -I/workspace/srcdir/xgboost/dmlc-core/include -I/workspace/srcdir/xgboost/rabit/include -O3 -DNDEBUG -fPIC -funroll-loops -fopenmp -std=gnu++11 -o CMakeFiles/objxgboost.dir/c_api/c_api.cc.o -c /workspace/srcdir/xgboost/src/c_api/c_api.cc
In file included from /workspace/srcdir/xgboost/dmlc-core/include/dmlc/./serializer.h:22,
from /workspace/srcdir/xgboost/dmlc-core/include/dmlc/io.h:446,
from /workspace/srcdir/xgboost/rabit/include/rabit/internal/utils.h:16,
from /workspace/srcdir/xgboost/rabit/include/rabit/serializable.h:11,
from /workspace/srcdir/xgboost/rabit/include/rabit/./internal/engine.h:10,
from /workspace/srcdir/xgboost/rabit/include/rabit/rabit.h:48,
from /workspace/srcdir/xgboost/src/c_api/c_api.cc:3:
/workspace/srcdir/xgboost/dmlc-core/include/dmlc/././endian.h:34:6: error: #error "Unable to determine endianness of your machine; use CMake to compile"
#error "Unable to determine endianness of your machine; use CMake to compile"
^~~~~
/workspace/srcdir/xgboost/dmlc-core/include/dmlc/./serializer.h: In static member function ‘static void dmlc::serializer
::ArithmeticHandler<T>::Write(dmlc::Stream*, const T&)’: /workspace/srcdir/xgboost/dmlc-core/include/dmlc/././endian.h:39:33: error: ‘DMLC_LITTLE_ENDIAN’ was not declared in this scope
So in trying to troubleshoot this, I find that cmake has created a build/dmlc-core/include/build_config.h
with the right incantations. However, I don’t understand how those variables get included in the build. Clearly the compiler hasnt found the DMLC_CMAKE_LITTLE_ENDIAN
variable that is defined in the build_config.h
file.
I last did something similar on xgboost 0.82, and things seem to have worked then.
Any pointers to how to further debug this?
Regards
Avik