Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ (mac c+;+;development),对于动态库,在Makefile.am脚本中在哪里指定安装名称?_C++_Macos_Makefile_Dynamic Linking - Fatal编程技术网

C++ (mac c+;+;development),对于动态库,在Makefile.am脚本中在哪里指定安装名称?

C++ (mac c+;+;development),对于动态库,在Makefile.am脚本中在哪里指定安装名称?,c++,macos,makefile,dynamic-linking,C++,Macos,Makefile,Dynamic Linking,我正在用mac上的gnu自动工具建立一个项目。一切都可以编译,但我在链接动态库时遇到了问题。如何在Makefile.am脚本中指定install_名称。我想可能是这样的: lib_LTLIBRARIES = libphysics.la libphysics_la_SOURCES = PhysicsEngine.cpp\ PointMass.cpp\ Spring.cpp\ WaterForceGenerator.cpp AM_

我正在用mac上的gnu自动工具建立一个项目。一切都可以编译,但我在链接动态库时遇到了问题。如何在Makefile.am脚本中指定install_名称。我想可能是这样的:

    lib_LTLIBRARIES = libphysics.la

    libphysics_la_SOURCES = PhysicsEngine.cpp\
       PointMass.cpp\
       Spring.cpp\
       WaterForceGenerator.cpp

    AM_CPPFLAGS=  @CXXFLAGS@\
        -I../include\
        -Iinclude\
        -I../evolutionaryStuff/include\
        -I../geom/include\
        -I../model/include\
        -I../paramsReader/include\
        -I../ctrnn/include\
        -I../simulationSystem/include

    AM_LDFLAGS= @LDFLAGS@ \
        -install_name "./.libs/libphysics.0.dylib"
…但当我这样做时:

otool-D libphysics.0.dylib

在我得到的.libs目录中

/usr/local/lib/libphysics.0.dylib

(但我希望它类似于.libs/libphysics.0.dylib)

我知道这一定很简单,有什么想法吗

谢谢


黑客攻击之后,Makefile.am文件中的正确条目应该是:

    AM_LDFLAGS= @LDFLAGS@\
             -Xlinker -rpath -Xlinker "`pwd`/.libs"\
             -Xlinker -install_name -Xlinker "`pwd`/.libs/libphsyics.0.dylib"
我不知道为什么会这样。诀窍是在“-rpath”和“-install_name”之前和之后添加一对“-Xlinker”标志。如果有人能告诉我为什么这是必要的,我将不胜感激

谢谢

编辑:我应该指出,这篇文章有助于解决这个问题