abseil / abseil-cpp

Abseil Common Libraries (C++)
https://abseil.io
Apache License 2.0
15.05k stars 2.62k forks source link

[Bug]: Error (out) for old MacOS #1513

Open h-vetinari opened 1 year ago

h-vetinari commented 1 year ago

Describe the issue

Abseil already points to google's "foundational C++ support policy" explicitly, but it still carries code for old macos versions.

However, it seems this is not being tested anymore, as I found out when running against an older MacOS SDK:

In file included from $PREFIX/include/absl/synchronization/mutex.h:74:
$PREFIX/include/absl/synchronization/internal/kernel_timeout.h:94:45: error: unknown type name 'clockid_t'; did you mean 'clock_t'?
  struct timespec MakeClockAbsoluteTimespec(clockid_t c) const;
                                            ^
/Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/_types/_clock_t.h:30:33: note: 'clock_t' declared here
typedef __darwin_clock_t        clock_t;

It would be good to error out already in CMake based on what is being tested as the lower bound in CI

Steps to reproduce the problem

Compile a project that includes include/absl/synchronization/mutex.h on an old MacOS

What version of Abseil are you using?

20230802.0

What operating system and version are you using?

MacOS

What compiler and version are you using?

clang 15

What build system are you using?

cmake

Additional context

I'm not asking to support old MacOS, just error out more clearly if it's an unsupported version.

barracuda156 commented 1 year ago

@h-vetinari @derekmauro No, it won’t be good to error out, it would be good to fix the bug :)

P. S. Seriously, we can find a solution for this, I guess, and a PR with a fix – but please do not deliberately break something further for no need and make life of others harder.

h-vetinari commented 1 year ago

There's no bug. There's a lower limit that Google decides to support (which makes sense, because the stdlibs for C/C++ in the SDKs are really old). That's why it's called "foundational support policy".

Users below the defined lower bound are out of luck, but it would be nice to tell them more clearly that their system is too outdated.

barracuda156 commented 1 year ago

@h-vetinari GCC upstream supports macOS back to 10.5, so we have the latest C/C++ libraries and compilers.

It is a bug, because it breaks otherwise working software. And it is a fixable bug.

h-vetinari commented 1 year ago

Great for GCC, but abseil is not GCC. More importantly, you cannot just take along a newer glibc to an old MacOS, it's an integral part of the system. Under very controlled circumstances, you can get away with replacing your C++ stdlib, but abseil needs to supports much, much broader use than such specialised setups.

I don't speak for the maintainers here, but the amount of effort necessary to maintain compatibility with ancient (Mac)OSes is wildly, absurdly disproportionate to the number of users still on those versions (not least since Apple aggressively pushes people to upgrade their OS; the youngest unsupported SDK, 10.12, went EOL almost 4 years ago). And some things are plainly impossible to use or support otherwise, if they for example rely on newer glibc features (like C++17's std::aligned_alloc, which requires C11's aligned_alloc, which only reached the MacOS SDK in 10.15).

So it's really not a bug; it's a trade-off of maintainer time for supporting the far reaches of the long tail of support against everything else they need to do. And you don't get to make the choice for other projects where that trade-off is justified. Whatever software still needs to run on such old systems in this day and age will simply have to stay on abseil <=20230125.