Thanks Trink. I've now fixed the CMAKE_C_COMPILER variable and cmake correctly finds gcc from the cross compilation toolchain, but the build still fail with the same error:
[...] Scanning dependencies of target hekad # runtime/cgo cc1: error: unrecognized command line option '-marm' make[2]: *** [CMakeFiles/hekad] Error 2 make[1]: *** [CMakeFiles/hekad.dir/all] Error 2 make: *** [all] Error 2 I suspect the wrong cgo binary is picked for building here: /opt/go/pkg/tool/linux_amd64/cgo does not support the "-marm" flag while /opt/go/pkg/tool/linux_arm/cgo does support it. Anyway, I managed to build heka for arm directly on the target device, so I give up with cross compiling for now. Cheers, Bruno On 30 April 2014 20:23, Michael Trinkala <[email protected]> wrote: > I don't believe anyone has tried. > > There are a couple of ways you can specify the compiler: > - in the toolchain file set this variable CMAKE_C_COMPILER (looks like you > have a typo in your file) > - in the environment set the CC environment variable and cmake will pick > it up during generation > > In either case you will want to delete the build directory and re-run the > build script. > > Trink > > > > ------------------------------ > > *From: *"bruno binet" <[email protected]> > *To: *"heka" <[email protected]> > *Sent: *Tuesday, April 29, 2014 8:52:40 AM > *Subject: *[heka] cross compile to arm > > > Hi, > > I'd like to use heka on small arm boards (raspberry pi and cubieboard) to > collect and send metrics to centralized heka server, so I was wondering if > somebody had already compiled heka on arm? > I've tried to follow this guide > http://www.cmake.org/Wiki/CMake_Cross_Compiling to configure cmake to do > cross compilation, but it fails with the following error: > > [100%] Built target mocks > Scanning dependencies of target hekad > # runtime/cgo > cc1: error: unrecognized command line option '-marm' > make[2]: *** [CMakeFiles/hekad] Error 2 > make[1]: *** [CMakeFiles/hekad.dir/all] Error 2 > make: *** [all] Error 2 > > Note that I'm running the following build script: > > export CGO_ENABLED=1 > export GOARCH=arm > export GOOS=linux > export > CROSS_COMPILE_TOOLCHAIN_ROOT=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64 > > rm -rf CMakeCache.txt CMakeFiles/ > cmake -G "Unix Makefiles" > -DCMAKE_TOOLCHAIN_FILE=/vagrant/arm.toolchain.cmake \ > -DCMAKE_BUILD_TYPE=release .. > make > > > Here is my CMAKE_TOOLCHAIN_FILE: > > SET(CMAKE_SYSTEM_NAME Linux) > SET(CMAKE_SYSTEM_VERSION 1) > > SET(CROSS_COMPILE > $ENV{CROSS_COMPILE_TOOLCHAIN_ROOT}/bin/arm-linux-gnueabihf-) > SET(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++) > SET(CMAKE_CC_COMPILER ${CROSS_COMPILE}gcc) > SET(CMAKE_AS ${CROSS_COMPILE}as) > SET(CMAKE_AR ${CROSS_COMPILE}ar) > SET(CMAKE_NM ${CROSS_COMPILE}nm) > SET(CMAKE_LINKER ${CROSS_COMPILE}ld) > SET(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump) > SET(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy) > SET(CMAKE_RANLIB ${CROSS_COMPILE}ranlib) > SET(CMAKE_STRIP ${CROSS_COMPILE}strip) > > SET(CMAKE_FIND_ROOT_PATH $ENV{CROSS_COMPILE_TOOLCHAIN_ROOT}) > SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) > SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) > SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) > > > And CROSS_COMPILE_TOOLCHAIN_ROOT points to a > https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64git > clone. > > Any idea of what is wrong with my setup? > Has anybody already succeeded in cross-compiling heka on arm? > > I don't know CMake, so any help would be really appreciated. > I suspect CMake to use the wrong compiler /usr/bin/gcc (not the one from > the cross compilation toolchain > /opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc) > because CMake print out these messages: > -- The C compiler identification is GNU > -- Check for working C compiler: /usr/bin/gcc > -- Check for working C compiler: /usr/bin/gcc -- works > > Thanks, > Bruno > > _______________________________________________ > Heka mailing list > [email protected] > https://mail.mozilla.org/listinfo/heka > > >
_______________________________________________ Heka mailing list [email protected] https://mail.mozilla.org/listinfo/heka

