无法在另一台Mac上使用OS-X Leopard(10.5.8)运行在OS-X Snow Leopard(10.6.7)上编译的应用程序。 libstdc ++。6.dylib错误返回 [英] Unable to run an application compiled on OS-X Snow Leopard (10.6.7) on another Mac using OS-X Leopard (10.5.8). libstdc++.6.dylib error returned

查看:445
本文介绍了无法在另一台Mac上使用OS-X Leopard(10.5.8)运行在OS-X Snow Leopard(10.6.7)上编译的应用程序。 libstdc ++。6.dylib错误返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用C ++ 0x和Ogre在Max OS-X上移植C ++项目,我在OS-X版本之间遇到了可移植性问题。



我成功地编译我的项目在Mac OS-X 10.6(雪豹)使用GCC 4.6.0(因为我需要C ++ 0x)。这是很难(可能是因为我是一个新的OSX用户),但它终于编译它没有错误。



我包括所有需要的组件,框架, Application.app捆绑包,它确实开始罚款在这个Mac OS-X 10.6



但是当我转移项目在我的旧笔记本电脑安装与Mac OS X 10.5.8我无法运行该应用程序。



如果我双击.app它尝试开始,最后图标从菜单栏消失,这就是全部。但是如果我运行的可执行文件包含在.app直接它返回以下错误:

  MacBook-2:〜root# /var/root/Desktop/MyProject.app/Contents/MacOS/MyProject;出口; 
dyld的:延迟符号绑定失败:找不到符号:/var/root/Desktop/MyProject.app/Contents/MacOS/../Frameworks/Ogre.framework/Versions/1.7:__ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
从引用0.3 /食人魔
预计:/usr/lib/libstdc++.6.dylib

dyld的:找不到符号:__ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
引用自:在/ var /根/桌面/ MyProject.app/Contents/MacOS/../Frameworks/Ogre.framework/Versions/1.7.3/Ogre
预计于:/usr/lib/libstdc++.6.dylib

跟踪/ BPT trap
logout

这是应用程序捆绑包树视图。



