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

Fails to build with Proj 5.0.0-rc2 #1

Open
sebastic opened this issue Feb 8, 2018 · 22 comments
Open

Fails to build with Proj 5.0.0-rc2 #1

sebastic opened this issue Feb 8, 2018 · 22 comments

Comments

@sebastic
Copy link

sebastic commented Feb 8, 2018

In preparation of the upcoming Proj 5.0.0 release, the libgeo-proj4-perl package was rebuilt with Proj 5.0.0-rc2. Unfortunately it failed to build:

x86_64-linux-gnu-gcc -c  -I./include -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fdebug-prefix-map=/build/libgeo-proj4-perl-1.09=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -DVERSION=\"1.09\" -DXS_VERSION=\"1.09\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE"   Proj4.c
In file included from Proj4.xs:7:0:
/usr/include/projects.h:161:40: error: conflicting types for 'UV'
 typedef struct { double u, v; }        UV;
                                        ^~
In file included from Proj4.xs:2:0:
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:1655:16: note: previous declaration of 'UV' was here
 typedef UVTYPE UV;
                ^~
Makefile:339: recipe for target 'Proj4.o' failed

projects.h is an internal API that Geo::Proj4 shouldn't use, this along with the other old APIs will be removed from the upcoming releases. See the NEWS file details.

@markov2
Copy link
Owner

markov2 commented Feb 8, 2018

In 2012, project.h became "internal". However, that did not offer all the things I needed. Maybe 5.0.0 has repaired that: I'll have to check.

The new typedef collision is horrible, because I do not have control on either header file. I have to dive into this to see whether there is a work-around. ASAP.

@sebastic
Copy link
Author

sebastic commented Feb 9, 2018

5.0.0 is not final yet, and the developers are very receptive to feedback. If there is something you need in the new API I'm sure they'll help get it implemented.

Note that PDL has exactly the same issue, so there is quite a bit of demand to make Proj 5.0.0 also work for Perl projects.

@markov2
Copy link
Owner

markov2 commented Feb 9, 2018 via email

@sebastic
Copy link
Author

sebastic commented Feb 9, 2018

Copying the code is probably not a good idea, too maintenance intensive. Although proj releases are not very frequent.

If the changes you need for Geo::Proj4 are too late for Proj 5.0.0, they could be implemented in the next release.

What help do you need from me? My role is mostly as the maintainer of the various Debian packages like proj, libgeo-proj4-perl & pdl.

@sebastic
Copy link
Author

sebastic commented Feb 9, 2018

I've forwarded your comments to the proj list, see:

http://lists.maptools.org/pipermail/proj/2018-February/007976.html

@markov2
Copy link
Owner

markov2 commented Feb 9, 2018 via email

@sebastic
Copy link
Author

sebastic commented Feb 9, 2018

Reply from Kristian Evers:

In principle we shouldn’t do API changes now, but on the other hand this is the first time the code is properly tested against other libraries so some adjustments can be necessary.

First off, the new API has the following functions:

const PJ_OPERATIONS *proj_list_operations(void);
const PJ_ELLPS *proj_list_ellps(void);
const PJ_UNITS *proj_list_units(void);
const PJ_PRIME_MERIDIANS *proj_list_prime_meridians(void);

Which does the same thing as the pj_get_*_ref() functions you mention. Except that there is no function for getting the list of datums. The reason being that the +datum parameter is “classic” PROJ functionality which will be phased out eventually (we are moving away from the WGS84 hub datum which +datum is based on).

So the simple answer is to use the new API. Unfortunately you will have the same problem since we also have a UV typedef in the new API. So at least I think we should change that in order to not clash with other libraries. Unless there is any objections to this, I will rename the types XY, LP, UV, XXYZ, LPZ, UVZ to PJ_XY, PJ_LP, PJ_UV, PJ_XYZ, PJ_LPZ, PJ_UVZ.

Another solution to the problem would be to move the mentioned functions to proj_api.h. I am reluctant to do that. I want an incentive to move to the new API so the transition happens as fast as possible.

How does that work for you?

@markov2
Copy link
Owner

markov2 commented Feb 9, 2018 via email

@markov2
Copy link
Owner

markov2 commented Feb 9, 2018 via email

@kbevers
Copy link

kbevers commented Feb 9, 2018

@markov2 I am looking into fixing this. We don't want this release to break anything for current users of the library (except for a few minor details announced in the release notes). This problem has just been overlooked. We are going to break things with the next major version release though.

I suggest you subscribe to the mailing list to keep updated in the future. I expect us to run into several similar issues since we don't get very much feedback from users of the library. Your help in avoiding such problems would be appreciated.

Can you get us on page http://proj4.org/development/bindings.html ?

You are welcome to submit a pull request with the addition.

@sebastic
Copy link
Author

sebastic commented Feb 9, 2018

