OSGeo / homebrew-osgeo4mac

Mac homebrew tap for maintaining a stable work environment for the OSGeo.org geospatial toolset
https://git.io/fhh3X
BSD 3-Clause "New" or "Revised" License
364 stars 111 forks source link

QGIS doesn't start after upgrade: "dyld: Library not loaded: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib" #1261

Closed GuiAlDuS closed 4 years ago

GuiAlDuS commented 5 years ago

Please answers the following

I've...

Describe the bug

I run brew upgrade yesterday without getting any error but after finishing upgrading I was not able to run QGIS again.

When I run from terminal /usr/local/opt/osgeo-qgis/bin/osgeo-qgis I get:

dyld: Library not loaded: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib Referenced from: /usr/local/opt/osgeo-qgis/QGIS.app/Contents/MacOS/QGIS Reason: image not found /usr/local/opt/osgeo-qgis/bin/osgeo-qgis: line 20: 41976 Abort trap: 6 /usr/local/opt/osgeo-qgis/QGIS.app/Contents/MacOS/QGIS "$@"

I reinstalled QGIS following all the instructions but I'm still getting the same error.

Any idea what can be the problem?

Thanks!

mjigmond commented 5 years ago

I can confirm it happens on a fresh install as well. It seems like a library mismatch. QGIS was built with older versions of PROJ and GDAL. It's expecting libproj.13.dylib and libgdal.20.dylib, however both of those packages have been upgraded to libproj.15.dylib and libgdal.26.dylib.

alazarolop commented 5 years ago

You are right. We are in the middle of the upgrade process to new Proj and GDAL versions, so we'll get these issues until all packages are successfully done.

cbertelli commented 5 years ago

I tried building it from sources instead of using the bottled version, but I didn't succeed, getting two blocking errors on Proj and GDAL.

alazarolop commented 5 years ago

It makes sense, as some formulas have already been upgraded but others haven't. We should wait until everything is done. If you have a TM backup you could reverse to previous versions and link them until then.

jonathanmccormack commented 5 years ago

I don't mean to criticize @fjperini or anyone else putting in the hard work to update the formulas, but wouldn't it be better to hold back on merging in the updates to, e.g., osgeo-proj, osgeo-gdal, etc. until all of the formulas that depend on those have been updated and are ready to be merged in? That would avoid the situation we find ourselves in every time these are updated.

Before I would've just run brew switch osgeo-gdal 2.4.1 etc., but combined with the change in Homebrew to automatically run brew cleanup when upgrading unless the HOMEBREW_NO_INSTALL_CLEANUP environment variable is set, even brew switch was unavailable to me this time.

alazarolop commented 5 years ago

@jonathanmccormack I agree with you that we should find a way to release all upgraded packages at the same time or to keep older versions available until deployment is completed in order to avoid these issues. If not, it can be challenging to use the tap in production.

I could upload poured versions from Mojave so you could manually uncompress them in their respective directories and then run brew switch. Just let me know if you interested in and which packages you would need.

jonathanmccormack commented 5 years ago

I could upload poured versions from Mojave so you could manually uncompress them in their respective directories and then run brew switch. Just let me know if you interested in and which packages you would need.

Thanks, but no need this time -- I was able to install directly from the commit history. E.g., for osgeo-gdal 2.4.1:

brew unlink osgeo-gdal
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/f6e7b27c7485afbdc5a8d9844231fd2e64f02659/Formula/osgeo-gdal.rb
alazarolop commented 5 years ago

Thanks, I didn't know older version tar files were kept available as they were tag as releases. It's good to know and I'm glad you could make it with the workaround.

jonathanmccormack commented 5 years ago

Alternatively, you can usually just download the old bottles directly: https://bottle.download.osgeo.org

As far as I can tell, older bottles are kept around for at least a few versions. I find that, if I have to install an older version, it's cleanest to install from the prior version's formula, which you can do by providing the raw version from a previous commit. Doing so in this case, homebrew just poured the 2.4.1 bottle from the bottles URL and I was good to go.

