Hi Phil, I've actually thought about the same trick yesterday in the evening and just wanted to try it out when I saw your mail. It indeed works quite nicely and I can confirm that it solves the problem on our side as well. I've also opened an issue in the CUPS bug tracker: https://github.com/apple/cups/issues/5349
I'f you don't mind, I'd suggest to wrap this workaround into "#ifdef __solaris__" to not affect any other platforms at all. I also suggest to slightly change the comment to "unless __GNUC__ is defined" because there are compilers like Clang which are not GNU C but define "__GNUC__". Finally, I'd also put a link to the CUPS issue into the comment: diff -r 93043d28f8fa src/java.desktop/unix/native/common/awt/CUPSfuncs.c --- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c Tue Jun 12 13:00:50 2018 +0530 +++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c Fri Jul 06 10:17:39 2018 +0200 @@ -30,6 +30,15 @@ #include <cups/cups.h> #include <cups/ppd.h> +#ifdef __solaris__ + /* + * CUPS #define's __attribute__(x) to be empty unless __GNUC__ is defined. + * We need to #undef this else it breaks use of this keyword used by JNIEXPORT. + * See: https://github.com/apple/cups/issues/5349 + */ + #undef __attribute__ +#endif + //#define CUPS_DEBUG #ifdef CUPS_DEBUG Thank you and best regards, Volker On Thu, Jul 5, 2018 at 11:09 PM, Erik Joelsson <erik.joels...@oracle.com> wrote: > Looks good to me. > > I would have thought __attribute__ was a macro originally, but since it's > not, this looks like a very simple solution. Would be nice if Volker could > verify this as well. > > /Erik > > > > On 2018-07-05 14:06, Phil Race wrote: >> >> bug: https://bugs.openjdk.java.net/browse/JDK-8206106 >> >> Current CUPS include files are defining __attribute__ to be empty >> We need to undo that to build. Details in the bug report. >> built + tested on Solaris, Linux, Mac. >> >> fix : >> hg diff src/java.desktop/unix/native/common/awt/CUPSfuncs.c >> diff --git a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c >> b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c >> --- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c >> +++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c >> @@ -29,6 +29,12 @@ >> #include <dlfcn.h> >> #include <cups/cups.h> >> #include <cups/ppd.h> >> +/* >> + * CUPS #define's __attribute__(x) to be empty unless the compiler is GNU >> C. >> + * We need to #undef this else it breaks use of this keyword used by >> JNIEXPORT. >> + */ >> +#undef __attribute__ >> + >> >> -phil. > >