leetmaa / KMCLib

A kinetic Monte Carlo Python/C++ library.
GNU General Public License v3.0
119 stars 49 forks source link

Compilation Error for make test.x on Ubuntu 18.04 #26

Open XelaleX1 opened 3 years ago

XelaleX1 commented 3 years ago

Hi, I have tried to compile the module on Ubuntu 18.04, using gcc, g++ and mpicxx. All seems to be fine, until I try to run the test.

Indeed, by typing make test.x in the c++/build directory, I get the following error:

/home/xelad/KMCLib-2.0-a1/c++/unittest/test_interactions.cpp:146:25: error: the compiler can assume that the address of 'rc' will never be NULL [-Werror=address] CPPUNIT_ASSERT( &rc != NULL ); ^ /home/xelad/KMCLib-2.0-a1/c++/externals/include/cppunit/TestAssert.h:131:37: note: in definition of macro 'CPPUNIT_ASSERT' ( CPPUNIT_NS::Asserter::failIf( !(condition), \ ^~~~~~~~~ cc1plus: all warnings being treated as errors unittest/CMakeFiles/unittest.dir/build.make:185: recipe for target 'unittest/CMakeFiles/unittest.dir/test_interactions.cpp.o' failed make[3]: *** [unittest/CMakeFiles/unittest.dir/test_interactions.cpp.o] Error 1 make[3]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' CMakeFiles/Makefile2:233: recipe for target 'unittest/CMakeFiles/unittest.dir/all' failed make[2]: *** [unittest/CMakeFiles/unittest.dir/all] Error 2 make[2]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' CMakeFiles/Makefile2:208: recipe for target 'unittest/CMakeFiles/test.x.dir/rule' failed make[1]: *** [unittest/CMakeFiles/test.x.dir/rule] Error 2 make[1]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' Makefile:193: recipe for target 'test.x' failed make: *** [test.x] Error 2

I have read the known issue and I have found that you suggested to comment the line "CPPUNIT_ASSERT( &rc != NULL );"

However, by doing that, I got another error:

/home/xelad/KMCLib-2.0-a1/c++/unittest/test_interactions.cpp:145:28: error: unused variable 'rc' [-Werror=unused-variable] const RateCalculator & rc = interactions.rateCalculator(); ^~ cc1plus: all warnings being treated as errors unittest/CMakeFiles/unittest.dir/build.make:185: recipe for target 'unittest/CMakeFiles/unittest.dir/test_interactions.cpp.o' failed make[3]: *** [unittest/CMakeFiles/unittest.dir/test_interactions.cpp.o] Error 1 make[3]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' CMakeFiles/Makefile2:233: recipe for target 'unittest/CMakeFiles/unittest.dir/all' failed make[2]: *** [unittest/CMakeFiles/unittest.dir/all] Error 2 make[2]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' CMakeFiles/Makefile2:208: recipe for target 'unittest/CMakeFiles/test.x.dir/rule' failed make[1]: *** [unittest/CMakeFiles/test.x.dir/rule] Error 2 make[1]: Leaving directory '/home/xelad/KMCLib-2.0-a1/c++/build' Makefile:193: recipe for target 'test.x' failed make: *** [test.x] Error 2

Can you please suggest me how to solve this?

zyzhang827 commented 2 years ago

Hello,

Have you solved your problem?

I have the same problem,and I make the following changes to run the make text.x command

// Query for the rate calculator.
const RateCalculator  rc = interactions.rateCalculator();
// CPPUNIT_ASSERT( &rc != NULL );