nsgminer
nsgminer copied to clipboard
Having difficulty building on windows with "redefinition of 'struct timespec
make ended with 2 errors, using "-DHAVE_STRUCT_TIMESPEC" in the CFLAGS removes the first error but don't think it's the best and it seems i'm missing some corresponding header files somewhere. Can you please point out what i'm doing wrong and please help me fix them, thanks
Make ended with 2 errors.
" CC nsgminer-miner.o In file included from compat.h:32:0, from miner.c:57: c:\mingw\include\pthread.h:320:8: error: redefinition of 'struct timespec' struct timespec { ^ In file included from c:\mingw\include\unistd.h:95:0, from miner.c:29: c:\mingw\include\parts\time.h:65:8: note: originally defined here struct timespec ^ In file included from miner.c:57:0: compat.h:90:19: error: conflicting types for 'nanosleep' static inline int nanosleep(const struct timespec req, struct timespec *rem) ^ In file included from miner.c:29:0: c:\mingw\include\unistd.h:109:5: note: previous definition of 'nanosleep' was h re int nanosleep( const struct timespec *period, struct timespec *residual ) ^ In file included from miner.c:57:0: compat.h:122:19: error: conflicting types for 'sleep' static inline int sleep(unsigned int secs) ^ In file included from miner.c:29:0: c:\mingw\include\unistd.h:142:10: note: previous definition of 'sleep' was here unsigned sleep( unsigned period ){ return __mingw_sleep( period, 0 ); } ^ make[2]: ** [nsgminer-miner.o] Error 1"
https://github.com/ghostlander/nsgminer/blob/7d37508484b7babc363df1534a67c0d8847eee10/compat.h#L89
MinGW64 defines nanosleep() and sleep(), MinGW32 doesn't usually. If your version comes with these, replace MINGW64 with MINGW32 until a universal solution comes up.
I got the same error in Ecliepse Neon IDE and i resolved it by adding '-DHAVE_STRUCT_TIMESPEC' in C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous -> Others flag