On 24.03.2018 at 14:07 Mojca Miklavec wrote:

> On 24 March 2018 at 13:35, Andreas Falkenhahn wrote:
>> When I compile my C++11 project on a 10.5 PPC system using gcc6 and try to 
>> run it on another 10.5 PPC system that doesn't have gcc6 installed, I get an 
>> error that a symbol cannot be imported from /usr/lib/libstdc++.6.dylib. I 
>> guess this is because the libstdc++.6.dylib that is shipped with 10.5 
>> doesn't contain those new features required by C++11 programs.

>> So what is the recommended way of getting the libstdc++.6.dylib required by 
>> my program onto a user system? Of course I wouldn't like to bother users to 
>> install gcc6 from Mac Ports just to be able to run my program. Is there an 
>> easier way? Is the latest libstdc++ available as its own package in Mac 
>> Ports maybe or what is the suggested way of dealing with this?

> You need to compile with ABI 4 compatibility (add
> "-D_GLIBCXX_USE_CXX11_ABI=0" to CXXFLAGS) and then relink them to
> /usr/lib/libstdc++.6.dylib with install_name_tool.

> The first step might soon no longer be required (see
> https://github.com/macports/macports-ports/pull/1469), but you'll
> probably need to keep running install_name_tool on the resulting
> libraries/binaries, I assume that your binaries link against
> /opt/local/lib/libstdc++.6.dylib rather than
> /usr/lib/libstdc++.*.dylib

Yes, it does. Unfortunately, compiling with -D_GLIBCXX_USE_CXX11_ABI=0 and
then changing /opt/local/lib/libstdc++.6.dylib to /usr/lib/libstdc++.6.dylib
using install_name_tool doesn't work. It still can't find some symbols.
Here's the error I get when trying to dlopen() my project:

dyld: lazy symbol binding failed: Symbol not found: 
__ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
  Referenced from: test.dylib
  Expected in: /usr/lib/libstdc++.6.dylib

dyld: Symbol not found: 
__ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i
  Referenced from: test.dylib
  Expected in: /usr/lib/libstdc++.6.dylib

-- 
Best regards,
 Andreas Falkenhahn                            mailto:andr...@falkenhahn.com

Reply via email to