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

OSx: 'uncaught_exceptions' has been explicitly marked unavailable #2779

Open
tdegeus opened this issue Dec 11, 2023 · 1 comment
Open

OSx: 'uncaught_exceptions' has been explicitly marked unavailable #2779

tdegeus opened this issue Dec 11, 2023 · 1 comment

Comments

@tdegeus
Copy link
Contributor

tdegeus commented Dec 11, 2023

Describe the bug
On macOS we're getting:

[91/110] Building CXX object src/CMakeFiles/Catch2.dir/catch2/internal/catch_uncaught_exceptions.cpp.o
FAILED: src/CMakeFiles/Catch2.dir/catch2/internal/catch_uncaught_exceptions.cpp.o 
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++  -I$SRC_DIR/src/catch2/.. -I$SRC_DIR/build/generated-includes -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/catch2-3.5.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -O3 -DNDEBUG -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -ffile-prefix-map=$SRC_DIR/= -MD -MT src/CMakeFiles/Catch2.dir/catch2/internal/catch_uncaught_exceptions.cpp.o -MF src/CMakeFiles/Catch2.dir/catch2/internal/catch_uncaught_exceptions.cpp.o.d -o src/CMakeFiles/Catch2.dir/catch2/internal/catch_uncaught_exceptions.cpp.o -c $SRC_DIR/src/catch2/internal/catch_uncaught_exceptions.cpp
$SRC_DIR/src/catch2/internal/catch_uncaught_exceptions.cpp:21:21: error: 'uncaught_exceptions' is unavailable: introduced in macOS 10.12 - see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
        return std::uncaught_exceptions() > 0;
                    ^
$BUILD_PREFIX/bin/../include/c++/v1/exception:185:63: note: 'uncaught_exceptions' has been explicitly marked unavailable here
_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;
                                                              ^
1 error generated.

See conda-forge/catch2-feedstock#58

It could be that #1911 is not properly detected?

Expected behavior
Proper build and run.

Reproduction steps
https://github.com/conda-forge/catch2-feedstock/blob/main/recipe/meta.yaml
https://github.com/conda-forge/catch2-feedstock/blob/main/recipe/build.sh
https://github.com/conda-forge/catch2-feedstock/blob/main/recipe/run_test.sh

Platform information:

  • OS: macOS
  • Compiler+version: clang 16
  • Catch version: 3.5.0

Additional context

@horenmar
Copy link
Member

It could be that #1911 is not properly detected?

No. If it was not properly detected, the error would not be happening.


I don't have expertise with either Conda or MacOS packaging, but after talking with some people who do, here is what I think is happening

  • Conda targets ancient version of MacOS during compilation. 10.09 was released 2013 and the support ended in 2016.
  • Apple Clang checks whether specific features are available on the target version of MacOS and errors out if not. However, Clang assumes that it targets the system libc++. Conda builds and distributes its own libc++, but Clang does not know that.
  • The actual libc++ defines the feature availability macro to the correct value, and Catch2 tries using std::uncaught_exceptions.
  • Clang sees that, and because the system libc++ for MacOS 10.09 does not support std::uncaught_exceptions, it errors out.

The solution is to

  1. Define _LIBCPP_DISABLE_AVAILABILITY during compilation.
  2. Stop targetting ancient versions of MacOS.

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

No branches or pull requests

2 participants