[OpenJDK 2D-Dev] RFR: 8206106: [solaris sparc] jck tests api/javax_print/PrintService failing
Phil Race
philip.race at oracle.com
Fri Jul 6 17:06:28 UTC 2018
Updated suggested fix :
--- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c
+++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c
@@ -29,6 +29,16 @@
#include <dlfcn.h>
#include <cups/cups.h>
#include <cups/ppd.h>
+/*
+ * CUPS #define's __attribute__(x) to be empty unless __GNUC__ is defined.
+ * However OpenJDK officially uses the SunStudio compiler on Solaris.
+ * We need to #undef this else it breaks use of this keyword used by
JNIEXPORT.
+ * See: https://github.com/apple/cups/issues/5349
+ */
+#ifdef __SUNPRO_C
+#undef __attribute__
+#endif
+
Since cups upstream has this issue even today, I suspect this workaround
is going to be
needed for a long time.
-phil.
On 07/06/2018 09:29 AM, Phil Race wrote:
> I was trying to account for there being other OSes - or more
> accurately, compilers,
> that would be broken by this. For example Oracle Studio has a Linux
> version !
>
> If we are to limit it, I suggest that we do
>
> #ifdef __SUNPRO_C
> ...
>
> https://docs.oracle.com/cd/E19205-01/820-4155/c++_faq.html#Vers6
>
> -phil.
>
> On 07/06/2018 01:24 AM, Volker Simonis wrote:
>> 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.joelsson at 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.
>>>
>
More information about the build-dev
mailing list