Setting the Search Path for Plug In (Bundle / DyLib)

五迷三道 提交于 2019-11-29 17:48:07

Your solution is correct for modern libraries that are aware of @rpath. OpenMP library supports @rpath starting compiler version 16.0 update 2. In your case your RPATH settings are ignored by system

Can you try to link with the with openmp library from photoshop? as I understand they did a workaround for this and updated install_name from libiomp5.dylib to "@executable_path/../Frameworks/libiomp5.dylib". so if you link to that library the openmp name in "otool -l" output will be changed to @executable_path/../Frameworks/libiomp5.dylib

some hints

  1. If photoshop updates install name via install_name_tool

     $ otool -l ./a.out | grep omp
     name libiomp5.dylib (offset 24)
     # libiomp5.dylib was copied to the location with test 
     $ install_name_tool -id "@executable_path/../Frameworks/libiomp5.dylib" libiomp5.dylib
     $ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp 
     $ otool -l ./a.out | grep omp
     name @executable_path/../Frameworks/libiomp5.dylib (offset 24)
    
  2. RPATH usage

    install_name_tool -id "@executable_path/../Frameworks/libiomp5.dylib" libiomp5.dylib
    $ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp -Wl,-rpath,.
    $ ./a.out
    dyld: Library not loaded: @executable_path/../Frameworks/libiomp5.dylib
      Referenced from: /nfs/inn/home/vpolin/mac/./a.out
      Reason: image not found
    Trace/BPT trap: 5
    $ install_name_tool -id "@rpath/libiomp5.dylib" libiomp5.dylib
    $ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp -Wl,-rpath,.
    $ otool -l ./a.out | grep omp
             name @rpath/libiomp5.dylib (offset 24)
    $ ./a.out
    4 8 8 8 8
    

--Vladimir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!