cbertelli commented 5 years ago

Maybe I did something stupid, but after

brew switch osgeo-gdal 2.4.1

I get

dyld: Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libcrypto.1.0.0.dylib

I tried reinstalling openssl without success. Can you suggest a workaround?

cbertelli commented 5 years ago

What's wrong with version 1.0.2s of openssl? I even tried to install 1.0.2t (moving in the wrong direction ;.)). How could I find a previous version? Should I build gdal 2.4.1 from source? Is there a suggested fix?

alazarolop commented 5 years ago

@cbertelli I'm using 1.0.2s version without any issue. What files do you have in that directory?

@@HOMEBREW_PREFIX@@/opt/openssl/lib/libcrypto.1.0.0.dylib
cbertelli commented 5 years ago

the bottled version for mojave. It seems compatible with osgeo-gdal 3.0.1 but switching to version 2.4.1_2 gives this message. Turning back to version 3.0.1, the error disappears.

berkayoruc commented 5 years ago

I am new to compile osgeo4mac but i cant do that. I took Dyld Error Message: Library not loaded: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib Referenced from: /usr/local/Cellar/osgeo-qgis-ltr/3.4.9/QGIS.app/Contents/MacOS/QGIS Reason: no suitable image found. Did find: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib: stat() failed with errno=20 error. Firstly, I have "libproj.15.dylib" error. After that, I downloaded bottle related with "libproj.13.dylib" manually from @jonathanmccormack link (5.2 mojave version) . Now, I took that error. I am really rookie around here. Please excuse me ^^

jonathanmccormack commented 5 years ago

I am new to compile osgeo4mac but i cant do that. I took Dyld Error Message: Library not loaded: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib Referenced from: /usr/local/Cellar/osgeo-qgis-ltr/3.4.9/QGIS.app/Contents/MacOS/QGIS Reason: no suitable image found. Did find: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib: stat() failed with errno=20 error. Firstly, I have "libproj.15.dylib" error. After that, I downloaded bottle related with "libproj.13.dylib" manually from @jonathanmccormack link (5.2 mojave version) . Now, I took that error. I am really rookie around here. Please excuse me ^^

To clarify @berkayoruc, I had to unlink and reinstall several other packages from the older versions in the repository to get QGIS to start:

brew unlink osgeo-gdal osgeo-proj osgeo-libspatialite osgeo-gdal-python
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/f6e7b27c7485afbdc5a8d9844231fd2e64f02659/Formula/osgeo-gdal.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/b37f82142e347c293cf0b7992f6187d40116b2ca/Formula/osgeo-proj.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/27f4ac2bc4056750307cee1b7a6abb9e33c846dd/Formula/osgeo-libspatialite.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/de5db18027bc37cd3bb0d4be07f59fdc8fe55df9/Formula/osgeo-gdal-python.rb
berkayoruc commented 5 years ago

Thank you @jonathanmccormack it worked! I took another error while opening QGIS, but it is about "processing toolbox". Even error was occured, QGIS was opened.

henryjameslau commented 5 years ago

I tried to unlink and install from the older versions as @jonathanmccormack commented (link) but still gettings an error

dyld: Library not loaded: /usr/local/opt/osgeo-gdal/lib/libgdal.20.dylib
  Referenced from: /usr/local/opt/osgeo-qgis/QGIS.app/Contents/MacOS/QGIS
  Reason: image not found
/usr/local/bin/osgeo-qgis: line 20: 98444 Abort trap: 6           /usr/local/opt/osgeo-qgis/QGIS.app/Contents/MacOS/QGIS "$@"
cbertelli commented 5 years ago

Now the mess is almost complete. expat and vala asked for a complete recompilation of grass, qgis and friends... Ops...

jasonrwang commented 5 years ago

@berkayoruc @henryjameslau perhaps try these:

warpedgeoid commented 5 years ago

