Open StevePny opened 2 years ago
This repo is a fork of the official repo with a CMake build based on wgrib2 2.0.8.
We are no longer maintaining this fork because of difficulties keeping up-to-date with the upstream version.
I would recommend using the official repo at: https://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/ (download here https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/)
@kgerheiser This is the repo for wgrib2 that is pointed to by https://github.com/NOAA-EMC/NCEPLIBS-external . Could you coordinate with them to update the links in their repo if this is out of date, since that is what is being suggested for all UFS community builds as far as I can tell? As it currently stands, wgrib2 breaks the entire NCEPLIBS-external build for me. I'm working on building wgrib2 separately in a Docker container and shutting it off in the NCEPLIB-external cmake build, but it should be fixed there.
I've tried v3.1.0 and it doesn't build for me in ubuntu: root@9ef4a95fb85f:/tmp/grib2# make cd /tmp/grib2/zlib-1.2.11 && export CFLAGS="-I/opt/hdf5/include -I/tmp/grib2/include -O2 -DIFORT -cxxlib -qopenmp -I/tmp/grib2/jasper-1.900.1/src/libjasper/include " && ./configure --prefix=/tmp/grib2 --static && make install Compiler error reporting is too harsh for ./configure (perhaps remove -Werror). ** ./configure aborting. make: *** [makefile:903: /tmp/grib2/lib/libz.a] Error 1
The best I can do right now to get a successful build is to turn off Jasper: RUN cd /tmp \ && git clone https://github.com/NOAA-EMC/NCEPLIBS-wgrib2 \ && cd NCEPLIBS-wgrib2 \ && git checkout ${WGRIB2_VERSION} \ && mkdir -p build && cd build \ && cmake -DCMAKE_INSTALL_PREFIX='/opt' -DUSE_JASPER=OFF .. \ && make -j${MAKEJOBS} && make install
We will remove wgrib2 from NCEPLIBS-external.
I found a solution to this problem. Apparently, this repo may be using features that are no longer supported by the more recent versions of Jasper. I changed from Jasper version 3.0.2 to Jasper version 2.0.33 and all of wgrib2, nceplibs, and ufstools build in the ubuntu-arm64 environment. In this case, I have to build jasper from source:
RUN apt-get update && \
apt-get -y install \
libpng-dev \
libjpeg-dev
RUN cd /tmp \
&& git clone https://github.com/jasper-software/jasper.git \
&& cd jasper \
&& git checkout version-${JASPER_VERSION} \
&& mkdir -p build \
&& cmake -H./ -B./build -DCMAKE_INSTALL_PREFIX=$JASPER_DIR ${JASPER_OPTIONS} \
&& cmake --build build \
&& cmake --build build --target install
ENV Jasper_ROOT=$JASPER_DIR
ENV LD_LIBRARY_PATH=${JASPER_DIR}/lib:${LD_LIBRARY_PATH}
That seems plausible. We have never tested with Jasper 3.x.
Well looks like we need to upgrade jasper...
I upgraded jasper and am seeing this problem with NCEPLIBS-g2.
Just hit this issue too. I'm going to pin the Spack package to v2. PR is 30736
FYI @t-brown we've got a Spack build of wgrib2 that uses the official source, so you can use new versions. The CMake build isn't being updated anymore. I think we're planning to merge this into the main Spack repo, if you have any thoughts. On the upside you get new versions, but on the downside you have to deal with wgrib2's quirkiness in packaging ancient internal libraries (but I think we've fixed that with various patches).
@kgerheiser Yes, I'd love to see this merged into the main Spack repo!
Only one very small nitpick. On line 31, s/grib/GRIB/
as it is an acroynm?
I've managed to compile (WPS/ungrib.exe) by forcing the static jasper lib. in configure.wps
COMPRESSION_LIBS = /usr/local/apps/jasper/3.0.5/intel/lib64/libjasper.a -ljpeg -lpng -lpthread
ungrib/src/ngl/g2/Makefile says: # -DUSE_JPEG2000 requires libjasper.a
wgrib2 is now being maintained with the CMake build, and the GitHub site is the sole home of wgrib2. All future releases will have a CMake build system.
Some updates:
I have an error when building on aarch64 / arm64 / apple M1 in a docker container using either ubuntu or fedora:
The include statement for jasper is here:
In jasper the jpc_encode and jpc_decode are in jasper/jas_image.h:
But jasper/jasper.h includes jasper/jas_image.h:
In:
It shows that these functions are only defined if JAS_INCLUDE_JPC_CODEC is defined:
I commented out the "#if defined" statement above to ensure that this is included in the cmake build.
I tried adding these options when building Jasper, but it didn't help:
So these should be visible, but they are not seen by the linker. I'm still not sure why.
I can compile if I set: