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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 18:55:15

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).

While the selected answer is probably more practical to many, this is actually a bug in Apple's toolchain that is trivially fixed with a very small patch. It is certainly incorrect to blame the issue on using C++0x, or even to blame the issue on using different versions of gcc: this stuff is generally supposed to work. Given how many people seem to experience this issue as users (judging by a Google search) hopefully this can be fixed upstream in Xcode 5.1 (although given the smug reaction I've gotten in the past from Apple with regards to simple five-minute fixes to better support backwards compatibility, I'm not holding my breath; I am going to file a radar regardless, as I consider this kind of thing really important). The fix is to modify the ostream header to add __TARGETING_4_0_DYLIB guards around the operator<< implementation for strings. I have placed a patch on my website at http://test.saurik.com/apple/ostream1.diff.

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