Cross compiling ROOT for ARM using yocto project

Dear all,

I’m trying to cross compile ROOT to have it run on a Cyclone V SoC FPGA with an ARM HPS.
For that I used yocto project to build an Angstrom (https://github.com/Angstrom-distribution) image.
After having the image built I used yocto devtool to create an SDK and then cross compile ROOT.
The build system is a ubuntu x86_64.
I was able to get a successful cmake configuration following this bug report: https://sft.its.cern.ch/jira/browse/ROOT-9248?page=com.xiplink.jira.git.jira-git-plugin%3Agit-commits-tabpanel.
The compilation went as expected until it needs to use rootcling_stage1 where it crashes letting me know it can’t run that file with the error:

[ 53%] Built target rootcling_stage1
Scanning dependencies of target G__Core
[ 53%] Generating G__Core.cxx, ../../lib/libCore.rootmap
/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-6.11.02/core/rootcling_stage1/src/rootcling_stage1: 1: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-6.11.02/core/rootcling_stage1/src/rootcling_stage1: Syntax error: word unexpected (expecting ")")
make[2]: *** [core/base/CMakeFiles/G__Core.dir/build.make:427: core/base/G__Core.cxx] Error 2
make[1]: *** [CMakeFiles/Makefile2:16729: core/base/CMakeFiles/G__Core.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

In the bug report that was submitted the reporter seems to also have several problems with rootcling but he doesn’t seem to run into this particular problem.
Does anyone has any experience with this? Can you help me finding what is going wrong.

The cmake output I get is the following:

-- Toolchain file defaulted to '/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/share/cmake/OEToolchainConfig.cmake'
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc
-- Check for working C compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-g++
-- Check for working CXX compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/hosttools/git (found version "2.7.4") 
-- ROOT default compression algorithm: zlib
-- Vc does not support . Support for Vc disabled.
-- Found GCC. Major version 8, minor version 2
-- Performing Test HAS_CXX11
-- Performing Test HAS_CXX11 - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found a 32bit ARM system
-- Found GNU compiler collection
-- Performing Test GLIBCXX_USE_CXX11_ABI
-- Performing Test GLIBCXX_USE_CXX11_ABI - Success
-- ROOT Platform: linux
-- ROOT Architecture: linuxarm
-- Build Type: RelWithDebInfo
-- Compiler Flags:  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0=/usr/src/debug/angstrom-image/1.0-r0 -fdebug-prefix-map=/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot= -fdebug-prefix-map=/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native=  -fvisibility-inlines-hidden -Wno-implicit-fallthrough -Wno-noexcept-type -pipe   -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -std=c++11 
-- Looking for ZLib
-- Found ZLIB: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/lib/libz.so (found version "1.2.11") 
-- Looking for Freetype
-- Found Freetype: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/lib (found version "2.9.0") 
-- Looking for PCRE
-- Found PCRE: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/include  
-- Looking for LZMA
-- Found LZMA includes at /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/include
-- Found LZMA library at /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/lib/liblzma.so
-- Looking for xxHash
-- Could NOT find xxHash (missing: xxHash_LIBRARY xxHash_INCLUDE_DIR) 
-- xxHash not found. Switching on builtin_xxhash option
-- Looking for LZ4
-- Found LZ4: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/lib/liblz4.so (found version "1.8.2") 
-- Enabled support for:  builtin_clang builtin_ftgl builtin_llvm builtin_xxhash cling cxx11 explicitlink thread
-- The ASM compiler identification is GNU
-- Found assembler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/include  
-- Native target architecture is ARM
-- Threads disabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: arm-angstrom-linux-gnueabi
-- Building with -fPIC
-- Found PythonInterp: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/hosttools/python2.7 (found version "2.7.12") 
-- Constructing LLVMBuild project information
-- Setting native build dir to /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-tes/NATIVE
-- Configuring NATIVE build...
-- Configuring NATIVE targets...
-- Toolchain file defaulted to '/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/share/cmake/OEToolchainConfig.cmake'
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc
-- Check for working C compiler: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot-native/usr/bin/arm-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc -- broken
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-tes/NATIVE/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-tes/NATIVE/CMakeFiles/CMakeError.log".
-- Linker detection: GNU Gold
-- SysLibs: rt;dl;tinfo;-lpthread;/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/lib/libz.so
-- Targeting ARM
-- Clang version: 5.0.0
-- Cling version (from VERSION file): ROOT_0.6~dev
-- Cling will look for C++ headers in '/home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/recipe-sysroot/usr/include/' at runtime.
-- And then fallback to: 'arm-angstrom-linux-gnueabi-g++'
-- Performing Test CXX_HAS_Wno_maybe_uninitialized
-- Performing Test CXX_HAS_Wno_maybe_uninitialized - Success
-- Performing Test __result
-- Performing Test __result - Success
-- Performing Test CXX_HAS_fno_rtti
-- Performing Test CXX_HAS_fno_rtti - Success
-- Performing Test C_HAS_Wno_strict_overflow
-- Performing Test C_HAS_Wno_strict_overflow - Success
-- Performing Test C_HAS_Wno_maybe_uninitialized
-- Performing Test C_HAS_Wno_maybe_uninitialized - Success
-- Performing Test C_HAS_Wno_parentheses_equality
-- Performing Test C_HAS_Wno_parentheses_equality - Success
-- Looking for m
-- Looking for m - not found
-- Performing Test found_setresuid
-- Performing Test found_setresuid - Success
-- Performing Test found_stdstringview
-- Performing Test found_stdstringview - Failed
-- Performing Test found_stdexpstringview
-- Performing Test found_stdexpstringview - Failed
-- Performing Test found_stdapply
-- Performing Test found_stdapply - Failed
-- Performing Test found_stdinvoke
-- Performing Test found_stdinvoke - Failed
-- Performing Test found_stdindexsequence
-- Performing Test found_stdindexsequence - Failed
-- Performing Test found_attribute_always_inline
-- Performing Test found_attribute_always_inline - Success
Running /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/root-6.16.00/build/unix/compiledata.sh
Making /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-tes/include/compiledata.h
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Ricardo/angstrom/tmp-angstrom-glibc/work/cyclone5-angstrom-linux-gnueabi/angstrom-image/1.0-r0/angstrom-image-1.0/build-tes

If you need to see any of my environment variables please let me know.

Thank you,
Ricardo

Maybe @Axel or @amadio could help…

Well - we need to build some tools both for host and target. Our current CMake-based build system doesn’t support that yet (there’s a bug report on that…).

For the time being I’d recommend to build on the target machine.

Cheers, Axel.

The target machine is not powerful enough to build root hence the cross compilation.
In the bug report the reporter was able to compile it to 100% so it is possible.

Can you give me some clues what the error is about, so I can try and solve it?

Looks like the host wasn’t able to run rootcling_stage1. Not surprising, because it was compiled for the target, not host, architecture…

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