一、交叉编译7zip
tar xf p7zip_16.02_src_all.tar.bz2
cd p7zip_16.02/
修改makefile.machine,修改CXX和CC两个变量为交叉编译链的工具。然后make编译,很顺利就可以编译出来。从bin目录拷贝出7za,放到目标板子上运行
进行benmark的方法
./7za b 多核测试
./7za b -mmt1 单核测试
参考
https://linuxhint.com/useful_linux_stress_test_benchmark_cpu_perf/
二、交叉编译sysbench
cd sysbench-1.0.20/
./autogen.sh
./configure --host=arm-hisiv400-linux --without-mysql --disable-shared
先修改一下 third_party/luajit/Makefile.in,把
$(MAKE) -C tmp/luajit \
PREFIX=$(abs_top_builddir)/third_party/luajit \
INSTALL_INC=$(abs_top_builddir)/third_party/luajit/inc \
install
改为
$(MAKE) -C tmp/luajit \
HOST_CC="gcc -m32" CROSS=arm-hisiv400-linux-\
PREFIX=$(abs_top_builddir)/third_party/luajit \
INSTALL_INC=$(abs_top_builddir)/third_party/luajit/inc \
install
否则luajit不会交叉编译,导致最终出现链接错误。而且可能需要安装 apt-get install gcc-multilib,否则gcc在编译-m32的时候会出错
make[3]: Entering directory '/home/3536_cross_src/sysbench-1.0.20/src/tests/threads'
arm-hisiv400-linux-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../../config -I../../../src -I/home/3536_cross_src/sysbench-1.0.20/third_party/luajit/inc -I/home/3536_cross_src/sysbench-1.0.20/third_party/concurrency_kit/include -D_GNU_SOURCE -Wall -Wextra -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align -Wvla -pthread -O2 -funroll-loops -MT libsbthreads_a-sb_threads.o -MD -MP -MF .deps/libsbthreads_a-sb_threads.Tpo -c -o libsbthreads_a-sb_threads.o test -f 'sb_threads.c' || echo './'
sb_threads.c
/tmp/ccVyB68U.s: Assembler messages:
/tmp/ccVyB68U.s:30: Error: selected processor does not support ARM mode ldrex lr,[r2]' /tmp/ccVyB68U.s:30: Error: selected processor does not support ARM mode
strex ip,r0,[r2]'
Makefile:450: recipe for target 'libsbthreads_a-sb_threads.o' failed
进入该子目录,手动编译一下这个文件,加上-march=armv6
如果遇到
Finding suitable compiler........failed [update compiler]
Makefile:517: recipe for target 'lib/libck.a' failed
进入 third_party/concurrency_kit/tmp/ck,去掉CC变量,重新 ./configure --prefix=/home/3536_cross_src/sysbench-1.0.20/third_party/concurrency_kit && make && make install
测试 ./sysbench memory run
参考
https://linuxreviews.org/Memory_benchmarking