0

I have a native library that uses spdlog for internal logging.

The library is compiled as shared library and the results .so files are then used in an Android project which has its own JNI and native c++ code which also uses spdlog.

The first time a call to spdlog is made, we experience a SIGSEGV from it. After some research we found that since spdlog is a header-only library it may cause issues when using it this way, so we changed to using it as a static library inside the native library.

This seems to solve the issue but now we get the SIGSEGV on the first call to spdlog from the application's native code.

Are there any limitations or issues with using spdlog this way, specifically in an Android project? Any suggestions on debugging the issue?

If any code can be helpful, let me know what is needed and I'll update the question

Edit

Also, it's worth noting that it only happens when the native library is built in Release mode. In Debug everything works as expected

La bla bla
  • 8,558
  • 13
  • 60
  • 109
  • *so we changed to using it as a static library inside the native library.* -- Did `spdlog` have instructions on doing this, or did you do this on your own? If you did this on your own, you are taking the risk of using `spdlog` in an untested fashion. I bet even the spdlog people don't know what results you may get. – PaulMcKenzie Mar 27 '22 at 15:06
  • `spdlog` is available as a static library for a long time now. (~2019) see here https://github.com/gabime/spdlog/issues/120 and the readme here https://github.com/gabime/spdlog#static-lib-version-recommended---much-faster-compile-times so it is a well tested option. – La bla bla Mar 27 '22 at 15:16

1 Answers1

0

So turns out the solution was just to upgrade to a newer version of spdlog

La bla bla
  • 8,558
  • 13
  • 60
  • 109