google / google/googletest

1.10.0: undefined reference to `typeinfo for google::LogSink'

Open
#3,385 5 comments 0 reactions 1 assignee Claimed by @derekmauro View on GitHub
bug More Information Requested
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

I'm trying to compile ceres-solver 2.0.0 test suite against shared googletest library and bui.d fails with:
```console
[ 61%] Linking CXX executable ../../bin/levenberg_marquardt_strategy_test
cd /home/tkloczko/rpmbuild/BUILD/ceres-solver-2.0.0/x86_64-redhat-linux-gnu/internal/ceres && /usr/bin/cmake -E cmake_link_script CMakeFiles/levenberg_marquardt_strategy_test.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wmissing-declarations -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -DNDEBUG -Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin CMakeFiles/levenberg_marquardt_strategy_test.dir/levenberg_marquardt_strategy_test.cc.o -o ../../bin/levenberg_marquardt_strategy_test -Wl,-rpath,/home/tkloczko/rpmbuild/BUILD/ceres-solver-2.0.0/x86_64-redhat-linux-gnu/lib ../../lib/libtest_util.so ../../lib/libceres.so.2.0.0 ../../lib/libgtest.so /usr/lib64/libgflags.so.2.2.2 -lpthread /usr/lib64/libglog.so
/usr/bin/ld: /tmp/ccqko3xE.lto.o:(.data.rel.ro._ZTIN7testing13ScopedMockLogE+0x10): undefined reference to `typeinfo for google::LogSink'
collect2: error: ld returned 1 exit status
```
googletest is compiled without LTO.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.