boostorg / stacktrace

C++ library for storing and printing backtraces.
https://boost.org/libs/stacktrace
422 stars 70 forks source link

GCC 9.1 build fails on AIX #89

Closed datalogics-robb closed 2 months ago

datalogics-robb commented 4 years ago

I'm getting just one compilation error building boost 1.72.0, in my 64-bit gcc-9.1 build on AIX 7.1. If someone can help me understand the project, I am willing to work on a patch to fix it.

"/opt/freeware/bin/g++"   -fvisibility-inlines-hidden -maix64 -pthread -maix64 -pthread -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden -fPIC -DBOOST_ALL_NO_LIB=1 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=0  -I"." -c -o "/home/robb/.conan/data/boost/1.72.0/_/_/build/a6de355db351101b3ddec9e64cca81842fe8920f/boost/bin.v2/libs/stacktrace/build/gcc-9.1.0/rls/lnk-sttc/thrd-mlt/vsblt-hdn/addr2line.o" "libs/stacktrace/build/../src/addr2line.cpp"

In file included from ./boost/stacktrace/detail/frame_unwind.ipp:18,
                 from libs/stacktrace/build/../src/addr2line.cpp:15:
./boost/stacktrace/detail/location_from_symbol.hpp:25:7: error: 'Dl_info' in namespace '::' does not name a type
   25 |     ::Dl_info dli_;
      |       ^~~~~~~
./boost/stacktrace/detail/location_from_symbol.hpp: In constructor 'boost::stacktrace::detail::location_from_symbol::location_from_symbol(const void*)':
./boost/stacktrace/detail/location_from_symbol.hpp:29:11: error: class 'boost::stacktrace::detail::location_from_symbol' does not have any field named 'dli_'
   29 |         : dli_()
      |           ^~~~
./boost/stacktrace/detail/location_from_symbol.hpp:31:16: error: '::dladdr' has not been declared; did you mean 'addr'?
   31 |         if (!::dladdr(const_cast<void*>(addr), &dli_)) { // `dladdr` on Solaris accepts nonconst addresses
      |                ^~~~~~
      |                addr
./boost/stacktrace/detail/location_from_symbol.hpp:31:49: error: 'dli_' was not declared in this scope
   31 |         if (!::dladdr(const_cast<void*>(addr), &dli_)) { // `dladdr` on Solaris accepts nonconst addresses
      |                                                 ^~~~
./boost/stacktrace/detail/location_from_symbol.hpp: In member function 'bool boost::stacktrace::detail::location_from_symbol::empty() const':
./boost/stacktrace/detail/location_from_symbol.hpp:37:17: error: 'dli_' was not declared in this scope
   37 |         return !dli_.dli_fname;
      |                 ^~~~
./boost/stacktrace/detail/location_from_symbol.hpp: In member function 'const char* boost::stacktrace::detail::location_from_symbol::name() const':
./boost/stacktrace/detail/location_from_symbol.hpp:41:16: error: 'dli_' was not declared in this scope
   41 |         return dli_.dli_fname;
      |                ^~~~
In file included from libs/stacktrace/build/../src/addr2line.cpp:15:
./boost/stacktrace/detail/frame_unwind.ipp: In member function 'std::string boost::stacktrace::frame::name() const':
./boost/stacktrace/detail/frame_unwind.ipp:93:7: error: '::Dl_info' has not been declared
   93 |     ::Dl_info dli;
      |       ^~~~~~~
./boost/stacktrace/detail/frame_unwind.ipp:94:28: error: '::dladdr' has not been declared
   94 |     const bool dl_ok = !!::dladdr(const_cast<void*>(addr_), &dli); // `dladdr` on Solaris accepts nonconst addresses
      |                            ^~~~~~
./boost/stacktrace/detail/frame_unwind.ipp:94:62: error: 'dli' was not declared in this scope
   94 |     const bool dl_ok = !!::dladdr(const_cast<void*>(addr_), &dli); // `dladdr` on Solaris accepts nonconst addresses
      |                                                              ^~~
...failed gcc.compile.c++ /home/robb/.conan/data/boost/1.72.0/_/_/build/a6de355db351101b3ddec9e64cca81842fe8920f/boost/bin.v2/libs/stacktrace/build/gcc-9.1.0/rls/lnk-sttc/thrd-mlt/vsblt-hdn/addr2line.o...
common.copy /home/robb/.conan/data/boost/1.72.0/_/_/package/a6de355db351101b3ddec9e64cca81842fe8920f/include/boost/ratio.hpp
datalogics-robb commented 4 years ago

Looks like the fundamental issue is that this code uses dladdr() which is widely supported, but not on AIX.

https://www.austingroupbugs.net/view.php?id=993

apolukhin commented 3 months ago

Please try a fix from https://github.com/boostorg/stacktrace/pull/114

apolukhin commented 3 months ago

Merged the fix to develop branch, please give it a try

apolukhin commented 2 months ago

Closing as fixed for now.

If the issue appears again, reopen or create a new ticket/PR with information of failure