[SOLVED] GTest ASSERT_EQ undefined reference on TX1



I originally thought there was an issue determining if two non-numeric types like strings or characters were the same, e.g. ASSERT_EQ(std::string, std::string), ASSERT_EQ(std::char, std::char)), however, I have discovered that this issue extends to int and float types as well if values were typecasted from another type, so it appears that typecasting causes an issue with ASSERT_EQ().

This functionality works fine on x86 platforms, and typecasting non-int/float values to int then testing with ASSERT_EQ() works fine on x86 as well.

Has anyone encountered this issue using GTest ASSERT_EQ on the TX1?

(To see my particular error of interest occur on TX1, clone and ./compile the LibSerial serial communications library: https://github.com/crayzeewulf/libserial.git ).

CMakeFiles/unitTests.dir/LibSerialTest.cpp.o: In function `testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)':
/usr/include/gtest/gtest.h:1337: undefined reference to `testing::internal::EqFailure(char const*, char const*, testing::internal::String const&, testing::internal::String const&, bool)'

Thanks for any advice you might have!



Linuxdev solved this issue. Thank you Linuxdev!

He discovered that there is a mismatch between the GTest1.7.0 that LibSerial downloads and GTest1.6.0 installed via apt-get.

“…headers for gtest are read from system location (”/usr/include"), while the libraries and everything else are downloaded by libserial for linking against…if the system version does not match the downloaded version, then function signatures no longer match and missing symbols appear even though the libraries look like they have the symbols…"

So, the easiest thing to do for the moment is simply to replace the LibSerial top level CMakeLists.txt line 1 with:


and replace lines 60-61 by commenting out what’s there and adding the following:

URL https://github.com/google/googletest/archive/release-1.6.0.tar.gz
URL_HASH SHA1=0169f1a34c42e102a9464b81a1fa6884573c11ac
#URL https://github.com/google/googletest/archive/release-1.7.0.tar.gz
#URL_HASH SHA1=d7aa4b8536f3a007b480cf016be8a4333dbf4768

(If/when GTest is updated to 1.7.0 on the TX1, this will of course need to be undone.)

Thank you linuxdev!!!