Compilation error trying to compile ROOT for android/termux/armel

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.34.08
Platform: Android Termux Arm 32-bit
Compiler: clang-9


Dear ROOT people, I would like to ask for some help compiling ROOT for arm/termux.

LLVM builds fine, but ROOT itself has issues.

I am compiling it like this:

-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-Dxrootd=OFF
-Dbuiltin_xrootd=OFF
-Dqt=OFF

I managed to compile it until 52%, compilation log not attached, because the forum will not let me either upload anything or post a link to an external upload server:

[ 52%] Linking CXX executable src/rootcling_stage1
[ 52%] Built target rootcling_stage1
[ 52%] Generating ../include/RConfigure.h
[ 52%] Built target rconfigure
[ 52%] Generating G__Core.cxx, ../lib/Core.pcm
While building module 'Core':
While building module 'std' imported from input_line_1:1:
In file included from <module-includes>:2:
/data/data/com.termux/files/usr/bin/../include/c++/v1/ctype.h:39:15: fatal error: 'ctype.h' file not found
#include_next <ctype.h>
              ^~~~~~~~~
While building module 'Core':
While building module 'std' imported from input_line_1:1:
While building module 'libc' imported from /data/data/com.termux/files/usr/bin/../include/c++/v1/math.h:301:
In file included from <module-includes>:2:
In file included from /data/data/com.termux/files/usr/include/string.h:36:
In file included from /data/data/com.termux/files/usr/include/bits/strcasecmp.h:37:
In file included from /data/data/com.termux/files/usr/include/sys/types.h:36:
/data/data/com.termux/files/usr/include/linux/types.h:21:10: fatal error: 'asm/types.h' file not found
#include <asm/types.h>
         ^~~~~~~~~~~~~
input_line_1:1:10: fatal error: could not build module 'std'
#include <new>
 ~~~~~~~~^
Warning in cling::IncrementalParser::CheckABICompatibility():
  Failed to extract C++ standard library version.
Warning in cling::IncrementalParser::CheckABICompatibility():
  Possible C++ standard library mismatch, compiled with _LIBCPP_ABI_VERSION '1'
  Extraction of runtime standard library version was: ''
While building module 'Core':
While building module 'Cling_Runtime' imported from input_line_2:1:
While building module 'Cling_Runtime_Extra' imported from /data/data/com.termux/files/home/.termux-build/root/build/etc/cling/Interpreter/RuntimeUniverse.h:27:
In file included from <module-includes>:1:
/data/data/com.termux/files/home/.termux-build/root/build/etc/cling/Interpreter/DynamicExprInfo.h:13:10: fatal error: could not build module 'std'
#include <string>
 ~~~~~~~~^
/data/data/com.termux/files/home/.termux-build/root/build/etc/cling/Interpreter/RuntimeUniverse.h:27:10: fatal error: could not build module 'Cling_Runtime_Extra'
#include "cling/Interpreter/Visibility.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from input_line_3:1:
/data/data/com.termux/files/usr/include/assert.h:72:1: error: unknown type name '__BEGIN_DECLS'
__BEGIN_DECLS
^
/data/data/com.termux/files/usr/include/assert.h:78:66: error: expected function body after function declarator
void __assert(const char* __file, int __line, const char* __msg) __noreturn;
                                                                 ^
/data/data/com.termux/files/usr/include/assert.h:84:91: error: expected function body after function declarator
void __assert2(const char* __file, int __line, const char* __function, const char* __msg) __noreturn;
                                                                                          ^
/data/data/com.termux/files/usr/include/assert.h:86:1: error: use of undeclared identifier '__END_DECLS'
__END_DECLS
^
While building module 'Core':
While building module 'ROOT_Rtypes' imported from /data/data/com.termux/files/home/.termux-build/root/build/include/Rtypes.h:23:
In file included from <module-includes>:1:
/data/data/com.termux/files/home/.termux-build/root/build/include/RtypesCore.h:28:10: fatal error: could not build module 'std'
#include <cstddef> // size_t, NULL
 ~~~~~~~~^
In file included from input_line_3:2:
/data/data/com.termux/files/home/.termux-build/root/build/include/Rtypes.h:23:10: fatal error: could not build module 'ROOT_Rtypes'
#include "RtypesCore.h"
 ~~~~~~~~^~~~~~~~~~~~~~
While building module 'Core':
While building module 'ROOT_Foundation_C' imported from /data/data/com.termux/files/home/.termux-build/root/build/include/Rtypes.h:29:
In file included from <module-includes>:1:
/data/data/com.termux/files/home/.termux-build/root/build/include/ThreadLocalStorage.h:60:10: fatal error: could not build module 'ROOT_Rtypes'
#include "RtypesCore.h"
 ~~~~~~~~^~~~~~~~~~~~~~
While building module 'Core':
While building module 'ROOT_Foundation_Stage1_NoRTTI' imported from /data/data/com.termux/files/home/.termux-build/root/build/include/Rtypes.h:202:
In file included from <module-includes>:3:
/data/data/com.termux/files/home/.termux-build/root/build/include/TClassEdit.h:18:10: fatal error: could not build module 'libc'
#include <stdlib.h>
 ~~~~~~~~^
Error: Error loading the default rootcling header files.
make[2]: *** [core/CMakeFiles/G__Core.dir/build.make:484: core/G__Core.cxx] Error 1
make[1]: *** [CMakeFiles/Makefile2:38934: core/CMakeFiles/G__Core.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Hi @thrilledrelish,

thanks for reaching out!
I don’t have experience in compiling ROOT on Android platforms, so I’ll be guessing a bit here. What if you add -Druntime_cxxmodules=OFF to your cmake recipe?

Cheers,
Monica

Hi @thrilledrelish,

I would be very excited to know about your usecase for ROOT on android, sounds interesting :slight_smile:

I don’t think -Druntime_cxxmodules=OFF will help, but it’s worth a try for sure. The error you have usually happens in my experience when the C standard library is not picked up correctly. I remember encountering similar errors when building ROOT on macOS or NixOS, which I fixed by setting -DC_INCLUDE_DIRS=<dir> to the directory where libc is installed (the include directory that contains stuff like malloc.h, syscall.h, etc.). This is also done in the official NixOS ROOT package.

Maybe that helps in your case too? Maybe you just didn’t install glibc yet?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.