Search code examples
c++cmakeosx-yosemitecppunit

CMake Linker Error with CppUnit OS X 10.10


I'm having an issue with my CMake environment. My team uses CppUnit, however our test build has been failing ever since upgrading to OS X 10.10 (Yosemite) This build works on Linux machines and OS X Mavericks. We are at a loss as to why it is not working.

Our CMakeLists.txt can be found here: https://gist.github.com/VikomMedia/802fb41a411dd2f7358e

...
Linking CXX executable sailbot_test
Undefined symbols for architecture x86_64:
  "SailingLogicTest::testShouldBeat()", referenced from:
      SailingLogicTest::addTestsToSuite(CppUnit::TestSuiteBuilderContextBase&) in SailingLogicTest.cpp.o
  "SailingLogicTest::testIsThereChangeToAWA()", referenced from:
      SailingLogicTest::addTestsToSuite(CppUnit::TestSuiteBuilderContextBase&) in SailingLogicTest.cpp.o
  "SailingLogicTest::testCanReachDestWithoutTack()", referenced from:
      SailingLogicTest::addTestsToSuite(CppUnit::TestSuiteBuilderContextBase&) in SailingLogicTest.cpp.o
  "SailingLogicTest::testIsThereChangeToAWAorBearing()", referenced from:
      SailingLogicTest::addTestsToSuite(CppUnit::TestSuiteBuilderContextBase&) in SailingLogicTest.cpp.o
  "CppUnit::SourceLine::SourceLine(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
      SailingLogicTest::testArrivedAtDest() in SailingLogicTest.cpp.o
      SailingLogicTest::testGetBearing() in SailingLogicTest.cpp.o
...

The full log can be found here: https://gist.github.com/VikomMedia/71ee83dcd6f7b538a343

The result is identical with -stdlib=libc++ and -stdlib=libstdc++

Thank you very much.


Solution

  • We were able to solve the issue by changing the compiler to G++ on OS X 10.10 machines. clang++ was not working, the reason is unknown at this time.