Bug report #17179

QGIS2.99 build does not find libpq-fe.h on OS X Sierra

Added by David Liontooth about 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Build/Install
Affected QGIS version:master Regression?:No
Operating System:OS X 10.12.6 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:25078

Description

Using https://github.com/qgis/QGIS/archive/master.zip and David Marteau's makefile at https://www.3liz.com/blog/rldhont/index.php?post/2017/06/01/How-to-build-qgis-on-OSX-with-MacPort and adding

                -DLIBZIP_INCLUDE_DIR:PATH=/opt/local/include \
                -DLIBZIP_CONF_INCLUDE_DIR:FILEPATH=/opt/local/lib/libzip/include \
                -DLIBZIP_LIBRARY:FILEPATH=/opt/local/lib/libzip.dylib \

I'm able to build QGIS2.99 to this point:

In file included from /Users/liontooth/software/QGIS/QGIS-2.99a/tests/src/providers/testqgspostgresprovider.cpp:4:
In file included from /Users/liontooth/software/QGIS/QGIS-2.99a/src/providers/postgres/qgspostgresprovider.h:24:
/Users/liontooth/software/QGIS/QGIS-2.99a/src/providers/postgres/qgspostgresconn.h:33:10: fatal error: 'libpq-fe.h' file not found

The file is /opt/local/include/postgresql96/libpq-fe.h, supplied by MacPort postgresql96. How do we tell the build process where to find it?

I tried adding paths to the makefile, which worked fine with libzip, and modifying cmake/FindPostgres.cmake directly, but no dice.

Cheers,
Dave

History

#1 Updated by David Marteau about 7 years ago

Hi David

Assuming that the Postgresql95 (or 96, but I'm still using 95 atm) port is installed, the cmake configure locate the postgres library:

-- Found PostgreSQL: /opt/local/lib/postgresql95/libpq.dylib

CMake use pg_config to locate the posgres library and includes, check that the CMakeCache.txt created in the build directory contains the following (should be quite similar with postgres96):

//Path to POSTGRESQL base directory
POSTGRESQL_PREFIX:PATH=
POSTGRES_CONFIG:FILEPATH=/opt/local/bin/pg_config
POSTGRES_CONFIG_PREFER_PATH:STRING=/bin
POSTGRES_INCLUDE_DIR:STRING=/opt/local/include/postgresql95
POSTGRES_LIBRARY:STRING=/opt/local/lib/postgresql95/libpq.dylib
//Determines whether POSTGRESQL support should be built
WITH_POSTGRESQL:BOOL=TRUE

There is also some cases where include paths are not reported to the CMakeLists.txt of some modules (see https://github.com/qgis/QGIS/pull/5196).

It seems that the compilation fail on compiling test, did the compilation succeeded when building the provider module itself ?

#2 Updated by Giovanni Manghi about 7 years ago

  • Status changed from Open to Feedback

#3 Updated by Giovanni Manghi over 6 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Closing for lack of feedback, please reopen if necessary.

Also available in: Atom PDF