shawnlaffan / biodiverse

A tool for the spatial analysis of diversity
http://shawnlaffan.github.io/biodiverse/
GNU General Public License v3.0
74 stars 19 forks source link

Installation on MaxOS Intel: from source impossible + source-install brew library messing BiodiverseGUI #869

Closed FranckLejzerowicz closed 10 months ago

FranckLejzerowicz commented 1 year ago

Hello,

I have been trying to install Biodiverse on a MacOS intel, starting with binaries, but without success. Hence I tried to install it from source and these worked:

brew install gdk-pixbuf pango gtk+ gtk+3 libglade libffi gdal openssl
brew install hicolor-icon-theme
brew install adwaita-icon-theme

However, the libgnomecanvas project being archived, does not allow installation and the following did not work:

brew install --build-from-source libgnomecanvas

Thus, I tried to reinstall Biodiverse 4.0 and give full disk access, but now the GUI program is complaining with gdk-pixbuf it seems:

$ /Applications/Biodiverse.app/Contents/MacOS/BiodiverseGUI
++++
Setting GDK_PIXBUF_MODULEDIR to /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/gdk-pixbuf-2.0/2.10.0/loaders
Setting GDK_PIXBUF_MODULE_FILE to /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/gdk-pixbuf-2.0/2.10.0/loaders.cache
gdk-pixbuf-query-loaders is at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/gdk-pixbuf-query-loaders
running gdk-pixbuf-query-loaders system calls
dyld: Symbol not found: __cg_DGifCloseFile
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T//par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/libGIF.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
system call to /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/gdk-pixbuf-query-loaders failed: 6 at script/BiodiverseGUI.pl line 34.
dyld: Symbol not found: __cg_DGifCloseFile
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T//par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/libGIF.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
++++ could not update gdk-pixbuf-query-loaders cache: 6 at script/BiodiverseGUI.pl line 36.
++++
[USE_BASE] No user defined extensions
Can't load '/var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/auto/Pango/Pango.bundle' for module Pango: dlopen(/var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/auto/Pango/Pango.bundle, 1): Symbol not found: __cg_DGifCloseFile
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T//par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/libGIF.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO at <embedded>/DynaLoader.pm line 210.
 at <embedded>/PAR/Heavy.pm line 140.
Compilation failed in require at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Gtk2.pm line 31.
BEGIN failed--compilation aborted at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Gtk2.pm line 31.
Compilation failed in require at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Biodiverse/GUI/ProgressDialog.pm line 12.
BEGIN failed--compilation aborted at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Biodiverse/GUI/ProgressDialog.pm line 12.
Compilation failed in require at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Biodiverse/GUI/GUIManager.pm line 36.
BEGIN failed--compilation aborted at /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/inc/lib/Biodiverse/GUI/GUIManager.pm line 36.
Compilation failed in require at script/BiodiverseGUI.pl line 59.
BEGIN failed--compilation aborted at script/BiodiverseGUI.pl line 59.

I tried again after brew uninstall gdk-pixbuf and after removing the /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b but this error persists.

Any suggestion appreciated Franck

shawnlaffan commented 1 year ago

Hello Franck - thanks for the report.

I need to set up a homebrew build for libgnomecanvas. Until then the binary install is needed, which leads to the second part of the issue.

Can you let me know which version of MacOS you are using?

And do you have anything setting the DYLD_LIBRARY_PATH environment variable? https://stackoverflow.com/questions/35509731/dyld-symbol-not-found-cg-jpeg-resync-to-restart

If that's the case then try this sequence from a terminal (hopefully I have the Biodiverse call correct - I do not have a Mac nearby at the moment):

export DYLD_LIBRARY_PATH= 
/Applications/Biodiverse.app/Contents/MacOS/BiodiverseGUI

Shawn.

shawnlaffan commented 1 year ago

WRT installation via homebrew, this guide might be useful: https://itnext.io/how-to-install-an-older-brew-package-add141e58d32

Following those instructions, the process should be something like this:

brew edit https://raw.githubusercontent.com/Homebrew/homebrew-core/1180c886d9b62e811eede6efa9cfff36e131e825/Formula/libgnomecanvas.rb
#  insert these lines into the build, immediately after the line containing "def install":
#  system "\\curl -L https://raw.githubusercontent.com/shawnlaffan/biodiverse/master/etc/libgnomecanvas.patch > libgnomecanvas.patch"
#  system "patch -d libgnomecanvas < libgnomecanvas.patch"
#  then exit the editor
brew install --build-from-source libgnomecanvas

