Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump Boost from dependencies #4158

Closed
5 tasks done
lgritz opened this issue Feb 19, 2024 · 1 comment · Fixed by #4233
Closed
5 tasks done

Dump Boost from dependencies #4158

lgritz opened this issue Feb 19, 2024 · 1 comment · Fixed by #4233
Labels
build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration. help wanted A task that is desired, but needs somebody to commit the effort to implement it. internals Internal changes, not public APIs roadmap This is a priority item on the roadmap for the next major release.

Comments

@lgritz
Copy link
Collaborator

lgritz commented Feb 19, 2024

Boost used to be much more important to us, but over the years, most of the things we needed from boost have migrated to the C++11, 14, or 17 standard libraries. In more modern times, Boost is a very heavyweight dependency which causes a disproportionate amount of build pain, considering how very little of it we use. We don't use any boost classes in our public APIs, so removing legacy boost use is purely about internals and won't affect users at all. It's primarily a concern to people building OIIO, who have to make sure they have acceptable boost versions built as well. I think we can easily replace the very few remaining uses with alternatives and remove the Boost dependency entirely. They remaining uses are:

boost::filesystem

This is only used in filesystem.cpp, and only for C++14 builds (when using a C++17-capable compiler, we already automatically switch to using std::filesystem. So there is no real work to be done here, it will be part of the bump o C++17 minimum. I'm just listing it to be complete.

boost::thread_specific_ptr

This is used in several places. I wish there were a robust, single-header, dependency-free implementation of this were around and with a compatible license, but I haven't been able to find it. Maybe it's out there and somebody else can find it? Maybe just the parts we need can be extracted from Boost or some other large library that has the equivalent? Maybe since we use it in such a narrow way, we can just write our own minimal implementation?

Note that although this looks similar in spirit to C++ thread_local, it's different because thread_local must be of static scope, and we need something that can be a class member.

boost::container::flat_map and flat_set

This will eventually be in C++23, but we're nowhere near being able to assume that's available. But I believe there are several acceptable single-header implementations that we could use which exactly emulate what will be in C++23 but work with older C++ versions. Or, possibly, just write it ourselves since we probably only use a tiny fraction of the features that will be in the std version.

boost::algorithm functions: ifind_first, ifind_last, to_upper, to_lower

These are not really difficult to rewrite from scratch ourselves. Somebody just needs to do it.

boost::stacktrace

This is only used in sysutil.cpp. This will be eventually replaced by C++23 std::stacktrace, but that's too far away for us to rely on now. However, I bet that (like all other C++ future library classes) there are multiple adequate implementations out there that we can use with older C++. Maybe somebody reading this already has their favourite to recommend.

That's it! Those are the only boost artifacts we have left in the code base. It feels totally doable.

Tasks

@lgritz lgritz added internals Internal changes, not public APIs build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration. help wanted A task that is desired, but needs somebody to commit the effort to implement it. roadmap This is a priority item on the roadmap for the next major release. labels Feb 19, 2024
lgritz pushed a commit that referenced this issue Mar 11, 2024
Remove boost from `Strutil`. Use existing mechanisms and STL features
instead.

Partially addresses #4158

Signed-off-by: Jesse Yurkovich <jesse.y@gmail.com>
@lgritz
Copy link
Collaborator Author

lgritz commented Mar 11, 2024

boost::algorithm eliminated by #4181

lgritz pushed a commit that referenced this issue Apr 10, 2024
…set (#4191)

A tiny bit more progress towards #4158.

None of the code was actually dependent on the fact that these
containers are sorted by key. Switching to the robin containers instead
removes one less use of boost in the project.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
lgritz pushed a commit to lgritz/OpenImageIO that referenced this issue Apr 13, 2024
…set (AcademySoftwareFoundation#4191)

A tiny bit more progress towards AcademySoftwareFoundation#4158.

None of the code was actually dependent on the fact that these
containers are sorted by key. Switching to the robin containers instead
removes one less use of boost in the project.

Signed-off-by: Chris Kulla <ckulla@gmail.com>
lgritz added a commit that referenced this issue Apr 15, 2024
As Marie Kondo would say, Boost no longer sparks joy for us, so we take
one last look, thank it for its many years of service to our project,
and then send it on its way.

Fixes #4158

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build / testing / port / CI Affecting the build system, tests, platform support, porting, or continuous integration. help wanted A task that is desired, but needs somebody to commit the effort to implement it. internals Internal changes, not public APIs roadmap This is a priority item on the roadmap for the next major release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant