openigtlink / OpenIGTLink

Free, open-source network communication library for image-guided therapy
http://openigtlink.org
BSD 3-Clause "New" or "Revised" License
102 stars 184 forks source link

Master branch failed to build test files on Ubuntu 18.04 #220

Closed mli0603 closed 4 years ago

mli0603 commented 4 years ago

Using the command

cmake -DBUILD_SHARED_LIBS:BOOL=ON ../OpenIGTLink
make

will fail the build due to error

~/igtl/OpenIGTLink/Testing/igtlCommandMessageTest.cxx:95:3: error: ‘EXPECT_NE’ was not declared in this scope
   EXPECT_NE(messageHeader->crc, crc); // should not be equal as the content changed
   ^~~~~~~~~
~/igtl/OpenIGTLink/Testing/igtlCommandMessageTest.cxx:95:3: note: suggested alternative: ‘EXPECT_LT’
   EXPECT_NE(messageHeader->crc, crc); // should not be equal as the content changed
   ^~~~~~~~~
   EXPECT_LT
~/igtl/OpenIGTLink/Testing/igtlCommandMessageTest.cxx: In member function ‘virtual void CommandMessageTest_UnpackFormatVersion2_Test::Run()’:
~/igtl/OpenIGTLink/Testing/igtlCommandMessageTest.cxx:186:3: error: ‘EXPECT_NE’ was not declared in this scope
   EXPECT_NE(messageHeader->crc, crc); // should not be equal as the content changed
   ^~~~~~~~~
~/igtl/OpenIGTLink/Testing/igtlCommandMessageTest.cxx:186:3: note: suggested alternative: ‘EXPECT_LT’
   EXPECT_NE(messageHeader->crc, crc); // should not be equal as the content changed
   ^~~~~~~~~
   EXPECT_LT

This indicates there is something imcompatible with the current gtest. I had to turn off the flag BUILD_TESTING to compile the project.

I tried to turn off the flag BUILD_SHARED_LIBS, and the build proceeds without error. What is the issue exactly?

leochan2009 commented 4 years ago

HI,

shared build of google test library tend to fail under windows environment. when shared_build is turn on, we use a local file igtlTestConfig.h.in for testing marcos. As for the commandmessage test, EXPECT_NE is not defined in the igtlTestConfig.h.in. you can see this issue for more details: https://github.com/openigtlink/OpenIGTLink/issues/122

leochan2009 commented 4 years ago

The fix should work.