2 code777ing code777ing 于 2015.07.03 12:39 提问

osx下编译hadoop-2.5.2-src出错
 [exec] /pein/hadoop/hadoop-2.5.2-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/vecsum.c:61:9: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
 [exec]     if (clock_gettime(CLOCK_MONOTONIC, &watch->start)) {
 [exec]         ^
 [exec] /pein/hadoop/hadoop-2.5.2-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/vecsum.c:61:23: error: use of undeclared identifier 'CLOCK_MONOTONIC'
 [exec]     if (clock_gettime(CLOCK_MONOTONIC, &watch->start)) {
 [exec]                       ^
 [exec] /pein/hadoop/hadoop-2.5.2-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/vecsum.c:79:23: error: use of undeclared identifier 'CLOCK_MONOTONIC'
 [exec]     if (clock_gettime(CLOCK_MONOTONIC, &watch->stop)) {
 [exec]                       ^
 [exec] 1 warning and 2 errors generated.
 [exec] make[2]: *** [CMakeFiles/test_libhdfs_vecsum.dir/main/native/libhdfs/test/vecsum.c.o] Error 1
 [exec] make[1]: *** [CMakeFiles/test_libhdfs_vecsum.dir/all] Error 2
 [exec] make: *** [all] Error 2

1个回答

oyljerry
oyljerry   Ds   Rxr 2015.07.13 13:06

MAC 上找不到定义。

If you use CLOCK_REALTIME or CLOCK_MONOTONIC, you should also define these:

 #define CLOCK_REALTIME 0 
#define CLOCK_MONOTONIC 0
Csdn user default icon
上传中...
上传图片
插入图片