mitsuba2 icon indicating copy to clipboard operation
mitsuba2 copied to clipboard

rgb2spec_opt fails to run on Mac Os Catalina

Open SergeyShlyaev opened this issue 4 years ago • 4 comments

External utility rgb2spec_opt currently compiles but does not run on Mac Os Catalina 10.15.4 and Xcode 11.3.1.

login$ mitsuba2/build/ext_build/rgb2spec/rgb2spec_opt 
dyld: Library not loaded: @rpath/libtbb.dylib
  Referenced from: mitsuba2/build/ext_build/rgb2spec/rgb2spec_opt
  Reason: image not found
Abort trap: 6

File it complains about, libtbb.dylib is present in the same folder as executable. Tried adding this folder to LD_LIBRARY_PATH or DYLD_LIBRARY_PATH as a test. Does not seem to solve the issue.

What can be the best way to solve it without recompiling everything? Mitsuba2 itself works well and is awesome.

Thanks

Edit: correctly specified OS version

SergeyShlyaev avatar Apr 08 '20 01:04 SergeyShlyaev

I think you need to run rgb2spec_opt at the place where it was built. This should work fine -- after all, the build system runs it and generates some output that is needed to compile Mitsuba.

wjakob avatar Apr 08 '20 07:04 wjakob

It is run at the place where it was built. Same machine, didn't change any folder structure.

It is puzzling a bit because mitsuba seem to use libtbb and it works.

SergeyShlyaev avatar Apr 08 '20 13:04 SergeyShlyaev

I just faced this issue. I think the problem is that when 'rgb2spec_opt' is run, macOs is not loading the dynamic library file 'libtbb.dylib' which is on that folder, I guess this comes from security precautions. I tried to install 'tbb' package with homebrew, but unfortunatelly that version of 'tbb' lacks a symbol which is needed. So at the end, I just created a symlink from '/usr/local/lib' to the .dylib file in the folder. Then I manually run 'rgb2spec_opt' in order to generate 'srgb.coeff' file. After that, 'ninja' built the mitsuba executable with no more problems. This is not by far the most elegant solution, but it just works.

carlos-urena avatar Mar 04 '22 12:03 carlos-urena

Solved by

cd mitsuba2/build/ext_build/rgb2spec/;
install_name_tool -change @rpath/libtbb.dylib @executable_path/libtbb.dylib rgb2spec_opt;

and run ninja again should work.

IYuan505 avatar May 23 '22 09:05 IYuan505