The removal of the old APIs in proj is documented in the NEWS file:

DEPRECATIONS

o The projects.h header and the functions related to it is
considered deprecated from version 5.0.0 and onwards.

!!!     PROJECTS.H WILL BE REMOVED FROM THE LIBRARY     !!!
!!!                 WITH VERSION 6.0.0                  !!!

[...]

o The proj_api.h header and the functions related to it is
consided deprecated from version 5.0.0 and onwards.

!!!     PROJ_API.H WILL BE REMOVED FROM THE LIBRARY     !!!
!!!                 WITH VERSION 7.0.0                  !!!

Keeping support for the proj v4.x releases in Geo::Proj4 for some time makes sense. Support for the new API should be added for users of proj v5.x.

@markov2
Copy link
Owner

markov2 commented Feb 9, 2018 via email

@sebastic
Copy link
Author

With the renamed typedef in proj (OSGeo/PROJ@9c75d79) Geo::Proj4 not longer fails to build.

That resolves this issue for the most part. Geo::Proj4 still needs to be updated to use the new API.

@sebastic
Copy link
Author

PROJ 6.0.0 has been released and removes projects.h which is used by Geo::Proj4.

proj_api.h is also deprecated in PROJ 6.0.0 and will be removed in PROJ 7.0.0 (scheduled for March 2020).

When using proj_api.h with PROJ 6.0.0 -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1 needs to be added to CFLAGS to prevent a compiler error.

Geo::Proj4 should be updated to (also) support the proj.h API.

Using the embedded copy of PROJ 4.8.0 is not desirable.

@shawnlaffan
Copy link

The Alien::Proj4 package might be of use here, at least in the short term and for the version 4 bindings. https://github.com/PDLPorters/Alien-Proj4

If the system version of proj4 is >=5 then Alien::Proj4 will build a local version, visible only to the consumers of that package (all thanks to Alien::Build). Alien::Build will use a detected system library by default, so there will be issues where it is built against a system proj v4 and a user later updates to a more recent version. It might therefore be worth trying to enforce a share install by Alien::Proj4.

The PDL issue noted in #1 (comment) has been addressed in the PDLA fork by using Alien::Proj4.
https://github.com/PDLPorters/pdla-gis

There is also Alien::proj which is on CPAN and does not (yet) lock to a specific version. Github repo is at https://github.com/shawnlaffan/perl-alien-proj4

@sebastic
Copy link
Author

Still no progress, eh?

We're going to start the proj transition in Debian soon. That will also trigger the removal of Geo::Proj4 (and its reverse dependencies like Geo::Point) from Debian, as discussed in:

https://rt.cpan.org/Public/Bug/Display.html?id=129222

@markov2
Copy link
Owner

markov2 commented Jul 12, 2019 via email

ppisar added a commit to ppisar/perl5-Geo-Proj4 that referenced this issue Sep 9, 2019
Proj 6.2.0 depreacted some API and removed some (retrieving a list of
datums). This patch aims to make the XS code buildable with 6.2.0 as
well as with the previous Proj versions. The unaviable API is solved
by returning an empty list.

The code builds fine but some tests fail. Probably pj_fwd() changed
not only syntax (argument types), but also semantics. I have no
idea what proj did or should do. Any advice is welcome.

<markov2#1>
ppisar added a commit to ppisar/perl5-Geo-Proj4 that referenced this issue Sep 9, 2019
Proj 6.2.0 depreacted some API and removed some (retrieving a list of
datums). This patch aims to make the XS code buildable with 6.2.0 as
well as with the previous Proj versions. The unaviable API is solved
by returning an empty list.

The code builds fine but some tests fail. Probably pj_fwd() changed
not only syntax (argument types), but also semantics. I have no
idea what proj did or should do. Any advice is welcome.

<markov2#1>
<markov2#3>
@ppisar
Copy link

ppisar commented Sep 9, 2019

You can use #4 as base for you work. It builds but tests do not pass. I followed only the syntax. Probably it needs more love and understanding to Proj I don't have.

@markov2
Copy link
Owner

markov2 commented Sep 9, 2019

The issue is that the library has structurally changed completely, from 2D into 4D and such. There is no simple repair.

@ppisar
Copy link

ppisar commented Sep 10, 2019

In that case keeping Geo-Proj4 for Proj 4 only and forking it for Proj 6, let's say Geo-Proj6, would be more reasonable.

@sebastic
Copy link
Author

I suggest to drop the version from the project name like PROJ has done.

@markov2
Copy link
Owner

markov2 commented Sep 10, 2019

There are many reasons why that is not possible... for one: Geo::Proj is already in use by an other module (accidentally also owned by me ;-)

My current plan is to set Geo::Proj5 and Geo::Proj6 (and Geo::Proj7) next to another, and keep Geo::Proj as the abstract interface, which roles it currently has as well.

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

No branches or pull requests

5 participants