Fix building with clang 15 on OSX #609 #610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem is explained in the issue, but to reiterate:
Newer versions of apple's clang will error if there is an undefined reference to TARGET_OS_*. The solution to this is to include the
TargetConditionals.h
file ahead of any references. The problem originates here:javacpp/src/main/java/org/bytedeco/javacpp/tools/Generator.java
Lines 313 to 318 in f77f8d7
The
TargetConditionals.h
is only included if both__APPLE__
and__OBJC__
are definied. If you use a brew installed llvm (currently version 15), the__APPLE__
will be defined but__OBJC__
is not.What I have done is made it so that
TargetConditionals.h
is always included on apple, and theFoundation/Foundation.h
is only included when__OBJC__
is defined. The result is this:I've tested this on OSX 12.6, clang 15 (installed via
brew install llvm
).