[MacPorts] #67357: libjxl @0.8.1: error: expected ')' before 'PRIu64'

MacPorts noreply at macports.org
Tue Mar 12 12:07:00 UTC 2024


#67357: libjxl @0.8.1: error: expected ')' before 'PRIu64'
------------------------+-----------------------
  Reporter:  ballapete  |      Owner:  jmroot
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.8.1
Resolution:             |   Keywords:  tiger ppc
      Port:  libjxl     |
------------------------+-----------------------

Comment (by ballapete):

 The `macros PRIu64 and PRId64` are `#define`d in `inttypes.h`:

 {{{
    24   /*
    25    * <inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
    26    * (aka "C99"), section 7.8.   This defines format string
 conversion
    27    * specifiers suitable for use within arguments to fprintf and
 fscanf
    28    * and their ilk.
    29    */
    30
    31   #if !defined(_INTTYPES_H_)
    32   #define _INTTYPES_H_
    33
    34   #include <sys/cdefs.h>          /* For __BEGIN_DECLS and
 __END_DECLS */
    35   #include <_types.h>             /* For __darwin_wchar_t */
    36   #include <stdint.h>
    37
    38   #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
    39     /* Translator is not ISO/IEC 9899:1999-compliant. */
    40   #  if !defined(restrict)
    41   #    define restrict
    42   #    define __RESTRICT_KEYWORD_DEFINED__
    43   #  endif
    44   #endif
    45
    46   /* "C++ implementations should define these macros only when
    47    *  __STDC_FORMAT_MACROS is defined before <inttypes.h> is
 included."
    48    */
    49   #if (! defined(__cplusplus)) || defined(__STDC_FORMAT_MACROS)
    50
    51   #  undef __PRI_8_LENGTH_MODIFIER__
    52   #  undef __PRI_64_LENGTH_MODIFIER__
    53   #  undef __SCN_64_LENGTH_MODIFIER__
    54
    55   /* These could be "hh", "ll", and "ll" respectively, but that
 doesn't work on
    56      10.2, and these do.  Note that there's no way to use scanf to
 scan a
    57      decimal into a 'char' argument on 10.2, so "hh" is used
 unconditionally
    58      and programs that use it won't work on Jaguar.  */
    59   #  define __PRI_8_LENGTH_MODIFIER__ ""  /* none */
    60   #  define __PRI_64_LENGTH_MODIFIER__ "q"
    61   #  define __SCN_64_LENGTH_MODIFIER__ "q"
    62   #  define __PRI_MAX_LENGTH_MODIFIER__ "j"
    63   #  define __SCN_MAX_LENGTH_MODIFIER__ "j"
 .
 .
 .
    86   #  define PRId64        __PRI_64_LENGTH_MODIFIER__ "d"
    87   #  define PRIi64        __PRI_64_LENGTH_MODIFIER__ "i"
    88   #  define PRIo64        __PRI_64_LENGTH_MODIFIER__ "o"
    89   #  define PRIu64        __PRI_64_LENGTH_MODIFIER__ "u"
    90   #  define PRIx64        __PRI_64_LENGTH_MODIFIER__ "x"
    91   #  define PRIX64        __PRI_64_LENGTH_MODIFIER__ "X"
 }}}

 It gets `include`d early as first `C header file`:

 {{{
 . /usr/include/inttypes.h
 .. /usr/include/sys/cdefs.h
 .. /usr/include/_types.h
 ... /usr/include/sys/_types.h
 .... /usr/include/machine/_types.h
 ..... /usr/include/ppc/_types.h
 .. /opt/local/lib/gcc7/gcc/ppc-apple-darwin8/7.5.0/include/stdint.h
 ... /opt/local/lib/gcc7/gcc/ppc-apple-darwin8/7.5.0/include-fixed/stdint.h
 }}}

 `GCC7` does `#define __cplusplus 201103L`, but `__STDC_FORMAT_MACROS`
 never gets `#define`d on `Tiger`. But `libjxl` uses these print format
 macros:

 {{{
 libjxl-0.10.2/examples/decode_progressive.cc:87:      printf("Flushing
 after %" PRIu64 " bytes\n", static_cast<uint64_t>(seen));
 libjxl-0.10.2/examples/decode_progressive.cc:93:        if
 (snprintf(fname, 1024, "%s-%" PRIu64 ".pam", filename,
 libjxl-0.10.2/examples/decode_progressive.cc:147:        fprintf(stderr,
 "Invalid out buffer size %" PRIu64 " != %" PRIu64 "\n",
 libjxl-0.10.2/lib/jxl/convolve_test.cc:173:
 "%" PRIuS " x %" PRIuS " (target %" PRIx64
 libjxl-0.10.2/lib/jxl/enc_fields.cc:93:    return JXL_FAILURE("Value %d
 too large to encode in %" PRIu64 " bits",
 libjxl-0.10.2/lib/jxl/fields.cc:471:    return JXL_FAILURE("Value %u too
 large for %" PRIu64 " bits", value,
 libjxl-0.10.2/lib/jxl/image.h:99:      JXL_ABORT("Row(%" PRIu64 ") in (%u
 x %u) image\n",
 libjxl-0.10.2/lib/jxl/image.h:483:      JXL_ABORT("PlaneRow(%" PRIu64 ",
 %" PRIu64 ") in (%" PRIu64 " x %" PRIu64
 libjxl-0.10.2/lib/jxl/modular/encoding/enc_debug_tree.cc:107:
 fprintf(f, "n%05" PRIuS " [label=\"%s%+" PRId64 " (x%u)\"];\n", cur,
 libjxl-0.10.2/lib/jxl/sanitizers.h:64:          "Uninitialized regions for
 image of size %" PRIu64 "x%" PRIu64 ":\n",
 libjxl-0.10.2/lib/jxl/sanitizers.h:103:        fprintf(stderr, " y=[%"
 PRId64 ", %" PRIu64 "):",
 libjxl-0.10.2/lib/jxl/sanitizers.h:106:        fprintf(stderr, " y=[%"
 PRId64 "]:", static_cast<int64_t>(start_y_));
 libjxl-0.10.2/lib/jxl/sanitizers.h:110:          fprintf(stderr, " [%"
 PRId64 "]", static_cast<int64_t>(seg.first));
 libjxl-0.10.2/lib/jxl/sanitizers.h:112:          fprintf(stderr, " [%"
 PRId64 ", %" PRIu64 ")",
 libjxl-0.10.2/lib/jxl/sanitizers.h:173:          "Checking an image of %"
 PRIu64 " x %" PRIu64 ", rect x0=%" PRIu64
 libjxl-0.10.2/lib/jxl/sanitizers.h:174:          ", y0=%" PRIu64
 libjxl-0.10.2/lib/jxl/sanitizers.h:176:          "xsize=%" PRIu64 ",
 ysize=%" PRIu64,
 libjxl-0.10.2/lib/jxl/sanitizers.h:182:
 "CheckImageInitialized failed at x=%" PRIu64 ", y=%" PRIu64
 libjxl-0.10.2/lib/jxl/sanitizers.h:183:                ", c=%" PRIu64 ":
 %s",
 libjxl-0.10.2/lib/jxl/splines.cc:441:      return JXL_FAILURE("Too large
 manhattan_distance reached: %" PRIu64,
 libjxl-0.10.2/lib/jxl/splines.cc:502:    return JXL_FAILURE("Too large
 total_estimated_area eached: %" PRIu64,
 libjxl-0.10.2/lib/jxl/splines.cc:656:        "Large
 total_estimated_area_reached, expect slower decoding: %" PRIu64,
 libjxl-0.10.2/tools/jxlinfo.c:272:        printf("%" PRIu64 "-byte ICC
 profile, ", (uint64_t)profile_size);
 libjxl-0.10.2/tools/jxlinfo.c:341:        printf("box: type: \"%c%c%c%c\"
 size: %" PRIu64
 libjxl-0.10.2/tools/jxlinfo.c:342:               ", contents size: %"
 PRIu64 "\n",
 libjxl-0.10.2/tools/jxlinfo.c:357:        printf("Uncompressed %c%c%c%c
 metadata: %" PRIu64 " bytes\n", type[0],
 libjxl-0.10.2/tools/jxlinfo.c:362:        printf("Brotli-compressed
 %c%c%c%c metadata: %" PRIu64
 libjxl-0.10.2/tools/jxlinfo.c:366:        printf("unknown box: type:
 \"%c%c%c%c\" size: %" PRIu64 "\n", type[0],
 }}}

 which are `PRIuS, PRId64, PRIu64`. The first one is `#define`d in
 `libjxl-0.10.2/lib/jxl/base/printf_macros.h` and so of no further
 interest. Putting a line like

 {{{
 configure.cflags-append     -DPRId64=qd -DPRIu64=qu
 }}}

 into `Portfile` should allow to build. (I have no idea how to persuade
 CMake to accept these.)

-- 
Ticket URL: <https://trac.macports.org/ticket/67357#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list