2

I'm trying to update an application to be built with C++20. The application compiles fine with "-std=c++20" but if I change it to "-std=gnu++20" then I'm getting linker errors. The linker errors are a few missing symbols in my application provided by static libraries.

I work on a large application and the missing symbols are in parts of the application that I don't know at all. I can find where the source files exist but not the path from source file to the executable. I venture there's at least two static libraries involved (file.cc is in file.a which is in file.b ...). I tried using "nm -a" to determine which library the symbol is coming from so I can compare to the c++20 build but haven't found the right options yet. We're using boost::build and I tried running with "-d2" as well but it's not been of much help.

How can I debug the problem?

dromodel
  • 9,581
  • 12
  • 47
  • 65
  • 2
    The demangled symbol may already help to understand where the issue is. – user17732522 Mar 15 '22 at 18:01
  • 5
    A [mcve] would be nice. – HolyBlackCat Mar 15 '22 at 18:04
  • I like the question a lot, and I'd hope for the eventual solution to be available on [SO]. But as it stands I'll probably vote to close unless more details get added in the near future. – sehe Mar 15 '22 at 19:58
  • I'd like one too but then I could probably debug it myself. As it stands, in a large application only a few symbols are missing. I was hoping someone knew about differences between them that affects linking which could offer some insight (and help create such an example). – dromodel Mar 15 '22 at 21:26
  • You could maybe start with whether `__STRICT_ANSI__` is the relevant effect of the `-std=c++20` flag, e.g. by using `-std=gnu++20 -D__STRICT_ANSI__` or `-std=c++20 -U__STRICT_ANSI__`. (I am not sure that one is supposed to define this manually, but just for debug testing.) – user17732522 Mar 15 '22 at 22:34
  • Seems it was due to a build system problem, mixing binaries from different standards. It implies that C++20 ABI is not fully compatible with older standards. – dromodel Mar 16 '22 at 00:14
  • Nor is it expected that they would be. https://stackoverflow.com/a/67844737/1587755 – Taekahn Mar 16 '22 at 17:11
  • Your comment doesn't apply here @Taekahn, as the GCC version is constant. Only the C++ standard is changing. – dromodel Mar 16 '22 at 22:05
  • @dromodel C++ not having a stable abi seems to apply to a question about C++ not having a stable abi to me, but to each their own. – Taekahn Mar 16 '22 at 22:07

0 Answers0