NOAA-EMC / wgrib2

Provides functionality for interacting with, reading, writing, and manipulating GRIB2 files.
27 stars 13 forks source link

starting to rebuild cmake build system #78

Closed edwardhartnett closed 7 months ago

edwardhartnett commented 9 months ago

Part of #60.

edwardhartnett commented 9 months ago

@webisu it's failing like this, any idea why?

/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Proj4.c:21:10: fatal error: proj_api.h: No such file or directory
   21 | #include "proj_api.h"
      |          ^~~~~~~~~~~~
compilation terminated.
webisu commented 9 months ago

The makefile should copy the proj_api.h from the proj source code directory to the include directory (grib2/include). Appears that I copied proj_api.h from the proj source code to the include by hand. Never noticed because the proj code was only there for testing the gctpc library, I haven't compared gctpc to the proj library in years, and the proj code was never exercised in years. That all changed with the UK Met Office started using a grid that was supported by proj but not gctpc.

On Fri, Jan 5, 2024 at 2:22 PM Edward Hartnett @.***> wrote:

@webisu https://github.com/webisu it's failing like this, any idea why?

/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Proj4.c:21:10: fatal error: proj_api.h: No such file or directory 21 | #include "proj_api.h" | ^~~~ compilation terminated.

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1879155179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZQJRA3K6G336LXAP63YNBHILAVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZZGE2TKMJXHE . You are receiving this because you were mentioned.Message ID: @.***>

edwardhartnett commented 8 months ago

Any reason not to make a permanent copy of proj_api.h?

edwardhartnett commented 8 months ago

@webisu there is no proj_api.h anywhere in the repo. Where should I copy it from?

webisu commented 8 months ago

It should be in proj-4.8.0/src/

On Mon, Jan 8, 2024 at 11:36 AM Edward Hartnett @.***> wrote:

@webisu https://github.com/webisu there is no proj_api.h anywhere in the repo. Where should I copy it from?

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1881433795, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZRFIWHEUDO4LXMEEGTYNQOB5AVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQZTGNZZGU . You are receiving this because you were mentioned.Message ID: @.***>

edwardhartnett commented 8 months ago

@webisu so I unpacked the proj4 tarball and found the proj_api.h file.

But there is no grib2/include directory anywhere in the repo:

ed@Pooh-Bah:~/wgrib2$ find . -name include
./wgrib2/gctpc/source/include
./wgrib2/gctpc/test/source/include
webisu commented 8 months ago

Right now wgrib2 is using proj-4.8.0 and right now they are on proj 9.3.1. It hasn't been a priority to remain current with proj because proj was only used by developers to test gctpc. However, wgrib2 v3.1.2 made proj a default library to handle aspherical equal area Lambert. So proj 9.3.1 needs to be tested, and the proj_api.h should be obtained from the proj 9.3.1 source code.

On Mon, Jan 8, 2024 at 11:35 AM Edward Hartnett @.***> wrote:

Any reason not to make a permanent copy of proj_api.h?

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1881431437, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZVZCVWAKAGSMAKHTILYNQN53AVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQZTCNBTG4 . You are receiving this because you were mentioned.Message ID: @.***>

webisu commented 8 months ago

Check ./include. grib2 is the base directory in the makefile build which became wgrib2 in the cmake build.

On Mon, Jan 8, 2024 at 11:52 AM Edward Hartnett @.***> wrote:

@webisu https://github.com/webisu so I unpacked the proj4 tarball and found the proj_api.h file.

But there is no grib2/include directory anywhere in the repo:

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1881461890, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZROCPVTGE2TXWIVCQ3YNQP3NAVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQ3DCOBZGA . You are receiving this because you were mentioned.Message ID: @.***>

edwardhartnett commented 8 months ago

There is no include directory in the repo.

Is it create by the makefile or some other way?

What should be in it, other than proj_api.h?

webisu commented 8 months ago

Every library has includes, compiled libraries and potentially .mod files. I put the ,h into ./include compiled libraries int ./lib *.mod into ./lib (bad choise) How do you plan to handle the situation?

BTW there is a makefile in the ./lib directory. This makefile takes all the compiled libraries and merges them into one big library.

On Mon, Jan 8, 2024 at 12:10 PM Edward Hartnett @.***> wrote:

There is no include directory in the repo.

Is it create by the makefile or some other way?

What should be in it, other than proj_api.h?

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1881496359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZXXC3TD7DEYPHY75PDYNQSBXAVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQ4TMMZVHE . You are receiving this because you were mentioned.Message ID: @.***>

edwardhartnett commented 8 months ago

Well in normal installs, there are usually two include directories. One is part of the source tree, and one is created on install in the install location. The install include will only have public include files. That is, files you want your users to include.

The repo include directory will have these files, and also any internal .h files.

For example, netcdf-c has an include directory https://github.com/Unidata/netcdf-c/tree/main/include, and when you install netcdf-c, it creates an include directory as part of the install, and copies some of the .h files there.

But the install include directory cannot be used in the build. It's created after the build it complete. So I have moved a copy of proj_api.h to the wgrib2 directory.

