pgrouting icon indicating copy to clipboard operation
pgrouting copied to clipboard

homebrew - install pgrouting

Open 5james opened this issue 7 years ago • 6 comments

Expected behavior and actual behavior

CREATE EXTENSION pgrouting; in pgadmin should've created an extension but it seems that installing it through homebrew does not install (link) it at postgres. I don't know if it should but for example postgis is uploading in /Library/PostgreSQL/9.6/share/postgresql/extension/. When I try to CREATE EXTENSION pgrouting it demands pgrouting.control which is in /usr/local/Cellar/pgrouting/2.4.1/share/postgresql. On the other hand postgis.control is both in /usr/local/Cellar/postgis/2.3.2/share/postgresql/extension and /Library/PostgreSQL/9.6/share/postgresql/extension/. When I tried to copy /usr/local/Cellar/... to /Library/PostgreSQL/9.6/share/postgresql/extension/. But then I received this message

ERROR: could not access file "$libdir/libpgrouting-2.4": No such file or directory

I tried to copy libpgrouting-2.4.so and adding /usr/local/Cellar/pgrouting/2.4.1/lib to dynamic library in postgres but none of those worked.

One of those folders should hold libpgrouting-2.4.so because when I copied it, it worked:

/usr/local/Cellar/pgrouting/2.4.1/lib/postgresql/libpgrouting-2.4.so /usr/local/Cellar/postgresql/9.6.3/lib/postgresql/libpgrouting-2.4.so /usr/local/lib/postgresql/libpgrouting-2.4.so /usr/local/lib/libpgrouting-2.4.so /usr/local/Cellar/postgresql/9.6.3/lib/libpgrouting-2.4.so /usr/local/Cellar/postgresql/9.6.3/lib/postgresql/libpgrouting-2.4.so 2 /Library/PostgreSQL/9.6/lib/libpgrouting-2.4.so /Library/PostgreSQL/9.6/lib/postgresql/libpgrouting-2.4.so

Steps to reproduce the problem

  1. Install postgres with EDB installer (in stack builder install postgis)
  2. In console: brew install pgrouting
  3. Cannot "CREATE EXTENSION pgrouting;" (It does not link to postgres)

Specifications like the version of pgRouting/PostGIS and PostgreSQL as well as Operating System

version = PostgreSQL 9.6.3 on x86_64-apple-darwin, compiled by i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00), 64-bit

postgis = POSTGIS="2.3.2 r15302" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.0.1, released 2015/09/15 GDAL_DATA not found" LIBXML="2.9.4" LIBJSON="0.12" TOPOLOGY RASTER

pgr = none

5james avatar May 21 '17 19:05 5james

I must confess I dont have the slightest idea of what is wrong, I don't have a mac I don't know about the homebrew, I relaly don't know about OS-X. This instructions were given to my by @fxcoudert. Maybe he can help on your problem.

cvvergara avatar May 21 '17 23:05 cvvergara

Mybe @dersvenhesse was the one that game the instructions, I forgot who

cvvergara avatar May 21 '17 23:05 cvvergara

I would recommend installing postgresql and postgis via homebrew as well, this worked for me.

Do you mind trying to uninstall your existing postgresql and do a brew install pgrouting afterwards? This should install postgresql via brew as well since it is listed as a dependency: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pgrouting.rb

dersvenhesse avatar May 22 '17 08:05 dersvenhesse

I get following error while installing pgrouting with homebrew. First order depedencies on brew.sh match.

==> Reinstalling pgrouting 
==> Pouring pgrouting-3.1.0.catalina.bottle.tar.gz
Warning: pgrouting dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺  /usr/local/Cellar/pgrouting/3.1.0: 15 files, 4.5MB

Which gcc version I should have?

laurivaltteri avatar Oct 20 '20 12:10 laurivaltteri

@laurivaltteri Well, from https://github.com/Homebrew/homebrew-core/issues/32112, it seems to be no problem (just warning).

I confirmed that postgis also have same warning, but basic example query seems to work without problem. But, about pgrouting, I encountered the following error on my macOS Mojave (10.14.6),

pg13test=# CREATE EXTENSION postgis;
CREATE EXTENSION
pg13test=# CREATE EXTENSION pgrouting;
ERROR:  could not load library "/usr/local/lib/postgresql/libpgrouting-3.1.so": dlopen(/usr/local/lib/postgresql/libpgrouting-3.1.so, 10): Symbol not found: _elog_finish
  Referenced from: /usr/local/lib/postgresql/libpgrouting-3.1.so
  Expected in: /usr/local/opt/postgresql/bin/postgres
 in /usr/local/lib/postgresql/libpgrouting-3.1.so

If you encounter the similar issue, please try pgrouting master branch installation as follows.

$ brew uninstall pgrouting
$ brew install --HEAD pgrouting

sanak avatar Oct 20 '20 16:10 sanak

@laurivaltteri Well, from Homebrew/homebrew-core#32112, it seems to be no problem (just warning).

I confirmed that postgis also have same warning, but basic example query seems to work without problem. But, about pgrouting, I encountered the following error on my macOS Mojave (10.14.6),

pg13test=# CREATE EXTENSION postgis;
CREATE EXTENSION
pg13test=# CREATE EXTENSION pgrouting;
ERROR:  could not load library "/usr/local/lib/postgresql/libpgrouting-3.1.so": dlopen(/usr/local/lib/postgresql/libpgrouting-3.1.so, 10): Symbol not found: _elog_finish
  Referenced from: /usr/local/lib/postgresql/libpgrouting-3.1.so
  Expected in: /usr/local/opt/postgresql/bin/postgres
 in /usr/local/lib/postgresql/libpgrouting-3.1.so

If you encounter the similar issue, please try pgrouting master branch installation as follows.

$ brew uninstall pgrouting
$ brew install --HEAD pgrouting

Great, installing from master did the trick. Many thanks @sanak!

laurivaltteri avatar Oct 21 '20 06:10 laurivaltteri