Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

Remove Boost.Thread dependency on macOS and require a modern version of AppleClang that supports thread_local #58

Merged
merged 3 commits into from
Mar 11, 2020

Conversation

Toxe
Copy link
Contributor

@Toxe Toxe commented Mar 11, 2020

Hey Roland,

this is a small patch that removes the dependency of Boost.Thread on macOS and relies on having a modern version of AppleClang that supports thread_local.

I recently wanted to install sqlpp11 and sqlpp11-connector-mysql via Vcpkg on macOS and I noticed that the installation would not work and stop with an error if I just executed vcpkg install sqlpp11 sqlpp11-connector-mysql in a fresh and empty Vcpkg directory. This should of course automatically install all dependencies but in the case of sqlpp11-connector-mysql it did not and after looking into the error log I noticed that this also needs Boost.Thread on macOS, which is not listed as a dependency in the Vcpkg control file.

Now, this of course is not your fault. 馃槃

At first I wanted to supply a quick patch to Vcpkg to add Boost.Thread as a dependency for sqlpp11-connector-mysql on macOS but honestly, that is kinda ugly because that would add 50+ other packages that get installed automatically. And all of that for something that is not really needed anymore.

Modern versions of AppleClang since Xcode 8 (from 2016) support thread_local like any other modern compiler so I suggest we drop the reliance on Boost.Thread and simply require AppleClang 8+ on macOS.

In practice this is probably not really an issue since even Xcode 8 that was the first to ship with thread_local support isn't even supported anymore today and I'd wager that almost all macOS users moved on to newer versions of Xcode and macOS. And, well, the few that did not (for whatever reason) could always use a different compiler.

I made a quick test project here (https://github.com/Toxe/cpp-threads) that uses thread_local (in thread_local.cpp) and as you can see here (https://travis-ci.com/github/Toxe/cpp-threads/builds/152702468) this builds fine all the way down to Xcode 8.

I also checked these changes to sqlpp11-connector-mysql from this PR on macOS with Clang 9, GCC 9 and Xcode 11.3 and this builds without a problem.

A modern version of AppleClang (Xcode 8+) that supports thread_local
is now required and Boost.Thread is no longer needed to build on macOS.
@Toxe Toxe mentioned this pull request Mar 11, 2020
@rbock
Copy link
Owner

rbock commented Mar 11, 2020

Hi Tobias,

Nice work! Thanks for cleaning this up. If thread_local is available on MacOS for more than three years by now, that seems totally reasonable :-)

Best,

Roland

@rbock rbock merged commit b94328f into rbock:master Mar 11, 2020
@Toxe
Copy link
Contributor Author

Toxe commented Mar 11, 2020

Hi Roland,

great, thanks for the fast reply! 馃憤

Could you make a new release out of this? Then I could make a PR to Vcpkg to upgrade sqlpp11-connector-mysql to a new up-to-date version so that a vcpkg install works without any problems.

@rbock
Copy link
Owner

rbock commented Mar 11, 2020

Good point! Done.

@Toxe
Copy link
Contributor Author

Toxe commented Mar 11, 2020

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants