1

When I try to deploy my app on another machine, it fails with dyld/unresolved symbol errors. (Qt static release build, btw.) When I put libstdc++ in the bundle (along with libSystem.B and libobjc.A) and run install_name_tool appropriately, I get new linker errors, for libraries upon which these libraries depend. E.g., libc++.1. I'm really hoping I don't have to manually go through and run install_name_tool on every single library and its children. (Or write my own script, which I don't know how to do.) Is there a better way? This pair (one, two) of questions goes after essentially this question but didn't quite get as far as I did and wasn't resolved in any case.

Here is where I'm at with otool:

$otool -L my_app

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 41.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55148.6.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 153.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1138.51.0) @executable_path/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) @executable_path//libstdc++.6.dylib (compatibility version 7.0.0, current version 7.17.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0) /opt/local/lib/gcc47/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) @executable_path/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) @executable_path/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 53.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 833.25.0)

Edit: Here's the initial error message I got, which after making the first round of changes disappeared, to be replaced by a similar message regarding libc++.1:

Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000002, 0x0000000000000000 Crashed Thread: 0

Dyld Error Message: Symbol not found: __ZNSt8__detail12__prime_listE Referenced from: /Users/nfoley/Downloads/WaveSorter-mac-1.0.1-static/WaveSorter.app/Contents/MacOS/WaveSorter Expected in: /usr/lib/libstdc++.6.dylib

Community
  • 1
  • 1
Matt Phillips
  • 9,465
  • 8
  • 44
  • 75
  • if your libs depend on `libc++` why are you bundling `libstdc++`? Shouldn't it be one or the other? What are the unresolved symbol errors? – Jonathan Wakely Dec 20 '12 at 06:59
  • @JonathanWakely The very first linker error I got complained about incorrect symbols in `libstdc++`. So I put it in the application directory and changed the path accordingly and got rid of that error, but then got new ones as described. – Matt Phillips Dec 20 '12 at 09:23
  • @JonathanWakely I've added the error output to the post. – Matt Phillips Dec 20 '12 at 13:11
  • Ah, so it's the third-party `WaveSorter` lib which needs `libstdc++` not your own libs, that makes more sense. You should be able to mix libs linked to libstdc++ and libs linked to libc++ as long as you don't pass `std::` objects between them, due to libc++'s nice clean use of inline namespaces. Have you tried just bindling libc++ too and see if that's all that's needed? – Jonathan Wakely Dec 20 '12 at 13:58
  • @JonathanWakely `WaveSorter` is my application. I don't extend the `std` namespace or anything like that in it. I haven't tried adding in `libc++.1` yet, that seems like the beginning of a regression that should be avoidable. – Matt Phillips Dec 20 '12 at 19:40
  • 1
    Why? How many different standard library implementations do you think you have installed on your system?! :) It sounds like some of your libs are built with libstdc++ and some with libc++. Either recompile everything to match, or link to both – Jonathan Wakely Dec 20 '12 at 20:04

0 Answers0