2010年7月20日 星期二

ubench make error: ‘CLK_TCK’ undeclared (first use in this function)

ubench 硬體效能測試的小程式 make 時會發生以下錯誤的解法
cpubench.c:93: error: 『CLK_TCK』 undeclared (first use in this function) 
cpubench.c:93: error: (Each undeclared identifier is reported only once
cpubench.c:93: error: for each function it appears in.)

將以下存成 ubench-patch
--- membench.c.old 2008-05-18 21:21:02.000000000 +0800
+++ membench.c 2008-05-18 21:38:20.000000000 +0800
@@ -23,6 +23,7 @@
 #define MAX_CHILDS 128
 #define MUFSIZE  1024
 
+#include <bits/time.h>
 #include <sys/types.h>
 #include <sys/times.h>
 #include <stdio.h>
--- cpubench.c.old 2008-05-18 21:21:06.000000000 +0800
+++ cpubench.c 2008-05-18 21:38:16.000000000 +0800
@@ -22,6 +22,7 @@
 #define CPUREFSCORE 50190
 #define MAX_CHILDS 128
 
+#include <bits/time.h>
 #include <sys/types.h>
 #include <sys/times.h>
 #include <stdio.h>
--- configure.old 2008-05-18 21:39:14.000000000 +0800
+++ configure 2008-05-18 21:39:42.000000000 +0800
@@ -24,7 +24,7 @@
  i486)
 cat <<! >> Makefile
 CC = gcc
-CFLAGS = -O2 -m486 -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fomit-frame-pointer
+CFLAGS = -O2 -m486 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fomit-frame-pointer
 LDFLAGS = -s -lm
 INCLUDES = -I.
 
@@ -33,7 +33,7 @@
  i586)
 cat <<! >> Makefile
 CC = gcc
-CFLAGS = -O2 -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fomit-frame-pointer
+CFLAGS = -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fomit-frame-pointer
 LDFLAGS = -s -lm
 INCLUDES = -I.
 
@@ -42,7 +42,7 @@
  i686)
 cat <<! >> Makefile
 CC = gcc
-CFLAGS = -O2 -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fomit-frame-pointer
+CFLAGS = -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fomit-frame-pointer
 LDFLAGS = -s -lm
 INCLUDES = -I.
 
@@ -51,7 +51,7 @@
  *)
 cat <<! >> Makefile
 CC = gcc
-CFLAGS = -O2 -Wall -malign-loops=2 -malign-jumps=2 -malign-functions=2
+CFLAGS = -O2 -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2
 LDFLAGS = -s -lm
 INCLUDES = -I.
 

放於 ubench-0.32 目錄下
patch -p0 < ubench-patch
./configure
make
解法來源

沒有留言:

張貼留言