#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.
Change History (6)
comment:1 Changed 3 years ago by jmroot (Joshua Root)
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
comment:3 Changed 3 years ago by catap (Kirill A. Korinsky)
Sergey, shall you backport Joshua's change to upstream?
comment:4 Changed 3 years ago by kencu (Ken)
I think you can probably revert the header change, as most likely all you need is to define __STDC_FORMAT_MACROS, commonly needed on 10.6.
- #include <inttypes.h> + #include <cinttypes>
or maybe the header change is right too.
comment:5 Changed 3 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 3 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

In 2a477ac3558ce6342ecb151f1c683657e7558349/macports-ports (master):