buddhi1980 / mandelbulber2

Official repository for Mandelbulber v2
GNU General Public License v3.0
893 stars 116 forks source link

[mac os] Mandelbulber2 crash due to missing libc++abi.1.dylib (possible fix) #930

Open Luthien-in-edhil opened 2 years ago

Luthien-in-edhil commented 2 years ago
System information (version)
Detailed description

I've seen several other tickets relating to this issue for the last two (or maybe more) versions of Mandelbulber2.

I tried installing the current version v2.28 yesterday on an iMac running Monterey (12.4) and could not get it to work with a suggestion I read in one of the related tickets: to manually copy libc++abi.1.dylib to mandelbulber2.app/Contents/Frameworks. Since I did not have that file anywhere on that computer I tried with one I found in another Github repository, but that didn't work either.

Today I tried installing v2.28 on my laptop. That has a (still) working v2.24, but I had the same immediate crash with v2.28.

The crash report says:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libc++abi.1.dylib
Referenced from: /Applications/mandelbulber2.app/Contents/Frameworks/libc++.1.dylib
Reason: tried: 
'/Applications/mandelbulber2.app/Contents/Frameworks/../lib/libc++abi.1.dylib' (no such file), 
'/Applications/mandelbulber2.app/Contents/MacOS/../Frameworks/libc++abi.1.dylib' (no such file), 
'/usr/local/Cellar/llvm/14.0.6/lib/libc++abi.1.dylib' (no such file), 
'/Applications/mandelbulber2.app/Contents/MacOS/../Frameworks/libc++abi.1.dylib' (no such file), 
'/usr/local/Cellar/llvm/14.0.6/lib/libc++abi.1.dylib' (no such file), 
'/usr/local/lib/libc++abi.1.dylib' (no such file), 
'/usr/lib/libc++abi.1.dylib' (no such file)

With things like Frameworks/../ and the duplicate entries removed the search path comes down to:

'/Applications/mandelbulber2.app/Contents/lib/libc++abi.1.dylib' (no such file), 
'/Applications/mandelbulber2.app/Contents/Frameworks/libc++abi.1.dylib' (no such file), 
'/usr/local/Cellar/llvm/14.0.6/lib/libc++abi.1.dylib' (no such file), 
'/usr/local/lib/libc++abi.1.dylib' (no such file), 
'/usr/lib/libc++abi.1.dylib' (no such file)

Directory /Applications/mandelbulber2.app/Contents/lib/does not exist in the .app package, and neither /usr/lib/ nor /usr/local/lib/ have a copy of libc++abi.1.dylib, which I suppose depends on what happens to be installed on your machine. I did happen to have llvm installed (homebrew, I think it came with Android Studio), but that was v13.0.something - and unfortunately, brew upgrade llvm gave me /usr/local/Cellar/llvm/14.0.6_1, not /usr/local/Cellar/llvm/14.0.6.

So I copied /usr/local/Cellar/llvm/14.0.6_1/lib/libc++abi.1.dylib ( a simlink to-> libc++abi.1.0.dylib) to /Applications/mandelbulber2.app/Contents/Frameworks/ and that did work. This makes sense, because that file WAS available in v2.24.

I'll admit right away that I don't know that much about packaging an app for Mac OS, but it looks as if you will only need to add libc++abi.1.0.dylib to /Applications/mandelbulber2.app/Contents/Frameworks/ to make the app work for everyone (including those who don't happen to have the DYLIB installed by another app).

Steps to reproduce
$> cd /usr/lib
$> sudo mv libc++abi.1.dylib temp-libc++abi.1.dylib
$> cd ../local/lib
$> mv libc++abi.1.dylib temp-libc++abi.1.dylib
$> cd ../Cellar/llvm/14.0.6
$> mv libc++abi.1.dylib temp-libc++abi.1.dylib

(whichever one applies)

I hope this helps someone!

Luthien-in-edhil commented 2 years ago

However, there seem to be a few more packaging-related issues.

First I noticed was the app complaining it could not find the fractal formula under mandelbulber.app/Contents/Resources. Understandably so, because they're in the root of the app package mandelbulber.app/.

Same issue when I tried enabling OpenCL.

It looks as if the developer working on the application decided to start following the convention for the app package:

mandelbulber2.app
   /Contents
      /Frameworks
      /info.plist
      /Library
      /MacOS
      /PkgInfo
      /Plugins
      /Resources
         /examples
         /formula
         /opencl
         etcetera...

... but the one packaging the app still put the files directly under mandelbulber.app/ as was the case for v2.24.

mandelbulber2 path issues
buddhi1980 commented 2 years ago

I have corrected file structure in the dmg files for Intel builds. I hope everything will be fine. Unfortunately I cannot test it, because I don't have any Mac with Intel CPU. You can try two latest packages from here: https://sourceforge.net/projects/mandelbulber/files/Mandelbulber%20v2/MacOS/ Please let me know it it works.

Luthien-in-edhil commented 2 years ago

Wow, that's fast.

I just installed it, it opens and runs fine as far as I can see, though I can test it more thoroughly tomorrow. I had a look at the .app package, and I noticed some leftover source directories in there:

but that's not a big deal. If you like I can test the Intel mac builds for you!

Thanks 👍

buddhi1980 commented 2 years ago

Great! Thanks for the feedback. Which version did you tried version compiled with xcode 12 or 14?

Luthien-in-edhil commented 2 years ago

That was the latest one for v14, mandelbulber2-macOS-2.28-1-xcode14-intel.dmg

Luthien-in-edhil commented 2 years ago

I just tried mandelbulber2-macOS-2.28-1-xcode14-intel.dmg on my work iMac as well and there it did not work. The crash log mentioned it couldn't find libc++abi.1.dylib as before, so I downloaded the older mandelbulber2-macOS-2.25.dmg, unpacked it and copied libc++abi.1.dylib to mandelbulber2.app/Contents/Frameworks:

mandelbulber2.app
   Contents
      Frameworks
         libc++abi.1.dylib

and then it worked again. I suppose it worked on my laptop because I had libc++abi.1.dylib somewhere else available 😊