Repository: google/glog

Issue #630: symbolize_unittest fails with static library (BUILD_SHARED_LIBS=OFF) and disabled usage of gtest (WITH_GTEST=OFF)
Created: 2021-03-31T18:30:34Z
In current trunk of glog, when building with -DWITH_GTEST=ON:
$ make test
Running tests...
Test project /tmp/glog_build
      Start  1: demangle
 1/10 Test  #1: demangle .........................   Passed    0.00 sec
      Start  2: logging
 2/10 Test  #2: logging ..........................   Passed    1.34 sec
      Start  3: signalhandler
 3/10 Test  #3: signalhandler ....................   Passed    0.00 sec
      Start  4: stacktrace
 4/10 Test  #4: stacktrace .......................   Passed    0.00 sec
      Start  5: stl_logging
 5/10 Test  #5: stl_logging ......................   Passed    0.00 sec
      Start  6: symbolize
 6/10 Test  #6: symbolize ........................   Passed    0.00 sec
      Start  7: cmake_package_config_init
 7/10 Test  #7: cmake_package_config_init ........   Passed    0.02 sec
      Start  8: cmake_package_config_generate
 8/10 Test  #8: cmake_package_config_generate ....   Passed    0.76 sec
      Start  9: cmake_package_config_build
 9/10 Test  #9: cmake_package_config_build .......   Passed    1.03 sec
      Start 10: cmake_package_config_cleanup
10/10 Test #10: cmake_package_config_cleanup .....   Passed    0.01 sec

100% tests passed, 0 tests failed out of 10

Total Test time (real) =   3.19 sec

And with -DWITH_GTEST=OFF:
$ make test
Running tests...
Test project /tmp/glog_build
      Start  1: demangle
 1/10 Test  #1: demangle .........................   Passed    0.01 sec
      Start  2: logging
 2/10 Test  #2: logging ..........................   Passed    1.37 sec
      Start  3: signalhandler
 3/10 Test  #3: signalhandler ....................   Passed    0.00 sec
      Start  4: stacktrace
 4/10 Test  #4: stacktrace .......................   Passed    0.00 sec
      Start  5: stl_logging
 5/10 Test  #5: stl_logging ......................   Passed    0.00 sec
      Start  6: symbolize
 6/10 Test  #6: symbolize ........................Subprocess aborted***Exception:   0.01 sec
      Start  7: cmake_package_config_init
 7/10 Test  #7: cmake_package_config_init ........   Passed    0.03 sec
      Start  8: cmake_package_config_generate
 8/10 Test  #8: cmake_package_config_generate ....   Passed    0.89 sec
      Start  9: cmake_package_config_build
 9/10 Test  #9: cmake_package_config_build .......   Passed    1.09 sec
      Start 10: cmake_package_config_cleanup
10/10 Test #10: cmake_package_config_cleanup .....   Passed    0.02 sec

90% tests passed, 1 tests failed out of 10

Total Test time (real) =   3.44 sec

The following tests FAILED:
          6 - symbolize (Subprocess aborted)
Errors while running CTest
make: *** [Makefile:126: test] Error 8
$ ./symbolize_unittest
F20210331 18:28:41.426044 13463 symbolize_unittest.cc:335] CHECK_STREQ failed: symbol == "non_inline_func" (google::thread_msg_data vs. non_inline_func)
*** Check failure stack trace: ***
    @     0x55bb674a3672  google::LogMessage::Fail()
    @     0x55bb674a3552  google::LogMessage::SendToLog()
    @     0x55bb674a2e1e  google::LogMessage::Flush()
    @     0x55bb674a6baf  google::LogMessageFatal::~LogMessageFatal()
    @     0x55bb6749c437  TestWithPCInsideNonInlineFunction
    @     0x55bb6749c6c6  google::thread_msg_data
    @     0x7f5b407c1e60  __libc_start_main
    @     0x55bb6749ba5a  google::thread_msg_data
Aborted

Duplicate issue #409: Getting `(unknown)` in stacktrace?
Created: 2018-12-19T04:36:29Z
Can someone take a quick look at the report here:
https://stackoverflow.com/q/53844443/1131467
Thanks,
Andrew.

Closing comment (2021-04-09T10:31:40Z): Since we dropped autoconf support, let me reopen the issue.
It seems, the use of TLS exposed a problem in the symbol resolution (related to #630). However, the problem is triggered only when compiling a static library. The suggested workaround implemented in current master (after rc1) is to build a shared library instead.