[原]解决ubench安装失败问题
解决ubench安装失败问题
2011-12-21 13:42
想使用ubench测试CPU,但是一直安装存在问题。后查阅资料,请教群友及同事,最终解决。记录如下:
==== Creating Makefile for Linux x86_64
==== Now type make to compile ubench for Linux
testcloud@computer9:~/Test/Ubench_1221/ubench-0.32$ make
gcc -O2 -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2 -I. -c cpubench.c
cpubench.c:1:0: warning: -malign-loops is obsolete, use -falign-loops [enabled by default]
cpubench.c:1:0: warning: -malign-jumps is obsolete, use -falign-jumps [enabled by default]
cpubench.c:1:0: warning: -malign-functions is obsolete, use -falign-functions [enabled by default]
cpubench.c: In function ?.pucalc?.
cpubench.c:72:2: warning: implicit declaration of function ?.bs?.[-Wimplicit-function-declaration]
cpubench.c: In function ?.puload?.
cpubench.c:93:59: error: ?.LK_TCK?.undeclared (first use in this function)
cpubench.c:93:59: note: each undeclared identifier is reported only once for each function it appears in
cpubench.c: In function ?.pubench?.
cpubench.c:136:9: warning: implicit declaration of function ?.xit?.[-Wimplicit-function-declaration]
cpubench.c:136:22: warning: incompatible implicit declaration of built-in function ?.xit?.[enabled by default]
cpubench.c:195:50: warning: incompatible implicit declaration of built-in function ?.xit?.[enabled by default]
make: *** [cpubench.o] Error 11.参考http://www.extmail.org/forum/thread-7882-1-4.html安装并打上了patch,但是问题没有解决,make时候又出错。
testcloud@computer9:~/Test/Ubench_1221/ubench-0.32$ patch -p0 < /home/testcloud/Test/Ubench_1221/ubench-patch
patching file membench.c
patching file cpubench.c
patching file configuretestcloud@computer9:~/Test/Ubench_1221/ubench-0.32$ ./configure
==== Creating Makefile for Linux x86_64
==== Now type make to compile ubench for Linux
testcloud@computer9:~/Test/Ubench_1221/ubench-0.32$ make
gcc -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -I. -c cpubench.c
cpubench.c: In function ?.pucalc?.
cpubench.c:73:2: warning: implicit declaration of function ?.bs?.[-Wimplicit-function-declaration]
cpubench.c: In function ?.pubench?.
cpubench.c:137:9: warning: implicit declaration of function ?.xit?.[-Wimplicit-function-declaration]
cpubench.c:137:22: warning: incompatible implicit declaration of built-in function ?.xit?.[enabled by default]
cpubench.c:196:50: warning: incompatible implicit declaration of built-in function ?.xit?.[enabled by default]
gcc -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -I. -c membench.c
gcc -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -I. -c ubench.c
gcc -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -s -lm -o ubench signals.o cpubench.o membench.o ubench.o
cpubench.o: In function `cpucalc':
cpubench.c:(.text+0x7f): undefined reference to `log'
cpubench.c:(.text+0xd5): undefined reference to `atan'
cpubench.c:(.text+0xda): undefined reference to `cos'
cpubench.c:(.text+0x101): undefined reference to `atan'
cpubench.c:(.text+0x106): undefined reference to `sin'
cpubench.c:(.text+0x181): undefined reference to `pow'
cpubench.c:(.text+0x1af): undefined reference to `exp'
cpubench.c:(.text+0x22f): undefined reference to `pow'
cpubench.c:(.text+0x23e): undefined reference to `sqrt'
collect2: ld returned 1 exit status
make: *** [ubench] Error 1
2.修改或者检查Makefile:
其中第14,15行:
另外第22行:
$(CC) $(CFLAGS) -o $@ $(objects) $(LDFLAGS)
然后重新make:
3.修改cpubench.c
第28行增加头文件:#include <stdio.h>
检查第74行:
4.执行:gcc -o ubench signals.o cpubench.o membench.o ubench.o -lm
5.检查makefile,并重新编译:
运行./ubench之后得出结果如下:
完成。
![](http://files.cnblogs.com/files/haochuang/alipay-RedEnvelopes.bmp)
赠人玫瑰
手留余香
我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的