I'll test that tomorrow when I'm in front of my Mac.

shawnlaffan commented 1 year ago

This also looks relevant: https://stackoverflow.com/questions/73586208/can-you-install-disabled-homebrew-packages

FranckLejzerowicz commented 1 year ago

Hi Shawn,

I'm using:

  System Version:   macOS 11.6.2 (20G314)
  Processor Name:   8-Core Intel Core i9
  Processor Speed:  2.3 GHz

There is no DYLD_LIBRARY_PATH variable set in my environment.

Unfortunately, the suggestion to empty DYLD_LIBRARY_PATH and re-running BiodiverseGUI (you were right about the path) resulted in the same error, related to gdk-pixbuf it seems.

I wish I do not have to build from source, but rather fix the error related to the brew-installed gdk-pixbuf library ...

Thanks!

shawnlaffan commented 1 year ago

Thanks for the details. This looks like a clash between the version of libgif packed with Biodiverse and the one on your system.

Can you try renaming the libgif.dylib file under the Biodiverse file path? The actual path will differ across users but given your previous info it should be this for your machine:

mv /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/libGIF.dylib /var/folders/hq/4ltcnxjn3rgd66hsdqpvg87r0000gn/T/par-6672616e636b/cache-6f481e89eb4e33772bc9d51e1b9d6dce8c99bd2b/libGIF.dylib.bk

One that is done, re-run the Biodiverse executable.

The above is a workaround and would need to be done every time Biodiverse is reinstalled. If it works, though, then it gives me some ideas regarding what to change in the build.

shawnlaffan commented 1 year ago

Some additional notes.

Compilation of libgnomecanvas can sidestep homebrew using these steps.

This installs the dynamic lib to $HOME/usr/lib so it will need to be added to the DYLD_LIBRARY_PATH for Biodiverse to find it. One could install to $HOMEBREW_PREFIX but that's a risky option.

\curl -L https://download.gnome.org/sources/libgnomecanvas/2.30/libgnomecanvas-2.30.3.tar.bz2 > lgc.tar.bz
tar xf lgc.tar.bz
cd libgnomecanvas-2.30.3
\curl -L https://raw.githubusercontent.com/shawnlaffan/biodiverse/master/etc/libgnomecanvas.patch > libgnomecanvas.patch
patch -d libgnomecanvas < libgnomecanvas.patch
./configure --disable-dependency-tracking --disable-static --prefix=$HOME/usr --disable-glade
make
make install
shawnlaffan commented 1 year ago

Some more detailed steps for a source code install are below. The last part of which could do with some testing.

These are also now part of the installation instructions.

 cpanm XML::Parser 
 brew install libart intltool gettext
 \curl -L https://download.gnome.org/sources/libgnomecanvas/2.30/libgnomecanvas-2.30.3.tar.bz2 > libgnomecanvas-2.30.3.tar.bz
 tar xf libgnomecanvas-2.30.3.tar.bz
 cd libgnomecanvas-2.30.3
 \curl -L https://raw.githubusercontent.com/shawnlaffan/biodiverse/master/etc/libgnomecanvas.patch > libgnomecanvas.patch
 patch -d libgnomecanvas < libgnomecanvas.patch
 #  if you are willing to take the risk then you can install into --prefix=$HOMEBREW_PATH
 ./configure --disable-dependency-tracking --disable-static --prefix=$HOME/usr --disable-glade
 make
 make install
 export DYLD_LIBRARY_PATH=${HOME}/usr:${DYLD_LIBRARY_PATH}
 export CPATH=${HOME}/usr:${CPATH}
 cpanm --notest Gnome2::Canvas
shawnlaffan commented 10 months ago

@FranckLejzerowicz - I think the issue has been resolved now. I'm using the approach in https://github.com/shawnlaffan/biodiverse/issues/869#issuecomment-1581900832 for local and CI builds.

I'll close this issue now but it can be re-opened if there are still points to be addressed. Other problems can always be raised under a new issue.

Thanks again for the report.