danni-m / redis-timeseries

Future development of redis-timeseries is at github.com/RedisLabsModules/redis-timeseries.
https://github.com/RedisLabsModules/redis-timeseries
Other
202 stars 30 forks source link

Compilation Issue on MacOS Sierra v10.12.6 #42

Open muthuswamy opened 6 years ago

muthuswamy commented 6 years ago

When I tried to compile on MacOS, I get the following: $make all /Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../RedisModulesSDK/rmutil gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o periodic.o periodic.c periodic.c:34:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration] clock_gettime(CLOCK_REALTIME, &ts); ^ periodic.c:34:19: error: use of undeclared identifier 'CLOCK_REALTIME' clock_gettime(CLOCK_REALTIME, &ts); ^ 1 warning and 1 error generated. make[1]: [periodic.o] Error 1 make: [rmutil] Error 2

How can resolve the issue? Where should I declare CLOCK_REALTIME? The command, $uname -s returns the value as Darwin

Also, I am new to use of redis module. So, appreciate your time to resolve this issue. Thank you,

danni-m commented 6 years ago

This is weird, it works on my mac:

$ make all
/Library/Developer/CommandLineTools/usr/bin/make -C ../RedisModulesSDK/rmutil
make[1]: Nothing to be done for `all'.
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o module.o module.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o tsdb.o tsdb.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o compaction.o compaction.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o rdb.o rdb.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o chunk.o chunk.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o parse_policies.o parse_policies.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
cc -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o config.o config.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
ld -o redis-tsdb-module.so module.o tsdb.o rdb.o compaction.o chunk.o parse_policies.o config.o -bundle -undefined dynamic_lookup  -L../RedisModulesSDK/rmutil -lrmutil -lc
ld: warning: No version-min specified on command line

Also with gcc-7:

 ✘ dannimoiseyev@Dannis-MBP  ~/code/timeseries-rl/src   master ●  CC=gcc-7 make clean all
rm -rf *.xo *.so *.o ./tests_runner
/Library/Developer/CommandLineTools/usr/bin/make -C ../RedisModulesSDK/rmutil
make[1]: Nothing to be done for `all'.
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o module.o module.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o tsdb.o tsdb.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o compaction.o compaction.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o rdb.o rdb.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o chunk.o chunk.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o parse_policies.o parse_policies.c
gcc-7 -I../RedisModulesSDK -Wall -g -fPIC -lc -lm -std=gnu99  -DREDIS_MODULE_TARGET   -c -o config.o config.c
ld -o redis-tsdb-module.so module.o tsdb.o rdb.o compaction.o chunk.o parse_policies.o config.o -bundle -undefined dynamic_lookup  -L../RedisModulesSDK/rmutil -lrmutil -lc
ld: warning: No version-min specified on command line
danni-m commented 6 years ago

image

I don't have access to Sierra machine at the moment, Try to reftech the submodules and use clang instead