#67729 closed defect (fixed)

lzma is broken now with Apple GCC: error: #pragma GCC diagnostic not allowed inside functions

Reported by: barracuda156 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: tiger, leopard, snowleopard Cc:
Port: lzma

Description

../../../../C/LzmaEnc.c: In function ‘SeqOutStreamBuf_Write’:
../../../../C/LzmaEnc.c:2922: error: #pragma GCC diagnostic not allowed inside functions
../../../../C/LzmaEnc.c:2922: error: #pragma GCC diagnostic not allowed inside functions
../../../../C/LzmaEnc.c:2922: error: #pragma GCC diagnostic not allowed inside functions
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lzma/lzma/work/compwrap/cc/usr/bin/gcc-4.2 -arch ppc     -O2 -c -Wall -Wextra  -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC   -o _o/LzFindOpt.o ../../../../C/LzFindOpt.c
gnumake: *** [_o/LzmaEnc.o] Error 1

Change History (5)

comment:1 Changed 15 months ago by aeiouaeiouaeiouaeiouaeiouaeiou

https://stackoverflow.com/a/16555760

I think we should copy the compiler blacklist from 7zip portfile.

Version 0, edited 15 months ago by aeiouaeiouaeiouaeiouaeiouaeiou (next)

comment:2 Changed 15 months ago by barracuda156

Ryan, what do you think? It is desirable to have this fixed ASAP, it is a dependency for many ports.

comment:3 Changed 15 months ago by kencu (Ken)

#if defined (__clang__) || defined(__GNUC__)

in insufficient as a test, as only newer gcc versions can support these pragmas inside functions.

Something like this is better (from our cmake patch for Tiger):

#if defined(__GNUC__)
#define GCC_VERSION \
	(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
#if defined(__clang__) || (defined(GCC_VERSION) && (GCC_VERSION >= 40500))
/* gcc diagnostic pragmas available */
# define GCC_DIAGNOSTIC_AVAILABLE
#endif

and then use

if defined(GCC_DIAGNOSTIC_AVAILABLE)

as the test.

comment:4 Changed 15 months ago by kencu (Ken)

or just blacklist gcc versions prior to gcc 4.5, and you won't run into the problem.

but given upstream seems to want to do it right, perhaps they will be interested improving their test.

comment:5 Changed 14 months ago by aeiouaeiouaeiouaeiouaeiouaeiou

Resolution: fixed
Status: assignedclosed

In 31911b6300de8dc7172a712491442f43d3425e2a/macports-ports (master):

lzma: blacklist GCC 3/4

Closes: #67729

Note: See TracTickets for help on using tickets.