github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/docs/setup/cross-compilation.md (about)

     1  # Cross Compiling KubeEdge
     2  
     3  In most of the cases, when you are trying to compile KubeEdge edgecore on Raspberry Pi or any other device, you may run out of memory, in that case, it is advisable to cross-compile the Edgecore binary and transfer it to your edge device.
     4  
     5  ## For ARM Architecture from x86 Architecture 
     6  
     7  Clone KubeEdge
     8  
     9  ```shell
    10  # Build and run KubeEdge on an ARMv6 target device.
    11  
    12  git clone https://github.com/kubeedge/kubeedge.git $GOPATH/src/github.com/kubeedge/kubeedge
    13  cd $GOPATH/src/github.com/kubeedge/kubeedge/edge
    14  sudo apt-get install gcc-arm-linux-gnueabi
    15  export GOARCH=arm
    16  export GOOS="linux"
    17  export GOARM=6 #Pls give the appropriate arm version of your device 
    18  export CGO_ENABLED=1
    19  export CC=arm-linux-gnueabi-gcc
    20  make edgecore
    21  ```
    22  
    23  If you are compiling KubeEdge edgecore for Raspberry Pi and check the [Makefile](https://github.com/kubeedge/kubeedge/blob/master/edge/Makefile) for the edge.
    24  
    25  In that CC has been defined as
    26  ```
    27  export CC=arm-linux-gnueabi-gcc;
    28  ```
    29  
    30  However, it always good to check what's your gcc on Raspberry Pi says by
    31  
    32  ```
    33  gcc -v
    34  
    35  Using built-in specs.
    36  COLLECT_GCC=gcc
    37  COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper
    38  Target: arm-linux-gnueabihf
    39  Configured with: ../src/configure -v --with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
    40  Thread model: posix
    41  gcc version 6.3.0 20170516 (Raspbian 6.3.0-18+rpi1+deb9u1)
    42  ```
    43  
    44  If you see, Target has been defined as 
    45  ```
    46  Target: arm-linux-gnueabihf
    47  ```
    48  in that case, export CC as 
    49  ```
    50  arm-linux-gnueabihf-gcc rather than arm-linux-gnueabi-gcc
    51  ```
    52  
    53  Also, based on the above result, you may have to install
    54  ```
    55  gcc-arm-linux-gnueabi - GNU C cross-compiler for architecture armel
    56  
    57  or
    58  
    59  gcc-arm-linux-gnueabihf - GNU C cross-compiler for architecture armhf
    60  ```