Linking to a dynamic library on a Mac with full path

前端 未结 4 1569
生来不讨喜
生来不讨喜 2020-12-14 02:09

I am linking a (Python extension) library that embeds the Matlab engine with the following command (generated using cmake)

c++ -mmacosx-version-min=10.6 -bun         


        
4条回答
  •  囚心锁ツ
    2020-12-14 03:08

    Look into the -rpath option to the ld command to control this. You might also be interested in the contents of https://github.com/bimargulies/jni-origin-testbed, which is a demonstration of some relevant technology.

    The critical technique here is:

    install_name_tool -change libsl2.so "@loader_path/libsl2.so" libsl1.so
    

提交回复
热议问题