Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#66170 closed defect (fixed)

icu @72.1 fails to build on 10.6

Reported by: jmroot (Joshua Root) Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version:
Keywords: snowleopard Cc:
Port: icu

Description

writesrc.cpp:202:35: error: expected ':'
        fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
                                  ^
                                  : 
writesrc.cpp:202:29: note: to match this '?'
        fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
                            ^
writesrc.cpp:202:35: error: use of undeclared identifier 'PRId64'
        fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
                                  ^
2 errors generated.

https://build.macports.org/builders/ports-10.6_x86_64-builder/builds/125929/steps/install-port/logs/stdio

Change History (6)

comment:1 Changed 2 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In 2a477ac3558ce6342ecb151f1c683657e7558349/macports-ports (master):

icu: build fix for 10.6

Closes: #66170

comment:2 Changed 2 years ago by barracuda156

With Clang, I guess. With GCC it built fine.

comment:3 Changed 2 years ago by catap (Kirill A. Korinsky)

Sergey, shall you backport Joshua's change to upstream?

comment:4 Changed 2 years ago by kencu (Ken)

I think you can get rid of this change, as most likely all you need is to define __STDC_FORMAT_MACROS, commonly needed on 10.6.

We talked about this before <https://trac.macports.org/ticket/66042> and you felt it was the wrong fix (not sure why) but I was never sure why the <cinttypes> switch seemed to work, TBH.

- #include <inttypes.h>
+ #include <cinttypes>
Version 1, edited 2 years ago by kencu (Ken) (previous) (next) (diff)

comment:5 Changed 2 years ago by jmroot (Joshua Root)

Using the C-style headers in C++ was officially deprecated since C++98, but is actually being un-deprecated in C++23, which makes it merely discouraged but not subject to future removal. Which I guess just leaves everyone slightly confused if they're targeting C++11.

comment:6 Changed 2 years ago by jmroot (Joshua Root)

I was never sure why the <cinttypes> switch seemed to work, TBH.

The header in libstdc++ does this workaround for you:

// For 27.9.2/3 (see C99, Note 184)
#if _GLIBCXX_HAVE_INTTYPES_H
# ifndef __STDC_FORMAT_MACROS
#  define _UNDEF__STDC_FORMAT_MACROS
#  define __STDC_FORMAT_MACROS
# endif
# include <inttypes.h>
# ifdef _UNDEF__STDC_FORMAT_MACROS
#  undef __STDC_FORMAT_MACROS
#  undef _UNDEF__STDC_FORMAT_MACROS
# endif
#endif

The one in libc++ (as provided by clang-3.7) just does a plain #include <inttypes.h>, which as it happens works fine on 10.7+. A similar workaround was later added to libc++: https://github.com/llvm/llvm-project/commit/9eddaeb5340035f1ed36940f7478999616a898f0

Last edited 2 years ago by jmroot (Joshua Root) (previous) (diff)
Note: See TracTickets for help on using tickets.