git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Compile Error v2.13.2 on Solaris SPARC

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 26, 2017, 18:31 UTC
Message-ID
<87h8z27g85.fsf@gmail.com>
In-Reply-To
<CAKKM46s25LA+ywu_W5fyTaZ-r+3VyURptaa6whZsonzggQV-+g@mail.gmail.com>
On Mon, Jun 26 2017, Michael Kebe jotted:
> Still no luck, with one or both patches.

Could you please attach (or pastebin or whatever) your copy of /usr/include/sys/isa_defs.h? And what Solaris/Illumos/Whatever version is this?

Maybe this patch works for you:
diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index facea1bb56..4f747c3aea 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -36,17 +36,19 @@
 #undef SHA1DC_BIGENDIAN
 #endif
 
-#if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__))
+#if (defined(BYTE_ORDER) || defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || \
+     defined(__BYTE_ORDER__))
 
-#if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
-     (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
-     (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) )
+#if ((defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || \
+     (defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)) ||   \
+     (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
+     (defined(__BYTE_ORDER__) && defined(__BIG_ENDIAN__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) )
 #define SHA1DC_BIGENDIAN
 #endif
 
 #else
 
-#if (defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
+#if (defined(BIG_ENDIAN) || defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
      defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
      defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || \
      defined(__sparc))


Make sure to run the test suite after that, because it may compile but
not diagnose you as Big Endian if it doesn't work, thus failing horribly
on runtime.

