Skip to content

Conversation

@tresf
Copy link

@tresf tresf commented Apr 28, 2025

Fixes the importing of std::bad_alloc as well as other standard C++ features by fixing the import of certain c++ headers (in this case, new.h)

  • Explicitly adds MacOSX10.9.sdk/usr/include/c++/4.2.1 when /Users/owner/Desktop/MacOSX10.9.sdk/usr/include/c++/v1 was expected.
  • Dynamically adds any folder in include/c++ to cmake's include that does not start with /v1 or similar.

Inspired by #175 (review).

Similar questions:

Fixes compile error:

cmake-build:
     [exec] [ 50%] Building CXX object CMakeFiles/jssc.dir/src/main/cpp/_nix_based/jssc.cpp.o
     [exec] /Users/runner/work/jssc/jssc/src/main/cpp/_nix_based/jssc.cpp:29:10: fatal error: 'new' file not found
     [exec] #include <new> // std::bad_alloc
     [exec]          ^~~~~
     [exec] 1 error generated.
     [exec] make[2]: *** [CMakeFiles/jssc.dir/src/main/cpp/_nix_based/jssc.cpp.o] Error 1
     [exec] make[1]: *** [CMakeFiles/jssc.dir/all] Error 2
     [exec] make: *** [all] Error 2

@tresf tresf force-pushed the fix-macos-headers branch from daf1254 to f20d588 Compare April 28, 2025 22:16
@tresf tresf added the component:cmake Changes to the native build process using `cmake`. label Apr 28, 2025
@pietrygamat pietrygamat self-requested a review May 9, 2025 20:22
Copy link
Collaborator

@pietrygamat pietrygamat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@tresf tresf merged commit f361dd2 into master May 14, 2025
26 checks passed
@tresf tresf deleted the fix-macos-headers branch May 14, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:cmake Changes to the native build process using `cmake`.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants