DrKLO/Telegram · error

%s: sorry, in-memory destination manager was not compiled in

Error message

%s: sorry, in-memory destination manager was not compiled in

What it means

cjpeg was built without an in-memory destination manager. This feature is present when JPEG_LIB_VERSION >= 80 OR MEM_SRCDST_SUPPORTED is defined. The -memdst switch (which makes cjpeg write to an in-memory buffer instead of a file/stdout) is therefore unavailable; cjpeg prints this message and exits with EXIT_FAILURE.

Source

Thrown at TMessagesProj/jni/mozjpeg/cjpeg.c:443

      outfilename = argv[argn]; /* save it away for later use */

    } else if (keymatch(arg, "progressive", 1)) {
      /* Select simple progressive mode. */
#ifdef C_PROGRESSIVE_SUPPORTED
      simple_progressive = TRUE;
      /* We must postpone execution until num_components is known. */
#else
      fprintf(stderr, "%s: sorry, progressive output was not compiled in\n",
              progname);
      exit(EXIT_FAILURE);
#endif

    } else if (keymatch(arg, "memdst", 2)) {
      /* Use in-memory destination manager */
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
      memdst = TRUE;
#else
      fprintf(stderr, "%s: sorry, in-memory destination manager was not compiled in\n",
              progname);
      exit(EXIT_FAILURE);
#endif

    } else if (keymatch(arg, "quality", 1)) {
      /* Quality ratings (quantization table scaling factors). */
      if (++argn >= argc) {      /* advance to next argument */
        fprintf(stderr, "%s: missing argument for quality\n", progname);
        usage();
      }
      qualityarg = argv[argn];

    } else if (keymatch(arg, "qslots", 2)) {
      /* Quantization table slot numbers. */
      if (++argn >= argc)       /* advance to next argument */
        usage();
      qslotsarg = argv[argn];
      /* Must delay setting qslots until after we have processed any

View on GitHub (pinned to 45ab8f4308)

Solutions

  1. Drop -memdst and write to a file or stdout instead.
  2. Upgrade to libjpeg >= 80 (e.g. libjpeg-turbo/mozjpeg), or rebuild with MEM_SRCDST_SUPPORTED defined, if in-memory output is required.

Example fix

# before
cjpeg -memdst in.ppm

# after
cjpeg in.ppm > out.jpg
Defensive patterns

Strategy: fallback

Validate before calling

# Probe in-memory destination support before using -memdst.
if cjpeg -h 2>&1 | grep -q memdst; then
  MEMDST=-memdst
else
  MEMDST=   # fall back to file/stdout output
fi
cjpeg $MEMDST in.ppm > out.jpg

Prevention

When it happens

Trigger: Invoking `cjpeg -memdst ...` against a libjpeg older than version 80 that was also not built with MEM_SRCDST_SUPPORTED.

Common situations: Embedded or legacy libjpeg builds below v8; vendor SDKs shipping an older libjpeg; toolchains that disable memory source/destination managers.

Related errors


AI-assisted analysis of DrKLO/Telegram@45ab8f4308 (2026-08-14). Data as JSON: /api/errors/df075151c1eccefb. Report an issue: GitHub.