This situation is absolutely maddening! Why would you dump updates willy-nilly into a tap that is used by people in production environments? All of these changes should have been queued in a separate branch and merged at once to prevent dependency-related breakages from occurring. To compound matters, no officially supported means of downgrading to working packages appears to exist!

For now, are we to assume that @jonathanmccormack's recommendation is the best way to deal with these breakages?

cbertelli commented 5 years ago

It happened, despite the will to control all the workflow, moving every dependency under one tap, against the efforts and the will of the meritorious contributors to this tap, it happened. I think something is due to the model, the rolling version, that is the reason for Homebrew, something is due to the absence of a software automation testing. Anyway there is a logic failure that is worsened by the general authoritative approach of the leading Homebrew members. The "fork" of some of the formulas began with the decision that everything should be upgraded to Qt 5 that became the new Qt while Qt 4 was deprecated and evicted from the core repository. Anyway, still thanking all the group, I think Rob is right, keeping all the eggs under one hen doesn't seem a solution per se and it's not a substitute for automated software management. This said, what's next? Version 3.8.3 should find it's way out with with GDAL 3.1 and proj 6 before version 3.10? A proper (temporary?) substitution is the official installer (by Lutra, based on Homebrew) or KingChaos' one (more advanced, already to version 3.8.3).

On Wed, Oct 9, 2019 at 6:28 PM Rob Howard notifications@github.com wrote:

This situation is absolutely maddening! Why would you dump updates willy-nilly into a tap that is used by people in production environments? All of these changes should have been queued in a separate branch and merged at once to prevent dependency-related breakages from occurring. To compound matters, no officially supported means of downgrading to working packages appears to exist!

For now, are we to assume that @jonathanmccormack https://github.com/jonathanmccormack's recommendation is the best way to deal with these breakages?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OSGeo/homebrew-osgeo4mac/issues/1261?email_source=notifications&email_token=ACFBXRDZUGGWX2IQU2UENN3QNYBBXA5CNFSM4IWLEOH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAYPMCQ#issuecomment-540079626, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFBXRBIUI62OYGFG2HUDS3QNYBBXANCNFSM4IWLEOHQ .

--

Carlo A. Bertelli Charta servizi e sistemi per il territorio e la storia ambientale srl Dipendenze del palazzo Doria, vc. alla Chiesa della Maddalena 9/2 16124 Genova (Italy) tel./fax +39(0)10 2475439 +39 0108566195 mobile:+39 393 1590711 e-mail: bertelli@chartasrl.eu http://www.chartasrl.eu

warpedgeoid commented 4 years ago

Following-up to confirm that following the instructions posted by @jonathanmccormack restored QGIS to a working state on one Mojave machine.

cbertelli commented 4 years ago

What about going on without blaming anyone or trying to fix an outdated build? Maybe there are tricks to keep running the bottled version, but we need to build newer version with updated dependencies.

Notoncebut2x commented 4 years ago

Hi folks, big fan of the the osgeo homebrew qgis keg...any chance you could provide a rough estimate when those dependencies will be update? Also, is there anything someone who has this issue but isn't a software development pro can do to help? Thanks again for all of your hard work on this!

songololo commented 4 years ago

Thanks to @jonathanmccormack, it has been possible to get a new installation up and running.

Thanks to the creators and maintainers for making this tap available.

Per the above comments and ongoing brew chaos, is there anyway to create a stable Formula somewhere so that we can reliably install QGIS without constantly running into new issues?

minorsecond commented 4 years ago

@songololo were you able to get the processing toolbox to work?

songololo commented 4 years ago

@minorsecond, no, unfortunately not.

( I haven't substantially tried to debug this any further because I don't depend on it for my usual workflows...)

varoudis commented 4 years ago

