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

Add postgres support for GDAL #5349

Closed
wants to merge 4 commits into from
Closed

Conversation

maxfreu
Copy link
Contributor

@maxfreu maxfreu commented Aug 24, 2022

This adds postgresql support to GDAL. This is my first PR to Yggdrasil, so I hope it works :D
cc @visr @evetion

@maxfreu
Copy link
Contributor Author

maxfreu commented Aug 24, 2022

still fails, looks like it can't find some headers:

[10:48:21] In file included from postgisraster.h:41:0,
[10:48:21]                  from postgisrasterdataset.cpp:38:
[10:48:21] /opt/x86_64-linux-gnu/bin/../x86_64-linux-gnu/sys-root/usr/local/include/libpq-fe.h:29:10: fatal error: postgres_ext.h: No such file or directory
[10:48:21]  #include "postgres_ext.h"
[10:48:21]           ^~~~~~~~~~~~~~~~
[10:48:21] compilation terminated.

Unfortunately --with-pg only allows yes/no and not to specify some include path. Compiling C is always a nice reminder of why to use julia...

@visr
Copy link
Contributor

visr commented Aug 24, 2022

It looks like you might need to set the PG_LIB and PG_INC environment variables to help it find it.

OSGeo/gdal#1657 (comment)
https://lists.osgeo.org/pipermail/gdal-dev/2003-November/001433.html

@maxfreu
Copy link
Contributor Author

maxfreu commented Aug 25, 2022

It looks like you might need to set the PG_LIB and PG_INC environment variables to help it find it.

Aaah, good old mailing lists :D

I'm a bit surprised: I cloned the original GDAL directory including the patches, but when I execute the script build_tarballs.jl for linux x64 I get configure: error: PROJ 6 symbols not found o.O In the meantime I'll run one more test via github build.

@visr
Copy link
Contributor

visr commented Aug 25, 2022

I think you have to set the environment variables before calling configure, just like the others with export VAR="VAL".
Some relevant lines from the log:

PKG_CONFIG  path to pkg-config utility
PKG_CONFIG_PATH
            directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
            path overriding pkg-config's built-in search path
PQ_CFLAGS   C compiler flags for PQ, overriding pkg-config
PQ_LIBS     linker flags for PQ, overriding pkg-config

checking for PostgreSQL... checking for arm-linux-gnueabihf-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.21... yes
checking for PQ... yes
checking for PQconnectdb in -lpq... yes

@maxfreu
Copy link
Contributor Author

maxfreu commented Aug 25, 2022

Yes, that's the cleaner solution. I just copied from the issue comment. I still get two errors:
configure: WARNING: unrecognized options: --with-tiff and configure: error: PROJ 6 symbols not found. I also get the PROJ6 error locally, looks like some version incompatibility? However, I havent changed anything wrt PROJ_jll and LibPQ_jll does not have PROJ as dependency.

@maxfreu
Copy link
Contributor Author

maxfreu commented Aug 25, 2022

I also changed the --with-tiff to --with-libtiff and now it complains libtiff >= 4.0 is required. I think I should revert that; one problem is enough.

@visr
Copy link
Contributor

visr commented Aug 25, 2022

Hmm yeah I wonder. It seems the build is indeed broken regardless of Postgres.

Soon we will need to switch this build to the CMake build system, since the current one is deprecated and will be removed in GDAL 3.6: https://github.com/OSGeo/gdal/blob/v3.5.1/NEWS.md#in-a-nutshell

Not sure how much work it would be, but perhaps if we make that switch, adding new dependencies will be easier.

@maxfreu maxfreu marked this pull request as draft August 26, 2022 07:42
@maxfreu
Copy link
Contributor Author

maxfreu commented Aug 26, 2022

Yeah, I converted this to a draft then, so that we can first convert the build to cmake and add postgres later. Or if everything works in one go thats also fine.

visr added a commit to visr/Yggdrasil that referenced this pull request Sep 4, 2022
visr added a commit to visr/Yggdrasil that referenced this pull request Sep 4, 2022
@giordano giordano closed this in 5df8f7f Sep 4, 2022
@maxfreu
Copy link
Contributor Author

maxfreu commented Oct 18, 2022

@visr the issue with postgres was that it did not install all needed header files. #5700 should fix this; then we can add support.

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

Successfully merging this pull request may close these issues.

2 participants