Using clang as cross compiler

patches

patch to fix new features (new atomics) in 4.7.2 not known to clang trunk (May 2013):

In file /usr/include/c++/4.7.2/armv7hl-redhat-linux-gnueabi/bits/c++config.h modify such that it reads:

/* Define if the compiler supports C++11 atomics. */
#ifndef __clang__
#define _GLIBCXX_ATOMIC_BUILTINS 1
#endif

so that only gcc sees this definition. /afs/cern.ch/work/s/seuster/ARM/sysroo

1st try - compilation of explicit cross compiler in x86

recompilation of trunk of clang (May 2013) with this configure:
 ../../trunk-src/llvm/configure --prefix=/afs/cern.ch/work/s/seuster/CLANG/trunk-install/slc6-2 --enable-optimized --target=armv7l-unknown-linux-gnueabihf --with-cpu=cortex-a9 --with-float=hard --with-abi=aapcs-vfp --with-fpu=neon --enable-targets=arm --enable-optimized --enable-assertions

Compilation of .o files then works with this command line:

( cd src ; armv7l-unknown-linux-gnueabihf-clang++ -emit-llvm -v -isysroot /afs/cern.ch/work/s/seuster/ARM/sysroot -iwithsysroot /usr/include/c++/4.7.2 -iwithsysroot /usr/include/c++/4.7.2/armv7hl-redhat-linux-gnueabi -DHAVE_CONFIG_H -I. -I../include/fastjet -O3 -Wall -g -Woverloaded-virtual -DDROP_CGAL -I./../include -MT libfastjet_la-ClusterSequence.lo -MD -MP -MF .deps/libfastjet_la-ClusterSequence.Tpo -c ClusterSequence.cc -fPIC -DPIC -o .libs/libfastjet_la-ClusterSequence.o_cross )

Before, I copied the /usr subtree of the ARM box into /afs/cern.ch/work/s/seuster/ARM/sysroot and applied above mentioned patch.

Next steps will be to start compilation on ARM box and distribute via distcc. Some smallish hacks will be needed.

fastjet compilation then fails with:

In file included from /usr/include/math.h:414:
/usr/include/bits/math-finite.h:256:1: error: unknown type name '__extern_always_inline'
__extern_always_inline double __NTH (lgamma (double __d))
^
/usr/include/bits/math-finite.h:256:24: error: expected unqualified-id
__extern_always_inline double __NTH (lgamma (double __d))

so, add

 -D__extern_always_inline=inline

to the compile options (will only be needed until clang understands this - sigh)

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2013-05-10 - RolfSeuster
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback