From 7352d06ade5967ae4abfe5c3cda1d239b939dd26 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 14 Apr 2026 11:06:04 -0500 Subject: [PATCH] Use NCEPLIBS-g2c v2.1.0 + enable wgrib2 PNG decoder The linker error from the previous attempt was actual symbol references, not a flag-combination oddity: undefined reference to `g2c_enc_jpeg2000' undefined reference to `g2c_dec_jpeg2000' Those live in g2c's "new" file-based API, built only when BUILD_G2C=ON. In v1.9.0 the option defaulted OFF and was marked "experimental until 2.0.0 release", so I had explicitly disabled it. In v2.1.0 (released 2025-01-13, before wgrib2 v3.6.0 on 2025-02-19) it defaults ON and the API is stable. Bump G2C_VERSION to 2.1.0 and drop the BUILD_G2C override. With the new-API symbols now exported, wgrib2 can be compiled with every decoder we care about in one shot: -DUSE_PNG=ON -DUSE_OPENJPEG=ON -DUSE_AEC=ON `wgrib2 -config` in the final runtime image now reports: Supported decoding: simple, complex, rle, ieee, png, jpeg2000, CCSDS AEC Verified end-to-end by building the full image with podman and running wgrib2 -config inside it. MrmsFetchWorker's packing type 41 (PNG) messages will decode once the rolling deploy lands. --- Dockerfile | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index afdfaf22..1d67e1f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,12 @@ ARG RUNNER_IMAGE="docker.io/debian:${DEBIAN_VERSION}" FROM ${RUNNER_IMAGE} AS wgrib2-builder ARG WGRIB2_VERSION=3.6.0 -ARG G2C_VERSION=1.9.0 +# g2c v2.1.0 is the first release where BUILD_G2C defaults ON, which +# is what wgrib2 v3.6.0 needs at link time (g2c_enc_jpeg2000 / +# g2c_dec_jpeg2000 come from the "new" file-based API). v1.9.0's +# same flag was OFF by default with a note about the API being +# experimental until 2.0.0. +ARG G2C_VERSION=2.1.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -54,24 +59,20 @@ RUN wget -q --content-disposition "https://github.com/NOAA-EMC/NCEPLIBS-g2c/arch WORKDIR /tmp/wgrib2 -# wgrib2 flag notes: -# * USE_OPENJPEG is what wgrib2's own CI (Linux_options.yml) tests -# — it triggers the g2c linkage and is known to build cleanly. An -# earlier attempt with -DUSE_PNG=ON alone got all the way to -# linking libwgrib2.so and then died with Error 2 on the wgrib2_exe -# link step (wgrib2 doesn't gate every jpeg_pk.c path properly -# when USE_PNG is set without USE_JASPER/USE_OPENJPEG). -# * wgrib2 delegates actual decompression to g2c, and g2c above was -# built with USE_PNG=ON, so PNG-packed GRIB2 (DRT 5.41, e.g. MRMS -# PrecipRate) still decodes correctly through this link even -# though wgrib2's own USE_PNG knob stays off. +# wgrib2 flags: +# * USE_PNG / USE_OPENJPEG / USE_AEC each turn on the matching +# encoder path inside wgrib2 and add the compression name to the +# -config output. With g2c v2.1.0 underneath (which exports the +# g2c_enc_* / g2c_dec_* new-API symbols) all three can be enabled +# together — the earlier build failure was not about the flag +# combination, it was g2c v1.9.0 shipping without BUILD_G2C. RUN wget -q --content-disposition "https://github.com/NOAA-EMC/wgrib2/archive/refs/tags/v${WGRIB2_VERSION}.tar.gz" \ -O wgrib2.tar.gz \ && tar xzf wgrib2.tar.gz \ && cd wgrib2-${WGRIB2_VERSION} \ && mkdir build && cd build \ && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release \ - -DUSE_OPENJPEG=ON -DUSE_AEC=ON \ + -DUSE_PNG=ON -DUSE_OPENJPEG=ON -DUSE_AEC=ON \ && make -j$(nproc) \ && make install \ && strip /usr/local/bin/wgrib2