Currently you are using the wgrib2 directory as your include directory:

ed@Pooh-Bah:~/wgrib2$ find . -name '*.h'
./proj-4.8.0/src/pj_list.h
./proj-4.8.0/src/emess.h
./proj-4.8.0/src/org_proj4_Projections.h
./proj-4.8.0/src/proj_api.h
./proj-4.8.0/src/geocent.h
./proj-4.8.0/src/projects.h
./proj-4.8.0/src/geodesic.h
./c_api/c_wgrib2api.h
./proj.h
./iplib.v3.0.0/iplib_d.h
./iplib.v3.0.0/iplib_8.h
./iplib.v3.0.0/iplib_4.h
./iplib.v3.0.0/ipolate.h
./ip2lib_d/iplib_d.h
./ip2lib_d/iplib_8.h
./ip2lib_d/config.h
./ip2lib_d/iplib_4.h
./g2clib-1.4.0/drstemplates.h
./g2clib-1.4.0/pdstemplates.h
./g2clib-1.4.0/gridtemplates.h
./g2clib-1.4.0/grib2.h
./aux_progs/grb2.h
./wgrib2/proj4_wgrib2.h
./wgrib2/gctpc/source/include/proj.h
./wgrib2/gctpc/source/include/cproj.h
./wgrib2/gctpc/test/source/include/proj.h
./wgrib2/gctpc/test/source/include/cproj.h
./wgrib2/fnlist.h
./wgrib2/wgrib2.h
./wgrib2/config.h
./wgrib2/wgrib2nc.h
./wgrib2/proj_api.h
./wgrib2/wgrib2_api.h
./wgrib2/grid_id.h
./wgrib2/grb2.h
./wgrib2/ipolates.h
./wgrib2/CodeTable4_4.h

By the end of our work on wgrib2, almost all of these will be removed

edwardhartnett commented 8 months ago

OK, lots of progress but now it is failing with this. @webisu do you know what is happening?

/usr/bin/ld: CMakeFiles/wgrib2_exe.dir/wgrib2.c.o: in function `main':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:223: undefined reference to `init_check_v1_v2'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:247: undefined reference to `check_v1_v2'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:257: undefined reference to `is_v1_v2'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:507: undefined reference to `check_pdt_size'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:523: undefined reference to `f_match_inv'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:540: undefined reference to `run_flag'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:613: undefined reference to `fix_undef'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:803: undefined reference to `run_flag'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:804: undefined reference to `run_flag'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:810: undefined reference to `v1_if'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:813: undefined reference to `v1_else'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:816: undefined reference to `v1_endif'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:819: undefined reference to `v1_elseif'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/wgrib2.c:822: undefined reference to `run_flag'
/usr/bin/ld: CMakeFiles/obj_lib.dir/ExtName.c.o: in function `f_misc':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/ExtName.c:61: undefined reference to `f_cluster'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/ExtName.c:200: undefined reference to `f_type_reftime'
/usr/bin/ld: CMakeFiles/obj_lib.dir/Ftime2.c.o: in function `print_ftime2':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Ftime2.c:381: undefined reference to `ftime_mode'
/usr/bin/ld: CMakeFiles/obj_lib.dir/Hybrid.c.o: in function `f_hybrid':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Hybrid.c:18: undefined reference to `pdt_len'
/usr/bin/ld: CMakeFiles/obj_lib.dir/If_rec.c.o: in function `f_if_rec':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/If_rec.c:45: undefined reference to `run_flag'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/If_rec.c:46: undefined reference to `run_flag'
/usr/bin/ld: CMakeFiles/obj_lib.dir/Inv_no.c.o: in function `f_if_n':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Inv_no.c:85: undefined reference to `run_flag'
/usr/bin/ld: /home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Inv_no.c:86: undefined reference to `run_flag'
/usr/bin/ld: CMakeFiles/obj_lib.dir/Macro.c.o: in function `f_inv_f77':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Macro.c:199: undefined reference to `f_match_inv'
/usr/bin/ld: CMakeFiles/obj_lib.dir/Match.c.o: in function `f_if':
/home/runner/work/wgrib2/wgrib2/wgrib2/wgrib2/Match.c:179: undefined reference to `run_flag'
edwardhartnett commented 8 months ago

@webisu any idea why the build is not working? See message above for output...

webisu commented 8 months ago

Ed, What source do I have to download? Where are the build instructions? Wesley

On Wed, Jan 10, 2024 at 10:05 AM Edward Hartnett @.***> wrote:

@webisu https://github.com/webisu any idea why the build is not working? See message above for output...

— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/wgrib2/pull/78#issuecomment-1885021565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZRLOB7M565RJHGV5ZLYN2U27AVCNFSM6AAAAABBLFF6Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGAZDCNJWGU . You are receiving this because you were mentioned.Message ID: @.***>

edwardhartnett commented 8 months ago

Take a look here to see all the output: https://github.com/NOAA-EMC/wgrib2/actions/runs/7464889377/job/20312855802?pr=78