pietern / goestools

Tools to work with signals and files from GOES satellites
https://pietern.github.io/goestools/
BSD 2-Clause "Simplified" License
374 stars 83 forks source link

Update to support proj >= 8 #148

Closed jim-minter closed 9 months ago

jim-minter commented 2 years ago

According to https://proj.org/development/index.html, proj deprecated the legacy compatibility proj_api.h header in version 5 and removed it in version 8 in March 2021.

Currently goesproc supports proj >= 4 and < 8. This PR updates the use of the proj API such that goesproc would support proj >= 5 and <= 9 (current). This re-enables compilation with proj on the most recent versions of Ubuntu and Fedora (presumably among others).

I propose that proj 4 is sufficiently old that it would be better for goesproc to drop support for it, rather than having duplicate support for both proj APIs, but it would also be possible to refactor this PR to support both APIs (like the patch in https://github.com/pietern/goestools/issues/142#issuecomment-1133834609) if it was felt preferable.

Fixes #130 Fixes #142

TheBrinkOfTomorrow commented 1 year ago

Just for info: I just locally merged this commit with the latest main branch on Ubuntu 22.04.1, and the resultant build was successful (on Ubuntu 22.04.1 LTS on x86-64). I had the previously been experiencing the missing "proj_api.h" error..

Just wanted to say thanks for taking the time to put this together,,,

flewid commented 1 year ago

Just confirming this also worked for me. I am not sure I did it correctly (I pulled from jim-minter:update_proj, then did a git cherry-pick ). is there a way to apply this patch to the master source instead?

Davem734 commented 1 year ago

Just another confirmation that this fixed the compile error on Ubuntu 22.04.2 LTS These are the steps that I used to install the patched version:

  git clone https://github.com/pietern/goestools.git
  cd goestools
  wget https://github.com/pietern/goestools/pull/148.patch  # Patch to fix errors on 22.04
  patch -p1 < 148.patch
  git submodule init
  git submodule update --recursive
  mkdir build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
  sudo make install
jmaddencircuits commented 1 year ago

After following the instructions from the usradioguy website for my RaspberryPi 3B+, when I ran goesrecv -v -i 1 -c ~/goesrecv.conf the system reported -bash: goesrecv: command not found

I got an answer from user TheRealBanana0 and he pointed me to this link https://github.com/pietern/goestools/pull/148#issuecomment-1593582659

Apparently the issue I have is known and I followed new commands from Davem734 in this link Everything worked after I removed the old build directory and ran his new build commands.

reynico commented 10 months ago

Just another confirmation that this fixed the compile error on Ubuntu 22.04.2 LTS These are the steps that I used to install the patched version:

 git clone https://github.com/pietern/goestools.git
 cd goestools
 wget https://github.com/pietern/goestools/pull/148.patch  # Patch to fix errors on 22.04
 patch -p1 < 148.patch
 git submodule init
 git submodule update --recursive
 mkdir build
 cd build
 cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
 sudo make install

Hi Dave, by using that patch I was able to continue the make step a little bit further, now I got stuck here

[ 55%] Building CXX object src/dcs/CMakeFiles/dcs.dir/dcs.cc.o
In file included from /home/nico/Documents/goestools/src/dcs/dcs.cc:1:
/home/nico/Documents/goestools/src/dcs/dcs.h:14:3: error: ‘uint32_t’ does not name a type
   14 |   uint32_t length;
      |   ^~~~~~~~
/home/nico/Documents/goestools/src/dcs/dcs.h:8:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    7 | #include <vector>
  +++ |+#include <cstdint>
    8 |
/home/nico/Documents/goestools/src/dcs/dcs.h:19:15: error: ‘uint8_t’ was not declared in this scope
   19 |   std::vector<uint8_t> misc2;
      |               ^~~~~~~
/home/nico/Documents/goestools/src/dcs/dcs.h:19:15: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
/home/nico/Documents/goestools/src/dcs/dcs.h:19:22: error: template argument 1 is invalid
   19 |   std::vector<uint8_t> misc2;
      |                      ^
/home/nico/Documents/goestools/src/dcs/dcs.h:19:22: error: template argument 2 is invalid
/home/nico/Documents/goestools/src/dcs/dcs.h:26:3: error: ‘uint64_t’ does not name a type
   26 |   uint64_t address;
      |   ^~~~~~~~
/home/nico/Documents/goestools/src/dcs/dcs.h:26:3: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
/home/nico/Documents/goestools/src/dcs/dcs.cc: In member function ‘int dcs::FileHeader::readFrom(const char*, size_t)’:
/home/nico/Documents/goestools/src/dcs/dcs.cc:25:5: error: ‘length’ was not declared in this scope
   25 |     length = std::stoi(std::string(buf + nread, n));
      |     ^~~~~~
/home/nico/Documents/goestools/src/dcs/dcs.cc:41:11: error: request for member ‘resize’ in ‘((dcs::FileHeader*)this)->dcs::FileHeader::misc2’, which is of non-class type ‘int’                                                      41 |     misc2.resize(n);
      |           ^~~~~~
/home/nico/Documents/goestools/src/dcs/dcs.cc:42:18: error: request for member ‘data’ in ‘((dcs::FileHeader*)this)->dcs::FileHeader::misc2’, which is of non-class type ‘int’
   42 |     memcpy(misc2.data(), &buf[nread], n);
      |                  ^~~~
/home/nico/Documents/goestools/src/dcs/dcs.cc: In member function ‘int dcs::Header::readFrom(const char*, size_t)’:                                                                                                               /home/nico/Documents/goestools/src/dcs/dcs.cc:56:45: error: ‘address’ was not declared in this scope
   56 |     auto rv = sscanf(buf + nread, "%08lx", &address);
      |                                             ^~~~~~~
make[2]: *** [src/dcs/CMakeFiles/dcs.dir/build.make:76: src/dcs/CMakeFiles/dcs.dir/dcs.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1855: src/dcs/CMakeFiles/dcs.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

this is an Ubuntu 23.10 machine with proj=9.2.1-1

pietern commented 9 months ago

Thanks, @jim-minter. I merged your change in #167 after adding backwards compat for older distributions.

pietern commented 9 months ago

@reynico Looking into the compilation issue on 23.10 next.

pietern commented 9 months ago

@reynico The compilation issue on 23.10 is addressed in #169.