isce-framework / isce2

InSAR Scientific Computing Environment version 2
Other
516 stars 253 forks source link

CMAKE compilation error for snaphu time import due to new gcc compiler version (14.1.0). #879

Open SpiderPigzz opened 2 months ago

SpiderPigzz commented 2 months ago

Opening an issue for others who faced the same thing. Unable to run the make command after CMAKE, it stops around 80% due to error caused by time as can be seen below:

home/eos-rs/insarscripts/isce2-code/isce2_wildfly_latest/isce2/contrib/Snaphu/src/snaphu_io.c:1474:5: error: implicit declaration of function 'time' [-Wimplicit-function-declaration]
 1474 |     time(t);
      |     ^~~~
/home/eos-rs/insarscripts/isce2-code/isce2_wildfly_latest/isce2/contrib/Snaphu/src/snaphu_io.c:29:1: note: 'time' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
   28 | #include "snaphu.h"
  +++ |+#include <time.h>
   29 | 
/home/eos-rs/insarscripts/isce2-code/isce2_wildfly_latest/isce2/contrib/Snaphu/src/snaphu_io.c:1475:42: error: implicit declaration of function 'ctime' [-Wimplicit-function-declaration]
 1475 |     fprintf(fp,"# Log file generated %s",ctime(t));
      |                                          ^~~~~
/home/eos-rs/insarscripts/isce2-code/isce2_wildfly_latest/isce2/contrib/Snaphu/src/snaphu_io.c:1475:42: note: 'ctime' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
make[2]: *** [components/contrib/Snaphu/CMakeFiles/snaphu.dir/build.make:132: components/contrib/Snaphu/CMakeFiles/snaphu.dir/src/snaphu_io.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4422: components/contrib/Snaphu/CMakeFiles/snaphu.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Fix is to change the gcc_linux-64 and gxx_linux-64 version to 13.2.0. It treats the error as a warning and the compilation continues smoothly.