1
votes

Getting below error while compiling Valgrind for Cavium MIPS

/opt/cavium-64bit/tools-3535/bin/mips64-octeon-linux-gnu-gcc -std=c99 -msoft-float -Wall -mabi=64 -G 0 -fPIC -mips64r2 -mplt -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_mips64=1 -DVGO_linux=1 -DVGP_mips64_linux=1 -DVGPV_mips64_linux_vanilla=1 -DVGABI_64 -I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"mips64-linux\"" -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wold-style-declaration -finline-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin -march=octeon2 -mabi=64 -MT libnolto_coregrind_mips64_linux_a-m_main.o -MD -MP -MF .deps/libnolto_coregrind_mips64_linux_a-m_main.Tpo -c -o libnolto_coregrind_mips64_linux_a-m_main.o test -f 'm_main.c' || echo './'m_main.c m_main.c:2885:1: error: expected declaration specifiers or ‘...’ before string constant Makefile:8044: recipe for target 'libnolto_coregrind_mips64_linux_a-m_main.o' failed make[3]: * [libnolto_coregrind_mips64_linux_a-m_main.o] Error 1 make[3]: Leaving directory '/home/ankit/Desktop/valgrind/valgrind-3.15.0/coregrind' Makefile:1914: recipe for target 'all' failed make[2]: [all] Error 2 make[2]: Leaving directory '/home/ankit/Desktop/valgrind/valgrind-3.15.0/coregrind' Makefile:841: recipe for target 'all-recursive' failed make[1]: [all-recursive] Error 1 make[1]: Leaving directory '/home/ankit/Desktop/valgrind/valgrind-3.15.0' Makefile:710: recipe for target 'all' failed make: * [all] Error 2

1

1 Answers

1
votes

Procedure to build Valgrind binary for MIPS Architecture

wget https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2

  • Extract the tarball

tar -xvf valgrind-3.15.0.tar.bz2

  • On Bash prompt export below makefile defines
CC=/opt/CAVIUMsdk312/OCTEON-SDK/tools/bin/mips64-octeon-linux-gnu-gcc
CXX=/opt/CAVIUMsdk312/OCTEON-SDK/tools/bin/mips64-octeon-linux-gnu-g++
./configure --host=mips64-octeon-linux --target=mips64-octeon-linux
CFLAGS=" -march=octeon2 -mabi=64"
  • After configure is successfully executed do make in the directory

make​

  • To run Valgrind on target follow the below procedure
 Copy the valgrind folder to target machine, Ex: /etc/user/
 cd /etc/user/valgrind-3.15.0
 touch /etc/user/valgrind-3.15.0/memcheck/default.supp
 export VALGRIND_LIB=$PWD/memcheck/
 export LD_LIBRARY_PATH=/usr/sbin/user/sharedobj/
 ./coregrind/valgrind --tool=memcheck --gen-suppressions=yes --leak-check=full -v 
 --track-origins=yes <Daemon>​