Real-ESRGAN-ncnn-vulkan icon indicating copy to clipboard operation
Real-ESRGAN-ncnn-vulkan copied to clipboard

Any way to make this work on Mojave?

Open KeygenLLC opened this issue 2 years ago • 4 comments

If trying to run this on Mojave (10.14.6), the GPU does render the image, but when it gets to where it needs to save it, it throws an error because it can't find the library for c++.1 which is not present on Mojave.

I haven't found a way to install the other c++.1, though the guys who make Homebrew are trying to find a way to do it for older macOS.

Edit: Apparently this does exist on Mojave, but maybe it's not the location that's expected. I found it in /usr/lib/libc++.1.dylib. Is there a way to point the app to this location or is this an older version that won't work?

You can see below how it errors out right before finishing:

[0 AMD Radeon Pro Vega 64]  queueC=0[1]  queueG=0[1]  queueT=0[1]
[0 AMD Radeon Pro Vega 64]  bugsbn1=0  bugbilz=0  bugcopc=0  bugihfa=0
[0 AMD Radeon Pro Vega 64]  fp16-p/s/a=1/1/1  int8-p/s/a=1/1/1
[0 AMD Radeon Pro Vega 64]  subgroup=64  basic=1  vote=1  ballot=1  shuffle=1
0.00%
2.78%
5.56%
8.33%
11.11%
13.89%
16.67%
19.44%
22.22%
25.00%
27.78%
30.56%
33.33%
36.11%
38.89%
41.67%
44.44%
47.22%
50.00%
52.78%
55.56%
58.33%
61.11%
63.89%
66.67%
69.44%
72.22%
75.00%
77.78%
80.56%
83.33%
86.11%
88.89%
91.67%
94.44%
97.22%
dyld: lazy symbol binding failed: Symbol not found: __ZNSt3__14__fs10filesystem10__absoluteERKNS1_4pathEPNS_10error_codeE
  Referenced from: /Volumes/Projects_Active/realesrgan-ncnn-vulkan-20210901-macos/./realesrgan-ncnn-vulkan (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libc++.1.dylib

dyld: Symbol not found: __ZNSt3__14__fs10filesystem10__absoluteERKNS1_4pathEPNS_10error_codeE
  Referenced from: /Volumes/Projects_Active/realesrgan-ncnn-vulkan-20210901-macos/./realesrgan-ncnn-vulkan (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libc++.1.dylib

Abort trap: 6

This is a stable production machine and I can't install 10.15 on this machine because I need to run 32-bit software and plugins that do not exist in 64-bit for 10.15 or Big Sur. Also can't run it on my laptop with Big Sur because it only has Intel Iris graphics.

Please let me know if there is a way around this or if you can make a new build that will support 10.14.

Thanks

KeygenLLC avatar Nov 12 '21 12:11 KeygenLLC

Hmm, I solved this problem by copying libc++.1.dylib from macOS Catalina and replacing the one in Mojave. Just remember to backup the original one.

charlie0129 avatar Dec 15 '21 09:12 charlie0129

Hmm, I solved this problem by copying libc++.1.dylib from macOS Catalina and replacing the one in Mojave. Just remember to backup the original one.

Thanks, I'll give it a try.

KeygenLLC avatar Dec 15 '21 10:12 KeygenLLC

Yes, indeed it works.

Once you have a copy of /usr/lib/libc++.1.dylib from macOS Catalina (can be taken from original .dmg), copy it in the same directory as realesrgan-ncnn-vulkan, and then patch realesrgan-ncnn-vulkan like this:

install_name_tool \
  -add_rpath "@executable_path/." \
  -change "/usr/lib/libc++.1.dylib" "@rpath/libc++.1.dylib" \
  realesrgan-ncnn-vulkan

ocococococ avatar Feb 12 '23 09:02 ocococococ

On Mojave (10.14.6) I was also able to get this to work using the same approach, but tweaked since I'm using the latest release v0.2.0 from April 24, 2022

  • v0.2.0 is built for Big Sur and seems to do inference much faster, compared to the previous versions (which I tried out re: MacOS Catalina). My error was:
dyld: lazy symbol binding failed: Symbol not found: __ZNSt3__14__fs10filesystem10__absoluteERKNS1_4pathEPNS_10error_codeE
  Referenced from: /Users/.../Downloads/realesrgan-ncnn-vulkan-20220424-macos/./realesrgan-ncnn-vulkan (which was built for Mac OS X 11.0)
  • I don't have the MacOS X 11 Big Sur .dmg available, but libc++.1.dylib lives in the XCode app bundle. So I downloaded Xcode 13.2.1 for Mac OS X 11 from https://xcodereleases.com
  • A .xip file is downloaded which must be unzipped and searched for libc++.1.dylib which lives in the tvOS/watchOS/iOS simulator runtimes. Copy it to the realesrgan-ncnn-vulkan directory
  • Finally, I patched the executable with 👇
install_name_tool -change "/usr/lib/libc++.1.dylib" "@rpath/libc++.1.dylib"  realesrgan-ncnn-vulkan
  • Notably, I omitted the -add_rpath, that the others on this thread used, because I got the following error 👇
option "-add_rpath @executable_path/." would duplicate path, file already has LC_RPATH for: @executable_path/.

After all these steps, it works and I'm doing blazing fast super-resolution on Mojave (which I cannot upgrade for different audio-driver related technical reasons)

ruohoruotsi avatar Apr 14 '23 01:04 ruohoruotsi