问题描述
- 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
解决方案
MAC 上找不到定义。
If you use CLOCK_REALTIME or CLOCK_MONOTONIC, you should also define these:
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 0
时间: 2024-11-03 07:56:06