Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#51750 closed defect (fixed)

libarchive @3.2.1_0 fails building on 10.5.8 PPC

Reported by: udbraumann Owned by: tobypeterson
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port: libarchive

Description

While upgrading libarchive from 3.1.2_2 to 3.2.1_0 I run into this trouble:

:info:build libtool: compile:  /usr/bin/gcc-4.2 -DHAVE_CONFIG_H -I. -I/opt/local/include -I/opt/local/include/libxml2 -pipe -Os -arch ppc -Wall -Wformat -Wformat-security -MT libarchive/archive_read_support_format_lha.lo -MD -MP -MF libarchive/.deps/archive_read_support_format_lha.Tpo -c libarchive/archive_read_support_format_lha.c  -fno-common -DPIC -o libarchive/.libs/archive_read_support_format_lha.o
:info:build libarchive/archive_read_support_format_lha.c:1718:46: error: missing binary operator before token "("
:info:build make[1]: *** [libarchive/archive_read_support_format_lha.lo] Error 1

Attachments (1)

main.log.gz (8.7 KB) - added by udbraumann 8 years ago.

Download all attachments as: .zip

Change History (11)

Changed 8 years ago by udbraumann

Attachment: main.log.gz added

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Cc: toby@… removed
Owner: changed from macports-tickets@… to toby@…

comment:2 Changed 8 years ago by tobypeterson

10.5.8 PPC, wtf

comment:3 Changed 8 years ago by tobypeterson

Resolution: fixed
Status: newclosed

r149889 might fix it. I obviously cannot test on 10.5.8, let alone PPC.

comment:4 in reply to:  3 Changed 8 years ago by udbraumann

Replying to toby@…:

r149889 might fix it. I obviously cannot test on 10.5.8, let alone PPC.

Sorry, your solution cannot work, as your introduced check whether __has_builtin is defined does not prevent from applying it anyway. What the programmer of libarchive/archive_read_support_format_lha.c obviously has forgotten is to consider the case that __has_builtin is not defined at all, so as this is missing in all kinds of gcc (AFAIK), the present code only supports newer clang (probably newer than 3.2). Somewhere in the clang documentation I found a simple work-around to add this feature checking macro:

#ifndef __has_builtin         // Optional of course
  #define __has_builtin(x) 0  // Compatibility with non-clang compilers
#endif

So please add these three lines above somewhere before line 1715 in libarchive/archive_read_support_format_lha.c, and please revert your patch affecting line 1718

      || (defined(__clang__) && defined(__has_builtin) && __has_builtin(__builtin_bswap16))

back to

      || (defined(__clang__) && __has_builtin(__builtin_bswap16))

I think gcc now again can be used to build libarchive. As you might have heard, clang unfortunately is not functional on PPC so far (even though macports-clang-3.4 can be built).

Thanks!

comment:5 Changed 8 years ago by tobypeterson

If I'm interpreting your comment correctly, you're saying that the preprocessor evaluates everything, unlike the compiler?

comment:6 Changed 8 years ago by tobypeterson

As for "the programmer of libarchive" - they didn't even use has_builtin, that was my first attempt at fixing it - which does work fine on non-ancient compilers.

comment:7 Changed 8 years ago by tobypeterson

Anyway, r149937.

comment:8 in reply to:  5 Changed 8 years ago by udbraumann

Replying to toby@…:

If I'm interpreting your comment correctly, you're saying that the preprocessor evaluates everything, unlike the compiler?

There is no other way to interpret the effect we have observed.

comment:9 in reply to:  6 Changed 8 years ago by udbraumann

Replying to toby@…:

As for "the programmer of libarchive" - they didn't even use has_builtin, that was my first attempt at fixing it - which does work fine on non-ancient compilers.

Well, gcc5 is not too ancient so far, but it also failed at that point, not only the good old gcc42.

comment:10 in reply to:  7 Changed 8 years ago by udbraumann

Replying to toby@…:

Anyway, r149937.

Thanks for the fix!

Note: See TracTickets for help on using tickets.