Skip to content

Newer PROJ version causes build error; API has changed recently #6

@guspolly

Description

@guspolly

I'm attempting to build redistricter on Debian testing, which currently uses PROJ version 7.2.1.

The first notice that something was amiss re: PROJ was this compile error:

In file included from /mnt/e/redistricter/cpp/linkfixup.cpp:11:
/usr/include/proj_api.h:37:2: error: #error 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
   37 | #error 'To use the proj_api.h you must define the macro ACCEPT_USE_OF_DEPRECATED_PROJ_API_H'
      |  ^~~~~
make: *** [<builtin>: /mnt/e/redistricter/cpp/linkfixup.o] Error 1

I figured out how and where to do that (I'm not a coder), and added #define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1 before #include <proj_api.h> in linkfixup.cpp.

Then make gave these errors (line numbers are +1 compared to git because I added the macro at line 11):

/usr/bin/ld: /mnt/e/redistricter/cpp/linkfixup.o: in function `Proj::initRadians(double, double)':
/mnt/e/redistricter/cpp/linkfixup.cpp:58: undefined reference to `pj_init_plus'
/usr/bin/ld: /mnt/e/redistricter/cpp/linkfixup.cpp:59: undefined reference to `pj_init_plus'
/usr/bin/ld: /mnt/e/redistricter/cpp/linkfixup.o: in function `Proj::clear()':
/mnt/e/redistricter/cpp/linkfixup.cpp:71: undefined reference to `pj_free'
/usr/bin/ld: /mnt/e/redistricter/cpp/linkfixup.cpp:75: undefined reference to `pj_free'
/usr/bin/ld: /mnt/e/redistricter/cpp/linkfixup.o: in function `Proj::transform(double*, double*)':
/mnt/e/redistricter/cpp/linkfixup.cpp:81: undefined reference to `pj_transform'
collect2: error: ld returned 1 exit status
make: *** [cpp/cpp.make:51: linkfixup] Error 1

According to https://proj.org/development/migration.html, the PROJ API was overhauled in version 6, and the functions pj_init_plus, pj_free, and pj_transform are among those that were changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions