-------- Original Message --------
> From: "Alex Reynolds" <alexpreyno...@gmail.com>
> Sent: Donnerstag, 21. März 2013 23:37
> To: macports-dev@lists.macosforge.org
> Subject: Building a universal static libstdc++ library through MacPorts
> 
> I would like to build a set of universal binaries with MacPorts GCC 4.7.2 
> (universal), which link in a static C++ standard library. 
> 
> I would like to do this to see if this will fix errors my end users are 
> seeing with unlinked objects from the C++ standard library, which are 
> referenced in code compiled with MacPorts GCC 4.7.2 (universal) but which 
> apparently are not part of the C++ standard library on a stock installation 
> of (for instance) Mac OS X 10.8.2. 
> 
> For example, some OS X users see the following error:
> 
> ------
> $ myBinary
> dyld: lazy symbol binding failed: Symbol not found: 
> __ZNSt8__detail15_List_node_base7_M_hookEPS0_
>   Referenced from: /usr/local/bin/myBinary
>   Expected in: /usr/lib/libstdc++.6.dylib
> 
> dyld: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_
>   Referenced from: /usr/local/bin/myBinary
>   Expected in: /usr/lib/libstdc++.6.dylib
> 
> Trace/BPT trap: 5
> 
> $ nm myBinary | grep __ZNSt8__detail15_List_node_base7_M_hookEPS0_
>         U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
> ------
> 
> I added the -static-libstdc++ flag before compilation, but the binaries do 
> not include the static library and instead appear to continue linking to 
> dynamic equivalents:
> 
> ------
> $ otool -L /usr/local/bin/myBinary
> /usr/local/bin/myBinary:
>        /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current 
> version 1.0.5)
>        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 
> 1.2.5)
>        /opt/local/lib/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 1669.0.0)
>        /opt/local/lib/gcc47/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 169.3.0)
> ------
> 
> Distributing MacPorts GCC 4.7.2 (universal) with my pre-built binaries does 
> not seem like a realistic option. To keep complexity and distribution sizes 
> down, I would like to try to distribute binaries which just include the 
> static library, if that is required to address these errors.

Wouldn't it be feasible for you to just distribute libstdc++.dylib
from MP (and possibly further libs referenced in /opt/local/lib)
together with your exe?

Regards
Titus


_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to