Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to support proj >= 8 #148

Closed
wants to merge 1 commit into from
Closed

Conversation

jim-minter
Copy link
Contributor

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 #142 (comment)) if it was felt preferable.

Fixes #130
Fixes #142

PJ_COORD in;
in.uv = { lon, lat };
PJ_COORD out = proj_trans(proj_, PJ_FWD, in);
return std::make_tuple<double, double>(std::move(out.xy.x), std::move(out.xy.y));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the previous version of this line references out.u and out.v, but I think that these should be x and y? The change is a no-op because of the underlying union, but I think x and y is more correct?

@TheBrinkOfTomorrow
Copy link

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
Copy link

flewid commented Jan 26, 2023

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
Copy link

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

danieldavidson added a commit to danieldavidson/goestools that referenced this pull request Jun 19, 2023
@jmaddencircuits
Copy link

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
#148 (comment)

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
Copy link

reynico commented Jan 24, 2024

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
Copy link
Owner

pietern commented Feb 10, 2024

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

@pietern pietern closed this Feb 10, 2024
@pietern
Copy link
Owner

pietern commented Feb 10, 2024

@reynico Looking into the compilation issue on 23.10 next.

This was referenced Feb 10, 2024
@pietern
Copy link
Owner

pietern commented Feb 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants