<tfoot id='w2Hb4'></tfoot>
    • <bdo id='w2Hb4'></bdo><ul id='w2Hb4'></ul>
    <i id='w2Hb4'><tr id='w2Hb4'><dt id='w2Hb4'><q id='w2Hb4'><span id='w2Hb4'><b id='w2Hb4'><form id='w2Hb4'><ins id='w2Hb4'></ins><ul id='w2Hb4'></ul><sub id='w2Hb4'></sub></form><legend id='w2Hb4'></legend><bdo id='w2Hb4'><pre id='w2Hb4'><center id='w2Hb4'></center></pre></bdo></b><th id='w2Hb4'></th></span></q></dt></tr></i><div id='w2Hb4'><tfoot id='w2Hb4'></tfoot><dl id='w2Hb4'><fieldset id='w2Hb4'></fieldset></dl></div>

    <small id='w2Hb4'></small><noframes id='w2Hb4'>

    <legend id='w2Hb4'><style id='w2Hb4'><dir id='w2Hb4'><q id='w2Hb4'></q></dir></style></legend>

      1. XCode dylib 在/usr/lib 中查找

        XCode dylib looking in /usr/lib(XCode dylib 在/usr/lib 中查找)

          <i id='sPsJC'><tr id='sPsJC'><dt id='sPsJC'><q id='sPsJC'><span id='sPsJC'><b id='sPsJC'><form id='sPsJC'><ins id='sPsJC'></ins><ul id='sPsJC'></ul><sub id='sPsJC'></sub></form><legend id='sPsJC'></legend><bdo id='sPsJC'><pre id='sPsJC'><center id='sPsJC'></center></pre></bdo></b><th id='sPsJC'></th></span></q></dt></tr></i><div id='sPsJC'><tfoot id='sPsJC'></tfoot><dl id='sPsJC'><fieldset id='sPsJC'></fieldset></dl></div>

              <tbody id='sPsJC'></tbody>

                <tfoot id='sPsJC'></tfoot>
              1. <legend id='sPsJC'><style id='sPsJC'><dir id='sPsJC'><q id='sPsJC'></q></dir></style></legend>

              2. <small id='sPsJC'></small><noframes id='sPsJC'>

                  <bdo id='sPsJC'></bdo><ul id='sPsJC'></ul>
                  本文介绍了XCode dylib 在/usr/lib 中查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在 XCode 中创建了一个 dylib.我将安装目录设置为@rpath.然后我创建了一个测试项目,我在其中使用了这个 dylib.当我运行它时,我得到 dyld error:library not loaded....原因:找不到图像.

                  I created a dylib in XCode. I set the installtion directory to @rpath. Then I created a test project in which I am using this dylib. When I run it, I get dyld error:library not loaded....Reason: no image found.

                  但是....如果我把那个 dylib 放在/usr/lib 文件夹中,那么它就像一个魅力.

                  BUT....if I put that dylib in/usr/lib folder, then it works like a charm.

                  所以我的问题是,在编译这个 dylib 时有没有办法,我可以指定一些设置,这样它就不会在/usr/lib 中查找,而只是查看它所在的位置(如果这有意义的话)?谢谢!

                  So my question is, is there a way when compiling this dylib, I can specify some settings so it doesn't look in /usr/lib and simply looks where it's located (if that makes any sense)? Thanks!

                  推荐答案

                  我在写完这个答案后重新阅读了你的问题.由于您只是创建 dylib,而不是可执行文件,因此您只需要使用 install_name_tool -id 命令.我不相信你可以告诉它在任何地方寻找自己.我认为你必须给它一条路径.在本例中,它在应用程序包的 Frameworks 路径中查找,这是一个非常合理的查找位置.

                  I re-read your question after writing this answer. Since you're only creating the dylib, not an executable, you should only need to use the install_name_tool -id command. I don't believe you can tell it to look for itself whereever it's located. I think you have to give it a path. In this example, it looks in the application bundle's Frameworks path, which is a pretty reasonable place to look.

                  您必须更改应用程序查找文件的路径和库希望找到自己的路径.这是我使用三个 OpenCV 库的示例.

                  You have to change both the path where your application looks for the file and the path where the library expects to find itself. Here's an example where I'm using three OpenCV libraries.

                  这些第一行告诉应用程序在应用程序包的 Frameworks 文件夹中查找库.($BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH 是指定可执行文件的环境变量的组合.)

                  These first lines tell the application to look for the libraries in the application bundle's Frameworks folder. ($BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH is the combination of environment variables that specify the executable file.)

                  #Fix references in executable
                  install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib $BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH 
                  install_name_tool -change lib/libopencv_imgproc.2.3.dylib @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib $BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH 
                  install_name_tool -change lib/libopencv_highgui.2.3.dylib @executable_path/../Frameworks/libopencv_highgui.2.3.1.dylib $BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH
                  

                  我通过之前运行otool -L得到了第一个参数(lib/libopencv_core.2.3.dylib).

                  I got the first parameter (lib/libopencv_core.2.3.dylib) by previously running otool -L.

                  $ otool -L libopencv_imgproc.2.3.1.dylib 
                  libopencv_imgproc.2.3.1.dylib:
                      lib/libopencv_imgproc.2.3.dylib (compatibility version 2.3.0, current version 2.3.1)
                      lib/libopencv_core.2.3.dylib (compatibility version 2.3.0, current version 2.3.1)
                      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
                      /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
                      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
                  

                  这些下一行告诉库在 Frameworks 文件夹中寻找自己.

                  These next lines tell the libraries to look for themselves in the Frameworks folder.

                  #Fix install location in libraries
                  install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_core.2.3.1.dylib
                  install_name_tool -id @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_imgproc.2.3.1.dylib
                  install_name_tool -id @executable_path/../Frameworks/libopencv_highgui.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_highgui.2.3.1.dylib
                  

                  这些行告诉库在 Frameworks 文件夹中相互查找.

                  And these lines tell the libraries to look for each other in the Frameworks folder.

                  #Fix references in libraries
                  install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_imgproc.2.3.1.dylib
                  install_name_tool -change lib/libopencv_core.2.3.dylib @executable_path/../Frameworks/libopencv_core.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_highgui.2.3.1.dylib 
                  install_name_tool -change lib/libopencv_imgproc.2.3.dylib @executable_path/../Frameworks/libopencv_imgproc.2.3.1.dylib $BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/libopencv_highgui.2.3.1.dylib
                  

                  这一切都来自我的 Xcode 项目中目标的运行脚本构建阶段.

                  This all came from my target's Run Script build phase in my Xcode project.

                  这篇关于XCode dylib 在/usr/lib 中查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                  How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                  How can you rotate text for UIButton and UILabel in Objective-C?(如何在 Objective-C 中旋转 UIButton 和 UILabel 的文本?)
                  How to build Cocoa Touch Framework for i386 and x86_64 architecture?(如何为 i386 和 x86_64 架构构建 Cocoa Touch 框架?)
                  Can I embed a custom font in a bundle and access it from an ios framework?(我可以在包中嵌入自定义字体并从 ios 框架访问它吗?)
                  What is the PastryKit Framework?(PastryKit 框架是什么?)

                • <small id='cn6lZ'></small><noframes id='cn6lZ'>

                • <legend id='cn6lZ'><style id='cn6lZ'><dir id='cn6lZ'><q id='cn6lZ'></q></dir></style></legend>
                    <bdo id='cn6lZ'></bdo><ul id='cn6lZ'></ul>
                        <tbody id='cn6lZ'></tbody>

                          <tfoot id='cn6lZ'></tfoot>
                          <i id='cn6lZ'><tr id='cn6lZ'><dt id='cn6lZ'><q id='cn6lZ'><span id='cn6lZ'><b id='cn6lZ'><form id='cn6lZ'><ins id='cn6lZ'></ins><ul id='cn6lZ'></ul><sub id='cn6lZ'></sub></form><legend id='cn6lZ'></legend><bdo id='cn6lZ'><pre id='cn6lZ'><center id='cn6lZ'></center></pre></bdo></b><th id='cn6lZ'></th></span></q></dt></tr></i><div id='cn6lZ'><tfoot id='cn6lZ'></tfoot><dl id='cn6lZ'><fieldset id='cn6lZ'></fieldset></dl></div>