NOAA-EMC / NCEPLIBS-grib_util

This is a collection of NCEP GRIB related utilities.
Other
19 stars 11 forks source link

cmake doesn't handle absence of w3emc well #333

Closed edwardhartnett closed 4 months ago

edwardhartnett commented 4 months ago

From a user:

I see that you are an active developer on the NCEPLIBS-grib_util project. I am hoping to install this project for the purposes of reading and analyzing grib2 data files. (We are looking at this data as possible input for the purposes of modeling EV charging from wind energy generation, and the need to manage this charging as wind-power-generation ebbs and flows.)

I ran into a snag trying to compile and install NCEPLIBS-grib_util.

I was able to build and install all the prerequisites using cmake, including the following:

NCEPLIBS-bacio

NCEPLIBS-ip

NCEPLIBS-sp

NCEPLIBS-g2

NCEPLIBS-w3emc

But then, when I got back to building NCEPLIBS-grib_util, after getting all the way to 95% I ran into this error:

[ 95%] Linking Fortran executable test_degrib2_int

Undefined symbols for architecture arm64:

"w3as00", referenced from:

  _MAIN__ in tocgrib.F90.o

ld: symbol(s) not found for architecture arm64

collect2: error: ld returned 1 exit status

I am trying to compile on a Mac with an M2 chip (which, of course, is arm64 architecture). Have you been able to compile on a Mac? Would you expect this to work? Or do I need to try again on a different computer with x86 architecture? Let me know if you have any insight on this.

edwardhartnett commented 4 months ago

This will be handled better after we merge with g2.

steven-schmidt-inl commented 4 months ago

I am compiling and installing w3emc, and l thought I was linking with it.

I am also getting these warnings, which might have something to do with it but I'm not sure.

`$ make -- Found bacio: /usr/local/lib/libbacio.a (found version "2.6.0") -- Found ip: /usr/local/lib/libip_4.a (found version "5.0.0") -- Found bacio: /usr/local/lib/libbacio.a (found version "2.6.0") -- Found w3emc: /usr/local/lib/libw3emc_4.a (found version "2.11.0") -- Found g2: /usr/local/lib/libg2_4.a (found version "3.5.0") -- Using bacio library bacio -- In cnvgrib using bacio library bacio -- In cnvgrib /usr/local/lib/libjasper.dylib;/opt/homebrew/lib/libjpeg.dylib -- In cnvgrib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/libz.tbd -- g2c_compare not found. -- Configuring done (0.4s) CMake Warning at src/cnvgrib/CMakeLists.txt:25 (add_executable): Cannot generate a safe runtime search path for target cnvgrib because there is a cycle in the constraint graph:

dir 0 is [/usr/local/lib]
  dir 1 must precede it due to runtime library [libjasper.dylib]
dir 1 is [/opt/homebrew/anaconda3/envs/caldera/lib]
  dir 0 must precede it due to runtime library [libjasper.dylib]

Some of these libraries may not be found correctly.

CMake Warning at src/copygb2/CMakeLists.txt:20 (add_executable): Cannot generate a safe runtime search path for target copygb2 because there is a cycle in the constraint graph:

dir 0 is [/usr/local/lib]
  dir 1 must precede it due to runtime library [libjasper.dylib]
dir 1 is [/opt/homebrew/anaconda3/envs/caldera/lib]
  dir 0 must precede it due to runtime library [libjasper.dylib]

Some of these libraries may not be found correctly.

CMake Warning at src/degrib2/CMakeLists.txt:20 (add_executable): Cannot generate a safe runtime search path for target degrib2 because there is a cycle in the constraint graph:

dir 0 is [/usr/local/lib]
  dir 1 must precede it due to runtime library [libjasper.dylib]
dir 1 is [/opt/homebrew/anaconda3/envs/caldera/lib]
  dir 0 must precede it due to runtime library [libjasper.dylib]

Some of these libraries may not be found correctly.

CMake Warning at src/tocgrib2/CMakeLists.txt:20 (add_executable): Cannot generate a safe runtime search path for target tocgrib2 because there is a cycle in the constraint graph:

dir 0 is [/usr/local/lib]
  dir 1 must precede it due to runtime library [libjasper.dylib]
dir 1 is [/opt/homebrew/anaconda3/envs/caldera/lib]
  dir 0 must precede it due to runtime library [libjasper.dylib]

Some of these libraries may not be found correctly.

CMake Warning at src/tocgrib2super/CMakeLists.txt:20 (add_executable): Cannot generate a safe runtime search path for target tocgrib2super because there is a cycle in the constraint graph:

dir 0 is [/usr/local/lib]
  dir 1 must precede it due to runtime library [libjasper.dylib]
dir 1 is [/opt/homebrew/anaconda3/envs/caldera/lib]
  dir 0 must precede it due to runtime library [libjasper.dylib]

Some of these libraries may not be found correctly.`

edwardhartnett commented 4 months ago

Could it be that you have multiple versions of this, installed in different places?

steven-schmidt-inl commented 3 months ago

Unfortunately my work efforts have turned a different direction. (I figured out how to use the herbie python library, and I successfully compiled and installed the wgrib2 command line tool). Hopefully the issue is resolved if it comes up again.

edwardhartnett commented 3 months ago

The grib_utils repo has been merged into the g2 repo, so there will be no further releases of grib_utils. Moving forward, find these utils in NCEPLIBS-g2.

For NOAA users, this will not matter, as we will adjust all the module files as needed on NOAA machines.