I am new to compile osgeo4mac but i cant do that. I took Dyld Error Message: Library not loaded: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib Referenced from: /usr/local/Cellar/osgeo-qgis-ltr/3.4.9/QGIS.app/Contents/MacOS/QGIS Reason: no suitable image found. Did find: /usr/local/opt/osgeo-proj/lib/libproj.13.dylib: stat() failed with errno=20 error. Firstly, I have "libproj.15.dylib" error. After that, I downloaded bottle related with "libproj.13.dylib" manually from @jonathanmccormack link (5.2 mojave version) . Now, I took that error. I am really rookie around here. Please excuse me ^^

To clarify @berkayoruc, I had to unlink and reinstall several other packages from the older versions in the repository to get QGIS to start:

brew unlink osgeo-gdal osgeo-proj osgeo-libspatialite osgeo-gdal-python
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/f6e7b27c7485afbdc5a8d9844231fd2e64f02659/Formula/osgeo-gdal.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/b37f82142e347c293cf0b7992f6187d40116b2ca/Formula/osgeo-proj.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/27f4ac2bc4056750307cee1b7a6abb9e33c846dd/Formula/osgeo-libspatialite.rb
brew install https://raw.githubusercontent.com/OSGeo/homebrew-osgeo4mac/de5db18027bc37cd3bb0d4be07f59fdc8fe55df9/Formula/osgeo-gdal-python.rb

I dont believe this works anymore. It did work for me with two systems, 2 weeks ago, but now I still get an error on another machine.

dyld: Library not loaded: /usr/local/opt/spatialindex/lib/libspatialindex.5.dylib Referenced from: /usr/local/Cellar/osgeo-qgis/3.8.0_1/QGIS.app/Contents/MacOS/./QGIS Reason: image not found fish: './QGIS' terminated by signal SIGABRT (Abort)

simo78 commented 4 years ago

dyld: Library not loaded: /usr/local/opt/spatialindex/lib/libspatialindex.5.dylib Referenced from: /usr/local/Cellar/osgeo-qgis/3.8.0_1/QGIS.app/Contents/MacOS/./QGIS Reason: image not found fish: './QGIS' terminated by signal SIGABRT (Abort)

Something like this should downgrade spatialindex back to v1.9.0 from current v1.9.3...

brew unlink spatialindex
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ff7b5ee0ea31d7af9c4561e20783a1997fb7dbaf/Formula/spatialindex.rb
brew pin spatialindex
varoudis commented 4 years ago

dyld: Library not loaded: /usr/local/opt/spatialindex/lib/libspatialindex.5.dylib Referenced from: /usr/local/Cellar/osgeo-qgis/3.8.0_1/QGIS.app/Contents/MacOS/./QGIS Reason: image not found fish: './QGIS' terminated by signal SIGABRT (Abort)

Something like this should downgrade spatialindex back to v1.9.0 from current v1.9.3...

brew unlink spatialindex
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ff7b5ee0ea31d7af9c4561e20783a1997fb7dbaf/Formula/spatialindex.rb
brew pin spatialindex

thanks. This makes qgis load. (with the usual error on the plugins)

`Couldn't load plugin 'processing'

ImportError: dlopen(/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/osgeo/_gdal.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/osgeo-gdal/lib/libgdal.26.dylib Referenced from: /usr/local/Cellar/osgeo-gdal-python/3.0.1/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so Reason: image not found Traceback (most recent call last): File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 309, in loadPlugin import(packageName) File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/init.py", line 28, in from processing.tools.dataobjects import * # NOQA File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/tools/dataobjects.py", line 51, in from processing.algs.gdal.GdalUtils import GdalUtils File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalUtils.py", line 38, in from osgeo import ogr File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/osgeo/init.py", line 21, in _gdal = swig_import_helper() File "/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/osgeo/init.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/imp.py", line 342, in load_dynamic return _load(spec) ImportError: dlopen(/usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/osgeo/_gdal.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/osgeo-gdal/lib/libgdal.26.dylib Referenced from: /usr/local/Cellar/osgeo-gdal-python/3.0.1/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so Reason: image not found

Python version: 3.7.4 (default, Sep 7 2019, 18:27:02) [Clang 10.0.1 (clang-1001.0.46.4)] QGIS version: 3.6.0-Noosa Noosa, exported

Python Path: /usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python /Users/varoudis/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/varoudis/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /usr/local/Cellar/qgis/3.6.0_4/QGIS.app/Contents/MacOS/../Resources/python/plugins /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python37.zip /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7 /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/geos /usr/local/Cellar/matplotlib/2.2.3/libexec/lib/python3.7/site-packages /usr/local/Cellar/protobuf/3.10.0/libexec/lib/python3.7/site-packages /Users/varoudis/Library/Application Support/QGIS/QGIS3/profiles/default/python`