MyProject.app




  • 元件

    • ... (Ogre组件)


  • ul>
  • Ogre.framework


  • MacOS

    • MyProject (可执行)


  • 插件

    • ... (Ogre插件)


  • >
  • ... (Ogre .cfg + my assets)






  • 我告诉Cmake使用MacOSX10.5.sdk使用(设置在Cmake GUI内,不在CMakeList.txt内):




    • CMAKE_OSX_DEPLOYEMENT_TARGET 10.5

    • CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk



    但它似乎没有任何改变...






    libstdc ++。dylib文件,链接到libstdc ++ 6.0.9.dylib在Mac上用于编译应用程序,而它链接到libstdc ++ 6.0.4.dylib在Mac上用于测试可移植性。 p>

    但是我告诉它使用MacOSX10.5.sdk我虽然会在编译时使用libstdc ++ 6.0.4.dylib,所以它可以在Mac上运行安装了10.5



    的确,目标是让它运行在第二个Mac上(所有Mac使用10.5+),而不改变任何东西。只要下载并执行...



    有没有人可以告诉我我在这里缺少什么?(我真的不会流利OS-X方法和组织,所以我可以错过一些非常基本的东西,不要害怕粗糙^^)。



    如何指定Cmake中的目标SDK?(使用的Cmake命令是否不足?)






    编译我的项目:




    • Mac OS-X 10.6.7

    • li>
    • Cmake 2.8-4

    • Ogre 1.7.3



    我使用以下来测试项目:




    • Mac OS-X 10.5.8(安装了一些开发工具,必须告诉它,以防它可能干扰应用程序)。






    编辑



    我发现otool这里是返回的日志

      Valkeas-Mac:MacOS root#otool  - L MyProject 
    MyProject:
    @executable_path /../ Frameworks / Ogre.framework / Versions / 1.7.3 / Ogre(兼容性版本0.0.0,当前版本1.7.3)
    @executable_path /../Components/libOgreTerrain.dylib(兼容版本0.0.0,目前版本1.7.3)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon(兼容版本2.0.0,目前版本136.0.0)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa(兼容版本1.0.0,当前版本12.0.0)
    /系统/库/框架/由于IOKit .framework / Versions / A / IOKit(兼容性版本1.0.0,当前版本275.0.0)
    /opt/local/lib/gcc46/libstdc++.6.dylib(兼容性版本7.0.0,当前版本7.15。 0)
    /usr/lib/libgcc_s.1.dylib(兼容性版本1.0.0,当前版本1.0.0)
    /opt/local/lib/gcc46/libgcc_s.1.dylib(兼容性版本1.0.0,当前版本1.0.0)
    /usr/lib/libSystem.B.dylib(兼容版本1.0.0,当前版本为111.1.4)
    /usr/lib/libobjc.A。 dylib(兼容版本1.0.0,当前版本227.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation(兼容版本150.0.0,目前的版本476.19.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit(兼容版本45.0.0,目前的版本949.54.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (兼容性版本1.0.0,当前版本34.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation(兼容性版本300.0.0,当前版本677.26.0)
    Valkeas-Mac:MacOS root#

    显然它链接到gcc46 libstdc ++ 6.dylib因为我猜这个文件包含C ++ 0x功能的GCC 4.6.0)。



    那么有什么解决方案吗? (-static返回一个错误,告诉我需要动态...)

    解决方案

    libstdc ++ 你使用的是从gcc 4.6。由于你使用C ++ 0x,这在OS X附带的gcc版本中不可用,因此内置的 libstdc ++ 不工作是不奇怪的。你需要发送你在应用程序包中使用的 libstdc ++。dylib (你可以把它放在,例如your.app/Contents/Libraries)。使用 install_name_tool 确保它使用相对路径引用(使用 @rpath @executable_path )。


    I'm trying to port a C++ project using C++0x and Ogre on Max OS-X and I encounter a portability problem between OS-X versions.

    I succeeded in compiling my project on Mac OS-X 10.6 (Snow Leopard) using GCC 4.6.0 (because I needed C++0x). It was hard (probably because I a new OSX user) but it finally compiled it without error.

    I included all the required Components, Frameworks, Plugins etc. needed into the Application.app bundle and it does start fine on this Mac OS-X 10.6

    But when I transfer the project on my old laptop installed with Mac OS-X 10.5.8 I'm unable to run the application.

    If I double click the .app it try to start and finally the Icon disappear from the menu bar and that's all. But if I run the executable file included in the .app directly it returns the following errors:

    MacBook-2:~ root# /var/root/Desktop/MyProject.app/Contents/MacOS/MyProject ; exit;
    dyld: lazy symbol binding failed: Symbol not found: __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
      Referenced from: /var/root/Desktop/MyProject.app/Contents/MacOS/../Frameworks/Ogre.framework/Versions/1.7.3/Ogre
      Expected in: /usr/lib/libstdc++.6.dylib
    
    dyld: Symbol not found: __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
      Referenced from: /var/root/Desktop/MyProject.app/Contents/MacOS/../Frameworks/Ogre.framework/Versions/1.7.3/Ogre
      Expected in: /usr/lib/libstdc++.6.dylib
    
    Trace/BPT trap
    logout
    

    Here is the application bundle tree view.

    MyProject.app

    • Components
      • ... (Ogre components)
    • Frameworks
      • Ogre.framework
    • MacOS
      • MyProject (executable)
    • Plugins
      • ... (Ogre plugins)
    • Resources
      • ... (Ogre .cfg + my assets)

    I told Cmake to use the MacOSX10.5.sdk using (set inside the Cmake GUI, not inside the CMakeList.txt):

    • CMAKE_OSX_DEPLOYEMENT_TARGET 10.5
    • CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk

    But it doesn't seems to change anything...


    The libstdc++.dylib file, links to libstdc++.6.0.9.dylib on the Mac used to compile the application whereas it links to libstdc++.6.0.4.dylib on the Mac used to test portability.

    But as I told it to use the MacOSX10.5.sdk I though it would use the libstdc++.6.0.4.dylib at compile time, so it can run on the Mac installed with 10.5

    Indeed the goal is to make it runs on the second Mac (and all Mac using 10.5+) without changing anything on it. Just download and run...

    Does anybody can tell my what I'm missing here ? (I don't really feel fluent with the OS-X methods and organisation so I could have missed something very basic, don't fear to be crude ^^).

    How do I specify the targeted SDK in Cmake ? (Are the used Cmake commands not sufficient ?)


    I use the following to compile my project:

    • Mac OS-X 10.6.7
    • GCC 4.6.0
    • Cmake 2.8-4
    • Ogre 1.7.3

    I use the following to test the project:

    • Mac OS-X 10.5.8 (there is some dev tools installed. I think I must tell it, in case it could interfere with the applications).

    Edit:

    As I discovered otool here is the log returned

    Valkeas-Mac:MacOS root# otool -L MyProject 
    MyProject:
        @executable_path/../Frameworks/Ogre.framework/Versions/1.7.3/Ogre (compatibility version 0.0.0, current version 1.7.3)
        @executable_path/../Components/libOgreTerrain.dylib (compatibility version 0.0.0, current version 1.7.3)
        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)
        /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0)
        /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
        /opt/local/lib/gcc46/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.15.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /opt/local/lib/gcc46/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
        /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.19.0)
        /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.54.0)
        /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 34.0.0)
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.26.0)
    Valkeas-Mac:MacOS root# 
    

    Obviously it links to the gcc46 libstdc++.6.dylib (probably normal as I guess this file contains the C++0x functions of the GCC 4.6.0).

    So is there any solution ? (-static returns an error that tell I need dynamic...)

    解决方案

    The libstdc++ you're using is from gcc 4.6. Since you're using C++0x, which is not available in the version of gcc that ships with OS X, it's no surprise that the built-in libstdc++ does not work. You need to ship the libstdc++.dylib you're using inside your application bundle (you can put it in, eg, your.app/Contents/Libraries). Use install_name_tool to make sure it's referenced using a relative path (use @rpath or @executable_path).

    这篇关于无法在另一台Mac上使用OS-X Leopard(10.5.8)运行在OS-X Snow Leopard(10.6.7)上编译的应用程序。 libstdc ++。6.dylib错误返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