This might be a more dev-oriented question on the -users list.

Begin forwarded message:

> From: Alex Reynolds <[email protected]>
> Date: March 21, 2013 5:29:08 PM EDT
> To: [email protected]
> Cc: Alex Reynolds <[email protected]>
> Subject: Getting a universal static libstdc++ library through MacPorts
> 
> I publish some open-source software to a scientific community that runs Linux 
> and OS X. 
> 
> The OS X builds I am distributing are fat (universal) binaries created with 
> GCC 4.7.2 (universal) obtained through MacPorts.
> 
> I am getting reports from some end users of errors of the following kind:
> 
> ------
> 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
> ------
> 
> Even when compiling my binaries with the -static-libstdc++ flag, it looks 
> like the dynamic C++ and C libraries are linked into the binary:
> 
> ------
> $ 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)
> ------
> 
> It also looks like there is no /opt/local/lib/libstdc++.6.a installed by 
> MacPorts. So that may explain why the -static-libstdc++ flag fails to work.
> 
> Perhaps one way to fix this would be to suggest that end users install GCC 
> 4.7.2 (universal) through MacPorts, in order to get a copy of the dynamic 
> library into /opt/local/lib, and then they would use sudo to make a symbolic 
> link from the library in /opt/local/lib to /usr/lib.
> 
> I'd like to avoid this solution, since they would have to have root access 
> and some skill with the command-line, compiling applications, and making 
> symbolic links that may break between OS X system updates and upgrades. 
> 
> Also, the main point of distributing pre-built binaries is also to save end 
> users the hassle of doing all this error-prone work and system customization.
> 
> Is there a way to get a static libstc++ library for the GCC 4.7.2 (universal) 
> port through MacPorts, which I can statically link into my binary? 
> 
> My hope then is that end users will not have to install MacPorts and GCC 
> 4.7.2 (universal) before running my binaries, and that they will be able to 
> run my binaries without errors (at least, those errors that appear to be 
> related to missing libraries).
> 
> Failing that, what is the process for getting a local copy of the port — 
> before MacPorts builds it — to be able to modify how the universal GCC build 
> is built, to somehow get the static library built?
> 
> I'm not too familiar with how MacPorts does its magic. I have tried looking 
> through /opt/local, but I'm not sure where the files are kept that built my 
> installation of GCC 4.7.2 (universal). Is there a Portfile (?) that I would 
> modify? How would I modify it before MacPorts completes its build, and where 
> is it kept? If my question is stupid or too broad, I apologize in advance for 
> wasting others' time. I appreciate any help with this.
> 
> Regards,
> Alex
> _______________________________________________
> macports-users mailing list
> [email protected]
> https://lists.macosforge.org/mailman/listinfo/macports-users

_______________________________________________
macports-dev mailing list
[email protected]
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to