2

I recently ran a full update on my Manjaro-System, afterwards I opened QGIS and got the following message.

qgis: error while loading shared libraries: libproj.so.15: cannot open shared object file: No such file or directory

I solved this by reinstalling QGIS to the current LTR (3.16.5). However, when I opened my current project containing a PostGIS-Layer it could not connect to this layer. I went into pgAdmin and checked. The database is still there and working. I can open any table, that has no geometry/geography column, but when I try to display the data of the table, that is not connecting in QGIS (containing one geography column) I get the following error:

ERROR: could not load library "/usr/lib/postgresql/postgis-3.so": libproj.so.15: cannot open shared object file: No such file or directory SQL state: 58P01

I checked online and found PostGIS 2.5 error while compiling from source on Ubuntu Server 18.04, indicating, that I may have to update my proj package. I checked and apparently it is the outdated version 6.3.2, which is still in the package manager. I manually updated to 8.0.0-1 but this didn't solve the problem and also caused the same QGIS error in the console again.

Currently the version setup is:

  1. QGIS: Version 3.16.5
  2. Postgres: Version 12.6-1
  3. PostGIS: Version 3.0.3-1
  4. proj: Version 6.3.2-1
  5. Manjaro: KDE-Plasma 5.21.3
  6. Kernel: 4.19.183-1-Manjaro

I think it has something to do with proj but I don't know, what exactly is wrong and don't want to dabble without a clue.

2 Answers 2

2

Seems like you have more than on proj library installed. This is known as a cause of trouble. You have to choose one proj version and get rid of other dangling proj libs than you might have around.

I'm not familiar with manjaro. Use find or other similar tool to find out all libproj files, like:

find /usr/lib/ -name libproj.so'*' -print

You you find other version that were not the ones installed by your proj package version 6.3.2-1, just remove them.

What is your GDAL version and which PROJ version it depends?

Check GDAL dependency

To know which proj version GDAL depends on, we can use ldd.

ldd $(which gdalinfo)

To get just the output we want:

ldd $(which gdalinfo) | grep -E 'proj|geos'
    libgeos_c.so.1 => /usr/lib/x86_64-linux-gnu/libgeos_c.so.1 (0x00007f6cae6e8000)
    libproj.so.15 => /usr/local/lib/libproj.so.15 (0x00007f6caa184000)
    libgeos-3.7.1.so => /usr/lib/x86_64-linux-gnu/libgeos-3.7.1.so (0x00007f6ca7d42000)

Check Postgis dependency

The same works to know the exact Postgis dependencies. Looking at the error you got, you (PostgreSQL) are using /usr/lib/postgresql/postgis-3.so.

Check this:

ldd /usr/lib/postgresql/postgis-3.so
5
  • Thanks for the hint. The output for the command line you wrote is for me as follows: '/usr/lib/libproj.so.15.3.2 /usr/lib/libproj.so.15 /usr/lib/libproj.so' My GDAL version is 3.0.4-20. I am not sure, whic PROJ-Version it depends on. How can I find this out? Commented Apr 11, 2021 at 13:28
  • Seems good to me. You have no mess with different proj libraries. I've added on the answer how you can see gdal and postgis dependencies. Check both dependencies.
    – jgrocha
    Commented Apr 11, 2021 at 19:49
  • I checked both the dependencies for GDAL and PostGIS: They both list libproj.so.15 => usr/lib/libproj.so.15. If I uninstall this package they list it as libpro.so.15 => not found. However, the error still prevails. Commented Apr 12, 2021 at 14:31
  • If the library is there and Postgis is not able to find it, something might be wrong with the ld library path. Check ldconfig -v -N | grep proj to make sure libproj is available (it should be, since /usr/lib is a usual path for libraries). Also do a sudo ldconfig to make sure you recreate your library cache before tying Postgis. I'm running out of options. It is strange that Postgis is not able to find a library in the library path :-(
    – jgrocha
    Commented Apr 12, 2021 at 22:08
  • It may be an issue with a wrong path after all. I tried your hints: ldconfig -v -N | grep pro returns: ldconfig: Path /usr/lib64given more than once (from <builtin>: 0 and <builtin>:0) ldconfic: Can't stat /usr/libx32: No such file or directory libgrass_grpoj.7.8.so -> libgrass_gproj.7.8.so libproj.so.15 -> libproj.so.15.3.2 Commented Apr 13, 2021 at 16:07
0

Thanks to the local Linux User Group I found a solution to the problem. It turned out, that PostGIS was updated in the background and the new version did not correspond with PostgreSQL 12.6 any more. Since PostGIS was already installed, it did not show me this but the error message above instead.

To check if PostGIS is still compatible with PostgreSQL, I create a new database and then tried to add the PostGIS extension. I got the following message, that cleared things up:

test=# CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/share/postgresql/extensionpost.control": No such file or directory
test=# CREATE EXTENSION postgis;
ERROR: PostGIS built for PostgreSQL 13.0 cannot be loaded in PostgreSQL 12.6

So I updated PostgreSQL, set up a new database cluster and used pg_restore on the last .sql from my automatic pg_dump to recreate the database. It now works as before again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.