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

compile fails under ubuntu noble if you include proj.h #4435

Closed
captain-igloo opened this issue Mar 26, 2024 · 2 comments
Closed

compile fails under ubuntu noble if you include proj.h #4435

captain-igloo opened this issue Mar 26, 2024 · 2 comments
Assignees

Comments

@captain-igloo
Copy link

The following fails to compile under ubuntu noble. The error is error: conflicting declaration 'using PJ_CONTEXT = struct projCtx_t'. Is this a problem with mapnik or with the ubuntu package?

#include <proj.h>
#include <mapnik/map.hpp>

int main() {
    return 0;
}
$ git clone https://github.com/captain-igloo/mapnik-bug.git

$ cd mapnik-bug

$ docker build -t noble  -f Dockerfile  .

$ docker run noble g++ main.cpp

In file included from /usr/include/mapnik/proj_transform.hpp:29,
                 from /usr/include/mapnik/map.hpp:36,
                 from main.cpp:2:
/usr/include/mapnik/projection.hpp:46:7: error: conflicting declaration 'using PJ_CONTEXT = struct projCtx_t'
   46 | using PJ_CONTEXT = struct projCtx_t;
      |       ^~~~~~~~~~
In file included from main.cpp:1:
/usr/include/proj.h:387:23: note: previous declaration as 'typedef struct pj_ctx PJ_CONTEXT'
  387 | typedef struct pj_ctx PJ_CONTEXT;
@artemp
Copy link
Member

artemp commented Mar 27, 2024

@captain-igloo quick fix

g++ -DPROJ_VERSION=90301 main.cpp 

You can get compile/link flags using mapnik-config e.g

mapnik-config --defines 

-DMAPNIK_MEMORY_MAPPED_FILE -DMAPNIK_HAS_DLCFN -DBIGINT -DBOOST_REGEX_HAS_ICU -DHAVE_JPEG -DMAPNIK_USE_PROJ -DPROJ_VERSION=90301 -DHAVE_PNG -DHAVE_WEBP -DHAVE_TIFF -DLINUX -DMAPNIK_THREADSAFE -DBOOST_SPIRIT_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_NO_PREDEFINED_TERMINALS=1 -DBOOST_PHOENIX_STL_TUPLE_H_ -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DNDEBUG -DHAVE_CAIRO -DGRID_RENDERER -DHAVE_LIBXML2

@artemp artemp closed this as completed Mar 27, 2024
@artemp artemp self-assigned this Mar 27, 2024
@captain-igloo
Copy link
Author

Thank you

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

2 participants