boostorg / stacktrace

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

Standalone version #83

Open ceztko opened 4 years ago

ceztko commented 4 years ago

Is there a standalone version od the library? If no, how easy it would be to strip it from boost just using C++14 standard libraries?

ceztko commented 4 years ago

After the sad news about the rejection for c++20, I think having a standalone version became more urgent. Boost aims to have many libraries inserted in the standard but many simple can't afford to add boost as a dependency or often the burden to add such big (compile time) dependency for just one package is simple not worth, for example in embedded platforms, ios/android development.

apolukhin commented 4 years ago

It's not rejected, it just didn't get on time for C++20. C++23 is the new milestone (and only LWG review remains).

If you want a standalone version - just do it :-) Fork and remove the Boost dependencies. I would provide a link in the Boost docs to the forked standalone version.

eyalroz commented 4 years ago

@apolukhin : Do you think you could make it easier for us by pointing out "hitches" in yanking out the Boost dependencies?

apolukhin commented 4 years ago

Most of the dependencies are in tests. It seems fine to leave tests dependent on Boost, while making the remaining parts of the library standalone.

eyalroz commented 4 years ago

Well, some dependencies are not in tests. For example, in stacktrace.hpp we have:

#include <boost/core/explicit_operator_bool.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/container_hash/hash_fwd.hpp>
eyalroz commented 4 years ago

Actually, there are lots of dependencies in the library includes. I've started working on getting rid of them (and made it easy for me by assuming C++11 or later), but some of that is not trivial (e.g. replacing NOINLINE and FORCE_INLINE, boost::demagle etc.). Then there is the matter of switching from the Boost build system to CMake, to make life more sane - and that also means generating a configuration file using CMake checks, trying to compile the files in build/ from within CMake, and so on.

So, lots and lots of work.

I'm working on this at my fork repo - whoever is interested is welcome to go there and either submit a PR or file an issue.

eyalroz commented 4 years ago

Update: I'm making progress in removing Boost dependencies:

I could really use some help from people with Windows experience.

ceztko commented 4 years ago

What kind of help you need for the Windows part?

eyalroz commented 4 years ago

@ceztko :

  1. Figure out how to extract the minimal relevant part of boost's winapi/ code to meet stacktrace's needs.
  2. Add dependencies and settings in CMakeLists.txt to: 2.1 Correctly choose what gets built on Windows 2.2 Ensure the build on Windows actually passes (or at least - relay bugs to me and correspond about addressing them on the bug page)
  3. Check the small bits of Windows-related code I've introduced (mostly boost-modified/config/platform.hpp) to make sure I haven't missed anything
TomArrow commented 1 year ago

Has anyone ever managed to do this?

eyalroz commented 1 year ago

@TomArrow : Well, a couple of years back, I worked on this:

https://github.com/eyalroz/stacktrace

and it was kinda-working. But I haven't kept it up-to-date. Also, stack traces are going into the standard in C++23, so not a lot of motivation to work on stand-alone just for older code I suppose. Still, you're welcome to try my repo.