> Greetings
> Michael
>
> 2017-06-26 14:47 GMT+02:00 Ævar Arnfjörð Bjarmason <avarab@gmail.com>:
>>
>> On Mon, Jun 26 2017, Michael Kebe jotted:
>>
>>> No luck with the patch.
>>>
>>> Still got:
>>>
>>>     CC sha1dc/sha1.o
>>> sha1dc/sha1.c:43:58: error: operator '==' has no right operand
>>>       (defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) ||   \
>>>                                                           ^
>>> gmake: *** [sha1dc/sha1.o] Error 1
>>
>> Does this patch change anything, with or without the previous patch:
>>
>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index 047172d173..1327aea229 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -131,6 +131,14 @@
>>  # else
>>  # define _XOPEN_SOURCE 500
>>  # endif
>> +
>> +/*
>> + * Bring in macros defining _BIG_ENDIAN etc. Should be brought in by
>> + * the likes of stdio.h, but include it here in case it hasn't been
>> + * included already.
>> + */
>> +#include <sys/isa_defs.h>
>> +
>>  #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \
>>        !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
>>        !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
>>
>>>
>>> Greetings
>>> Michael
>>>
>>> 2017-06-26 10:42 GMT+02:00 Ævar Arnfjörð Bjarmason <avarab@gmail.com>:
>>>>
>>>> On Mon, Jun 26 2017, Michael Kebe jotted:
>>>>
>>>>> When compiling 2.13.2 on Solaris SPARC I get this error:
>>>>>
>>>>>     CC sha1dc/sha1.o
>>>>> sha1dc/sha1.c:41:58: error: operator '==' has no right operand
>>>>>  #if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
>>>>>                                                           ^
>>>>> gmake: *** [sha1dc/sha1.o] Error 1
>>>>>
>>>>> The define _BIG_ENDIAN is set by Solaris on SPARC systems. So the
>>>>> check in line 41 gives this error.
>>>>>
>>>>> The _BIG_ENDIAN define is used few line below for defining
>>>>> SHA1DC_BIGENDIAN. This is needed for Solaris SPARC systems.
>>>>> See
>>>>> https://github.com/cr-marcstevens/sha1collisiondetection/commit/33a694a9ee1b79c24be45f9eab5ac0e1aeeaf271
>>>>
>>>> I can see why this would error out. In sys/isa_defs.h on SPARC there's
>>>> just `#define _BIG_ENDIAN`
>>>> (http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/sys/isa_defs.h),
>>>> and (on Linux):
>>>>
>>>>     $ cat /tmp/test.c
>>>>     #define _FOO
>>>>     #define _BAR 1
>>>>     #if (_BAR == _FOO)
>>>>     #endif
>>>>     $ gcc -E /tmp/test.c
>>>>     # 1 "/tmp/test.c"
>>>>     # 1 "<built-in>"
>>>>     # 1 "<command-line>"
>>>>     # 31 "<command-line>"
>>>>     # 1 "/usr/include/stdc-predef.h" 1 3 4
>>>>     # 32 "<command-line>" 2
>>>>     # 1 "/tmp/test.c"
>>>>     /tmp/test.c:3:18: error: operator '==' has no right operand
>>>>      #if (_BAR == _FOO)
>>>>
>>>> What I don't get is how this would have worked for Liam then (see
>>>> 20170613020939.gemh3m5z6czgwmzp@oracle.com). Differences in Solaris
>>>> versions and how their headers look like?
>>>>
>>>> Does this patch fix it for you?
>>>>
>>>> diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
>>>> index facea1bb56..0b75b31b67 100644
>>>> --- a/sha1dc/sha1.c
>>>> +++ b/sha1dc/sha1.c
>>>> @@ -36,9 +36,11 @@
>>>>  #undef SHA1DC_BIGENDIAN
>>>>  #endif
>>>>
>>>> -#if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__))
>>>> +#if (defined(BYTE_ORDER) || defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || \
>>>> +     defined(__BYTE_ORDER__))
>>>>
>>>> -#if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
>>>> +#if ((defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)) || \
>>>> +     (defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) ||   \
>>>>       (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \
>>>>       (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) )
>>>>  #define SHA1DC_BIGENDIAN
>>>>
>>>> I thought maybe BYTE_ORDER would work after searching the Illumos
>>>> sources a bit more:
>>>> http://src.illumos.org/source/search?q=BYTE_ORDER&project=illumos-gate
>>
Previous: Michael KebeNext: Liam R. Howlett
Message 42 of 50 in “Compile Error v2.13.2 on Solaris SPARC”
  1. Michael KebeJun 26, 2017
  2. 0/3 update sha1dc from PR #36Ævar Arnfjörð Bjarmason, Jun 27, 2017
  3. 1/3 sha1dc: update from my PR #36Ævar Arnfjörð Bjarmason, Jun 27, 2017
  4. Junio C HamanoJun 27, 2017
  5. Junio C HamanoJun 27, 2017
  6. Ævar Arnfjörð BjarmasonJun 27, 2017
  7. Junio C HamanoJun 27, 2017
  8. Liam R. HowlettJun 27, 2017
  9. Ævar Arnfjörð BjarmasonJun 27, 2017
  10. Junio C HamanoJun 27, 2017
  11. Junio C HamanoJun 27, 2017
  12. Ævar Arnfjörð BjarmasonJun 27, 2017
  13. Junio C HamanoJun 27, 2017
  14. Liam R. HowlettJun 27, 2017
  15. Junio C HamanoJun 27, 2017
  16. Ævar Arnfjörð BjarmasonJun 27, 2017
  17. Junio C HamanoJun 27, 2017
  18. Ævar Arnfjörð BjarmasonJun 27, 2017
  19. Junio C HamanoJun 27, 2017
  20. Junio C HamanoJun 27, 2017
  21. Ævar Arnfjörð BjarmasonJun 27, 2017
  22. 2/3 sha1dc: optionally use sha1collisiondetection as a submoduleÆvar Arnfjörð Bjarmason, Jun 27, 2017
  23. Stefan BellerJun 27, 2017
  24. Ævar Arnfjörð BjarmasonJun 27, 2017
  25. 3/3 sha1collisiondetection: automatically enable when submodule is populatedÆvar Arnfjörð Bjarmason, Jun 27, 2017
  26. Stefan BellerJun 27, 2017
  27. 0/3 Update sha1dc from upstreamÆvar Arnfjörð Bjarmason, Jul 1, 2017
  28. 2/3 sha1dc: optionally use sha1collisiondetection as a submoduleÆvar Arnfjörð Bjarmason, Jul 1, 2017
  29. Junio C HamanoJul 3, 2017
  30. Ævar Arnfjörð BjarmasonJul 3, 2017
  31. Junio C HamanoJul 4, 2017
  32. Ævar Arnfjörð BjarmasonJul 4, 2017
  33. Stefan BellerJul 5, 2017
  34. Junio C HamanoJul 5, 2017
  35. Stefan BellerJul 5, 2017
  36. Ævar Arnfjörð BjarmasonJul 5, 2017
  37. 1/3 sha1dc: update from upstreamÆvar Arnfjörð Bjarmason, Jul 1, 2017
  38. 3/3 sha1collisiondetection: automatically enable when submodule is populatedÆvar Arnfjörð Bjarmason, Jul 1, 2017
  39. Michael KebeJun 26, 2017
  40. Ævar Arnfjörð BjarmasonJun 26, 2017
  41. Michael KebeJun 26, 2017
  42. Ævar Arnfjörð BjarmasonJun 26, 2017
  43. Liam R. HowlettJun 26, 2017
  44. Michael KebeJun 27, 2017
  45. Michael KebeJun 27, 2017
  46. Liam R. HowlettJun 27, 2017
  47. Junio C HamanoJun 27, 2017
  48. Liam R. HowlettJun 27, 2017
  49. Ævar Arnfjörð BjarmasonJun 27, 2017
  50. Ævar Arnfjörð BjarmasonJun 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.