pgRouting / osm2pgrouting

Import tool for OpenStreetMap data to pgRouting database
https://pgrouting.org
GNU General Public License v2.0
289 stars 111 forks source link

cmake: POSTGRESQL_LIBRARIES-NOTFOUND #177

Open x1alpha76 opened 7 years ago

x1alpha76 commented 7 years ago

I'm no cmake expert but i'm pretty sure lines 53 and 54 in cmake/FindPostgreSQL.cmake should be swapped. https://github.com/pgRouting/osm2pgrouting/blob/837adff96ab1b9e382b7cd8a1f5612c97a674251/cmake/FindPostgreSQL.cmake#L52-L56

iboates commented 7 years ago

I am having trouble installing - I tried doing what was suggested in this issue and I am still getting:

-- POSTGRESQL_LIBRARIES: POSTGRESQL_LIBRARIES-NOTFOUND

I also noticed that there are two installations on my system for postgresql, 9.5 and 9.6, so I added the 9.6 part to the file, but it is still not working, same error.

Image: http://i.imgur.com/O7ny2OK.png

x1alpha76 commented 7 years ago

Check for the following line when you run cmake: -- POSTGRESQL_PG_CONFIG is /usr/lib/postgresql/9.6/bin/pg_config

If this line doesn't exist or points to the incorrect version: Check your path and make sure that it is pointed to the correct pg_config. echo $PATH should contain, /usr/lib/postgresql/9.6/bin if it doesn't add it PATH=/usr/lib/postgresql/9.6/bin:$PATH

Check that the following command returns the expected path: pg_config --libdir

Check that either pq.so or libpq.so exists in this folder.

iboates commented 7 years ago

I installed postgresql-server-dev-9.6 because it said that it was missing when running cmake. After that, it seemed to let cmake run correctly, but now it says that:

-- POSTGRESQL_INCLUDE_DIR: /usr/include/postgresql

and

-- POSTGRESQL_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpq.so

When I enter echo $PATH I get:

/usr/lib/postgresql/9.6/bin:/home/isaac/bin:/home/isaac/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin

Running pg_config --libdir

gives me:

/usr/lib/x86_64-linux-gnu

I cannot seem to figure out a way to point the POSTGRESQL_LIBRARIES variable to the correct path, I have tried

cmake -H. -Bbuild -POSTGRESQL_PG_CONFIG:PATH=/usr/lib/postgresql/9.6/bin/pg_config

to no avail.

iboates commented 7 years ago

Just replying to say that I fixed my issue by completely reinstalling postgresql + postgis + pgrouting.

For some reason my POSTGRESQL_LIBRARIES still says -- POSTGRESQL_LIBRARIES: /usr/lib/x86_64-linux-gnu/libpq.so which doesn't look right but I guess it's all working now.

cvvergara commented 7 years ago

Interesting, I would like to know, what combination you had of postgresql + postgis + pgrouting when it was not working.

dkastl commented 7 years ago

@cvvergara , just that the original message of this issue doesn't get forgotten. don't you think that @x1alpha76 is correct, that the lines in the CMake file should be flipped? I also think, that PATHS should be moved one line up.

cvvergara commented 7 years ago

@dkastl I dont know, As far as I know there is no official FindPostgres. a different one is used on pgRouting that @woodbri made specifically when releasing version 2.0 This one has a different author and @sanak was the one that added it

woodbri commented 7 years ago

The issue with FindPostgres is that default version is very basic and does not support environments that have multiple versions of postgres installed.

The changes I made to is allow it to optionally allow the user to select a specific version of postgres, otherwise it will default to the highest installed version it can find.

There may be additional issues when running it on the OSX

On 8/21/2017 8:58 PM, Vicky Vergara wrote:

@dkastl https://github.com/dkastl I dont know, As far as I know there is no official FindPostgres. a different one is used on pgRouting that @woodbri https://github.com/woodbri made specifically when releasing version 2.0 This one has a different author and @sanak https://github.com/sanak was the one that added it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pgRouting/osm2pgrouting/issues/177#issuecomment-323889858, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxJghxNDxjM6VqObFDYbB_LXMB6WXIjks5saifPgaJpZM4O12lr.


This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

dkastl commented 7 years ago

@cvvergara , I didn't ask for something complicated to solve. Just I agree with @x1alpha76 , that there seems to be an error in how find_library is called. I looked at the CMake documentation, and I think it should be:

     find_library(POSTGRESQL_LIBRARIES NAMES pq libpq 
         PATHS 
         ${T_POSTGRESQL_LIB_DIR} 
         /usr/lib 
         /usr/local/lib 

... according to the documentation:

find_library (<VAR> NAMES name PATHS paths... NO_DEFAULT_PATH)
iboates commented 7 years ago

@cvvergara Unfortunately I don't have that information anymore. All I know is that totally reinstalling postgresql / postgis / pgrouting worked.