RadeonProRenderSDK icon indicating copy to clipboard operation
RadeonProRenderSDK copied to clipboard

tutorial binaries lacking LC_RPATH loader command in macOS

Open dreness opened this issue 3 years ago • 1 comments

Hello!

Maybe I'm the only person to try the samples under macOS, because it seems like they can't possibly work as written. In a nutshell, the built binaries try to load libRadeonProRender64.dylib at the path @rpath/libRadeonProRender64.dylib, however no LC_RPATH loader command is present, so at runtime the dylib is not found and the process exits.

andre@boop RadeonProRenderSDK % ./tutorials/Bin/03_instance64                                            
dyld: Library not loaded: @rpath/libRadeonProRender64.dylib
  Referenced from: /Users/andre/work/RadeonProRenderSDK/./tutorials/Bin/03_instance64
  Reason: image not found
zsh: abort      ./tutorials/Bin/03_instance64

andre@boop RadeonProRenderSDK % otool -l tutorials/Bin/03_instance64 | egrep -A 2 -i 'lc_load_dylib|lc_rpath' 
          cmd LC_LOAD_DYLIB
      cmdsize 64
         name @rpath/libRadeonProRender64.dylib (offset 24)
--
          cmd LC_LOAD_DYLIB
      cmdsize 48
         name /usr/lib/libc++.1.dylib (offset 24)
--
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/lib/libSystem.B.dylib (offset 24)

Adding a load command to set LC_RPATH solves the problem. In my case:

andre@boop RadeonProRenderSDK % install_name_tool -add_rpath /Users/andre/work/RadeonProRenderSDK/RadeonProRender/binMacOS tutorials/Bin/03_instance64 

andre@boop RadeonProRenderSDK % otool -l tutorials/Bin/03_instance64 | egrep -A 2 -i 'lc_load_dylib|lc_rpath'
          cmd LC_LOAD_DYLIB
      cmdsize 64
         name @rpath/libRadeonProRender64.dylib (offset 24)
--
          cmd LC_LOAD_DYLIB
      cmdsize 48
         name /usr/lib/libc++.1.dylib (offset 24)
--
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/lib/libSystem.B.dylib (offset 24)
--
          cmd LC_RPATH
      cmdsize 80
         path /Users/andre/work/RadeonProRenderSDK/RadeonProRender/binMacOS (offset 12)

andre@boop RadeonProRenderSDK % ./tutorials/Bin/03_instance64 
Radeon ProRender SDK simple rendering tutorial.
Context successfully created.
Rendering finished.

dreness avatar Jun 14 '21 01:06 dreness

Hey @dreness Correct, but to be fair, I think is more just a lack of documentation rather than a bug. But we should note it somewhere.

bsavery avatar Jun 15 '21 22:06 bsavery