Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8346987

[lto] gtest build fails

XMLWordPrintable

    • x86_64
    • linux

      When building with link time optimization (lto) , configure flag is --enable-jvm-feature-link-time-opt , we run in the gtest build into a lot of errors.
      One workaround is just to configure / build without gtest ; other would be not to use the lto build flags for gtest , just for the "normal" libjvm.so .


      Some of the errors :
      test/hotspot/gtest/logging/test_asynclog.cpp:272: error: undefined reference to 'testing::internal::GetCapturedStdout[abi:cxx11]()'
      test/hotspot/gtest/logging/test_asynclog.cpp:257: error: undefined reference to 'testing::internal::CaptureStdout()'
      test/hotspot/gtest/logging/test_asynclog.cpp:301: error: undefined reference to 'testing::internal::GetCapturedStderr[abi:cxx11]()'
      test/hotspot/gtest/logging/test_asynclog.cpp:286: error: undefined reference to 'testing::internal::CaptureStderr()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:290: error: undefined reference to 'testing::internal::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:290: error: undefined reference to 'testing::internal::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::ostream*)'
      test/hotspot/gtest/logging/test_asynclog.cpp:191: error: undefined reference to 'testing::internal::CmpHelperSTREQ(char const*, char const*, char const*, char const*)'
      test/hotspot/gtest/logging/test_asynclog.cpp:201: error: undefined reference to 'testing::internal::CmpHelperSTREQ(char const*, char const*, char const*, char const*)'
      test/hotspot/gtest/logging/test_asynclog.cpp:215: error: undefined reference to 'testing::internal::CmpHelperSTREQ(char const*, char const*, char const*, char const*)'
      test/hotspot/gtest/logging/test_asynclog.cpp:228: error: undefined reference to 'testing::internal::CmpHelperSTREQ(char const*, char const*, char const*, char const*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasFatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasFatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasFatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasNonfatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasNonfatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasNonfatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasFatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest.h:284: error: undefined reference to 'testing::Test::HasNonfatalFailure()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::IsTrue(bool)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::GTestLog::~GTestLog()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::IsTrue(bool)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:245: error: undefined reference to 'testing::internal::GTestLog::~GTestLog()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:251: error: undefined reference to 'testing::internal::IsTrue(bool)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-matchers.h:251: error: undefined reference to 'testing::internal::IsTrue(bool)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:661: error: undefined reference to 'testing::internal::PrintStringTo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:661: error: undefined reference to 'testing::internal::PrintStringTo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)'
      /usr/local/gxx_include/bits/shared_ptr_base.h:348: error: undefined reference to 'testing::internal::RE::~RE()'
      /usr/local/gxx_include/bits/shared_ptr_base.h:348: error: undefined reference to 'testing::internal::RE::~RE()'
      /usr/local/gxx_include/bits/shared_ptr_base.h:348: error: undefined reference to 'testing::internal::RE::~RE()'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:986: error: undefined reference to 'testing::internal::RE::FullMatch(char const*, testing::internal::RE const&)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:989: error: undefined reference to 'testing::internal::RE::PartialMatch(char const*, testing::internal::RE const&)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:986: error: undefined reference to 'testing::internal::RE::FullMatch(char const*, testing::internal::RE const&)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:989: error: undefined reference to 'testing::internal::RE::PartialMatch(char const*, testing::internal::RE const&)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:808: error: undefined reference to 'testing::internal::PrintTo(char const*, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:290: error: undefined reference to 'testing::internal::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:290: error: undefined reference to 'testing::internal::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:973: error: undefined reference to 'testing::internal::RE::Init(char const*)'
      /usr/local/gxx_include/bits/shared_ptr_base.h:348: error: undefined reference to 'testing::internal::RE::~RE()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:72: error: undefined reference to 'testing::internal::AlwaysTrue()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:72: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:72: error: undefined reference to 'testing::internal::AlwaysTrue()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:72: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::~HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:78: error: undefined reference to 'testing::internal::AlwaysTrue()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:78: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:78: error: undefined reference to 'testing::internal::AlwaysTrue()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:78: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::~HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:72: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::~HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:78: error: undefined reference to 'testing::internal::HasNewFatalFailureHelper::~HasNewFatalFailureHelper()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:183: error: undefined reference to 'testing::internal::DeathTest::Create(char const*, testing::Matcher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, char const*, int, testing::internal::DeathTest**)'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:183: error: undefined reference to 'testing::ExitedWithCode::ExitedWithCode(int)'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:183: error: undefined reference to 'testing::ExitedWithCode::operator()(int) const'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:183: error: undefined reference to 'testing::internal::DeathTest::LastMessage()'
      test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp:183: error: undefined reference to 'testing::FLAGS_gtest_throw_on_failure'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:661: error: undefined reference to 'testing::internal::PrintStringTo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/gtest-printers.h:661: error: undefined reference to 'testing::internal::PrintStringTo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::ostream*)'
      /mytools/gtest/googletest-1.14.0/googletest/include/gtest/internal/gtest-port.h:973: error: undefined reference to 'testing::internal::RE::Init(char const*)'
      test/hotspot/gtest/gc/g1/test_freeRegionList.cpp:38: error: undefined reference to 'testing::internal::DeathTest::Create(char const*, testing::Matcher<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, char const*, int, testing::internal::DeathTest**)'
      test/hotspot/gtest/gc/g1/test_freeRegionList.cpp:38: error: undefined reference to 'testing::ExitedWithCode::ExitedWithCode(int)'
      test/hotspot/gtest/gc/g1/test_freeRegionList.cpp:38: error: undefined reference to 'testing::ExitedWithCode::operator()(int) const'
      test/hotspot/gtest/gc/g1/test_freeRegionList.cpp:38: error: undefined reference to 'testing::internal::DeathTest::LastMessage()'
      test/hotspot/gtest/gc/g1/test_freeRegionList.cpp:38: error: undefined reference to 'testing::FLAGS_gtest_throw_on_failure'
      In function 'vsnprintf',
          inlined from 'jio_vsnprintf' at /myjdkdir/jdk/src/hotspot/share/prims/jvm.cpp:2726:29,
          inlined from '__ct_base ' at /myjdkdir/jdk/src/hotspot/share/utilities/formatBuffer.hpp:77:16:
      /myjdkdir/jdk/src/hotspot/share/runtime/os.cpp:121:3: warning: call to 'vsnprintf' declared with attribute warning: use os::vsnprintf [-Wattribute-warning]
        121 | ALLOW_C_FUNCTION(::vsnprintf, int result = ::vsnprintf(buf, len, fmt, args);)
            | ^
      In function 'exit',
          inlined from 'vm_direct_exit' at /myjdkdir/jdk/src/hotspot/share/runtime/java.cpp:583:11,
          inlined from 'unrecoverable_writing_error' at /myjdkdir/jdk/src/hotspot/share/cds/metaspaceShared.cpp:1071:17,
          inlined from '__dt_base ' at /myjdkdir/jdk/src/hotspot/share/cds/cdsHeapVerifier.cpp:147:49,
          inlined from 'verify' at /myjdkdir/jdk/src/hotspot/share/cds/cdsHeapVerifier.cpp:385:1:
      /myjdkdir/jdk/src/hotspot/os/posix/os_posix.cpp:933:3: warning: call to 'exit' declared with attribute warning: use os::exit [-Wattribute-warning]
        933 | ALLOW_C_FUNCTION(::exit, ::exit(num);)
            | ^
      In function 'vsnprintf',
          inlined from 'push_va' at /myjdkdir/jdk/src/hotspot/share/ci/ciEnv.cpp:221:18,
          inlined from '__ct_base ' at /myjdkdir/jdk/src/hotspot/share/ci/ciEnv.cpp:232:12:
      /myjdkdir/jdk/src/hotspot/share/runtime/os.cpp:121:3: warning: call to 'vsnprintf' declared with attribute warning: use os::vsnprintf [-Wattribute-warning]
        121 | ALLOW_C_FUNCTION(::vsnprintf, int result = ::vsnprintf(buf, len, fmt, args);)
            |

            Unassigned Unassigned
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: