NOAA-EMC / NCEPLIBS

Top level repo containing submodules for NCEPLIBS and associated dependencies for superproject builds
Other
42 stars 18 forks source link

wgrib2 build error on mac M1 #205

Closed NeilBarton-NOAA closed 2 years ago

NeilBarton-NOAA commented 2 years ago

The error message is

Undefined symbols for architecture arm64: "_jpc_decode", referenced from: _unpk_grib in unpk.c.o "_jpc_encode", referenced from: _enc_jpeg2000_clone in enc_jpeg2000_clone.c.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[6]: [wgrib2/wgrib2] Error 1 make[5]: [wgrib2/CMakeFiles/wgrib2_exe.dir/all] Error 2

previous to this Error 2, there are a bunch of warnings stating

ld: warning: could not create compact unwind for ludcmp: register 73 saved somewhere other than in frame ld: warning: object file (/Users/neilbarton/NOAA/NCEPLIBS/sp-2.3.3/lib/libsp_d.a(sptranf0.f.o)) was built for newer macOS version (12.3) than being linked (12.0)

To Reproduce I'm trying to build on a Mac Mini with an M1 chip. I'm using brew to install the needed dependencies and a brew list results in

==> Formulae autoconf coreutils gmp isl libaec libpng mpfr openssl@1.1 python@3.9 xz ca-certificates gcc hdf5 jasper libevent m4 netcdf pkg-config readline zstd cmake gdbm hwloc jpeg libmpc mpdecimal open-mpi pyenv sqlite

==> Casks rar

I followed the wiki steps before the install. Please let me know if you need more information.

edwardhartnett commented 2 years ago

This is due to a change in the Jasper library starting with jasper 3.x. So a quick fix is to roll back to jasper-2.0.33.

The NCEPLIBS team is not supporting wgrib2, and we recommend that wgrib2 not be used in operational processing, due to instabilities and incompatibilities in it's build.

JeffBeck-NOAA commented 2 years ago

@NeilBarton-NOAA, please let us know if the jasper change resolves your issue. Thanks. We're in the process of moving to g2 (instead of wgrib2), but it hasn't quite been completely implemented in UFS_UTILS. Hopefully soon.

NeilBarton-NOAA commented 2 years ago

Since wgrib2 is not needed for my application, I just compiled the other items. Also rolling back to an older version of jasper with brew was not as simple as expected.

However, I will not be revisiting this and this can be closed in my opinion