alazarolop commented 4 years ago

@varoudis osgeo-qgis is being updated these days and it shouldn't take much longer. In the meantime, you could try the cask version as a workaround in order to get the toolbox working: brew cask install qgis.

varoudis commented 4 years ago

@varoudis osgeo-qgis is being updated these days and it shouldn't take much longer. In the meantime, you could try the cask version as a workaround in order to get the toolbox working: brew cask install qgis.

Thanks. Its ok for now (at least on my Macs) thanks to the team for all the hard work

songololo commented 4 years ago

@alazarolop thanks for the brew cask method.

For background, are you able to elaborate on the differences between the main tap and the cask version and the logic behind when these are respectively updated?

alazarolop commented 4 years ago

@songololo This tap predates the cask version, which was release in late 2018. Before that, the tap was probably the easiest way to get QGIS running in macOS and keep it updated. As for now and as far as I understand, the cask version is based in the homebrew tap, so there isn't a big difference and both should have the same update pace too. It's true the cask version is ahead now though.

I would say the advantage of the package over the tap is the installation process, which is quite straight and you don't need to care about dependencies. You can read more in this QGIS blog entry.

SadRebel1000 commented 4 years ago

It tried the fixes above suggested by @jonathanmccormack and @varoudis and this progressed the errors in to the following error:

Dyld Error Message: Library not loaded: /usr/local/opt/giflib/lib/libgif.7.dylib Referenced from: /usr/local/opt/osgeo-gdal/lib/libgdal.20.dylib Reason: Incompatible library version: libgdal.20.dylib requires version 8.0.0 or later, but libgif.7.dylib provides version 0.0.0

So how is it going with the updating?

Happy to know there is a QGIS cask version that works. A couple of months ago I started using osgeo4mac because there was no cask version of QGIS.

spyrostheodoridis commented 4 years ago

Just for reference: Tried today to brew install osgeo-qgis with only PROJ6 and GDAL3 installed in my system and I am still getting issues (e.g. it's looking for libproj.13.dylib instead of libproj.15.dylib etc.). Even after symlinking the relevant files the last error I get is: ERROR 1: PROJ: proj_create_from_database: Cannot find proj.db

Thanks a lot for all the effort!

stale[bot] commented 4 years ago

This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want to keep the issue open, please comment or update the info here. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue or pull request has been automatically closed because it has not had recent activity. Thank you for your contributions.

kevinstadler commented 4 years ago

For anyone else running into this error:

It tried the fixes above suggested by @jonathanmccormack and @varoudis and this progressed the errors in to the following error:

Dyld Error Message: Library not loaded: /usr/local/opt/giflib/lib/libgif.7.dylib Referenced from: /usr/local/opt/osgeo-gdal/lib/libgdal.20.dylib Reason: Incompatible library version: libgdal.20.dylib requires version 8.0.0 or later, but libgif.7.dylib provides version 0.0.0

So how is it going with the updating?

Happy to know there is a QGIS cask version that works. A couple of months ago I started using osgeo4mac because there was no cask version of QGIS.

the problem seems to be a (non-osgeo) upgrade of giflib from 5.1.4 to 5.2.1, which has API-breaking changes, so you'll need to find an old (5.1.4) giflib Formula to install.