Mac build failing: error: sending 'id<NSApplicationDelegate>' to parameter of incompatible type 'id<NSFileManagerDelegate>'

David DeHaven david.dehaven at oracle.com
Wed Apr 27 17:37:03 UTC 2016


Why is this still an issue???

The fix is stupid simple:

diff --git a/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m b/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
--- a/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
+++ b/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
@@ -384,7 +384,7 @@
     applicationDelegate = delegate;
 
     if (NSApp != nil) {
- [NSApp setDelegate: applicationDelegate];
+ [(NSApplication*)NSApp setDelegate: applicationDelegate];
 
         if (applicationDelegate && qad) {
             [qad processQueuedEventsWithTargetDelegate: applicationDelegate];


The other option that avoids the use of global variables is:
+ [[NSApplication sharedApplication] setDelegate: applicationDelegate];


-DrD-

> This was fixed by adding this to config:
> --with-sdk-name=macosx10.9
> 
> On 4/1/16 5:26 PM, Phil Race wrote:
>> This is bug https://bugs.openjdk.java.net/browse/JDK-8134884
>> 
>> I am not sure about the bit where refreshing your repo triggered it since
>> I don't think the source code changed recently, so perhaps something
>> in your installed tool chain changed recently since it reads to me like
>> a particular combination of OS X, SDK and Xcode.
>> The bug report says xcode 6.3 + 10.10 SDK are a problem and
>> you seem to have at least the 10.10 SDK part of it.
>> 
>> 
>> -phil.
>> 
>> On 04/01/2016 02:16 PM, Pete Brunet wrote:
>>> My Mac build is failing today.  Maybe something changed with respect to
>>> the required SDK?
>>> 
>>> I refreshed my source and rebuilt and this is the output.
>>> 
>>> Building target 'images' in configuration
>>> 'macosx-x86_64-normal-server-release'
>>> Compiling 776 files for jdk.xml.bind
>>> Compiling 1227 files for java.xml.ws
>>> /Users/petebrunet/JDK9/JDK-8076554/client/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m:445:29:
>>> 
>>> error: sending 'id<NSApplicationDelegate>' to parameter of incompatible
>>> type 'id<NSFileManagerDelegate>' [-Werror]
>>>         [NSApp setDelegate: applicationDelegate];
>>>                             ^~~~~~~~~~~~~~~~~~~
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47:
>>> 
>>> note: passing argument to parameter 'delegate' here
>>> @property (assign) id <NSFileManagerDelegate> delegate
>>> NS_AVAILABLE(10_5, 2_0);
>>>                                               ^
>>> 1 error generated.
>>> make[3]: ***
>>> [/Users/petebrunet/JDK9/JDK-8076554/client/build/macosx-x86_64-normal-server-release/support/native/java.desktop/libosxapp/NSApplicationAWT.o]
>>> 
>>> Error 1
>>> make[3]: *** Waiting for unfinished jobs....
>>> make[2]: *** [java.desktop-libs] Error 2
>>> make[2]: *** Waiting for unfinished jobs....
>>> Note: Some input files use or override a deprecated API.
>>> Note: Recompile with -Xlint:deprecation for details.
>>> Note: Some input files use unchecked or unsafe operations.
>>> Note: Recompile with -Xlint:unchecked for details.
>>> Note: Some input files use or override a deprecated API.
>>> Note: Recompile with -Xlint:deprecation for details.
>>> Note: Some input files use unchecked or unsafe operations.
>>> Note: Recompile with -Xlint:unchecked for details.
>>> 
>>> ERROR: Build failed for target 'images' in configuration
>>> 'macosx-x86_64-normal-server-release' (exit code 2)
>>> === Output from failing command(s) repeated here ===
>>> * For target support_native_java.desktop_libosxapp_NSApplicationAWT.o:
>>> /Users/petebrunet/JDK9/JDK-8076554/client/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m:445:29:
>>> 
>>> error: sending 'id<NSApplicationDelegate>' to parameter of incompatible
>>> type 'id<NSFileManagerDelegate>' [-Werror]
>>>         [NSApp setDelegate: applicationDelegate];
>>>                             ^~~~~~~~~~~~~~~~~~~
>>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47:
>>> 
>>> note: passing argument to parameter 'delegate' here
>>> @property (assign) id <NSFileManagerDelegate> delegate
>>> NS_AVAILABLE(10_5, 2_0);
>>>                                               ^
>>> 1 error generated.
>>> === End of repeated output ===
>>> No indication of failed target found.
>>> Hint: Try searching the build log for '] Error'.
>>> Hint: If caused by a warning, try configure
>>> --disable-warnings-as-errors.
>>> 
>>> make[1]: *** [main] Error 2
>>> make: *** [images] Error 2
>>> 
>>> 
>> 
> 




More information about the build-dev mailing list