Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-compiling Valgrind for ARM

I need to cross-compile VALGRIND to run on Freescale i.MX278 (ARM 9) running Linux. I have the tool chain provided by Freescale itself.

I have already set the PATH variable to tool chain path. I'm using following command further:

$ export CROSS_COMPILE=arm-fsl-linux-gnueabi-
$ export CC=${CROSS_COMPILE}gcc
$ export CPP=${CROSS_COMPILE}cpp
$ export CXX=${CROSS_COMPILE}g++
$ export LD=${CROSS_COMPILE}ld
$ export AR=${CROSS_COMPILE}ar

$ ./configure --target=arm-fsl-linux-gnueabi \
              --host=armv7-fsl-linux-gnueabi \
              --prefix=/opt/valgrind \
              CFLAGS=-static

It passes the ./configure but fails on make with following error:

gcc: error: unrecognized command line option ‘-marm’
like image 920
Mayank Avatar asked Apr 08 '15 12:04

Mayank


2 Answers

First run the below command to make a change in the configure file

sed -i -e "s#armv7#arm#g" configure

Then run the configure option.

It will be cross-compiled successfully.

like image 118
ashwanth selvam Avatar answered Oct 03 '22 10:10

ashwanth selvam


A bit late to the party but for any one else coming here, it seems the valgrind build system differ between setting the environment variables in the shell and passing them as arguments to configure. Try:

$ export CROSS_COMPILE=arm-fsl-linux-gnueabi-
$ ./configure --target=arm-fsl-linux-gnueabi \
              --host=armv7-fsl-linux-gnueabi \
              --prefix=/opt/valgrind \
              CFLAGS=-static \
              CC=${CROSS_COMPILE}gcc \
              CPP=${CROSS_COMPILE}cpp \
              CXX=${CROSS_COMPILE}g++ \
              LD=${CROSS_COMPILE}ld \
              AR=${CROSS_COMPILE}ar
like image 41
Andreas Magnusson Avatar answered Oct 03 '22 09:10

Andreas Magnusson