G ++ - 4.8 C ++ stdlib dylib

I compiled the C ++ Hello world file with gcc48 (installed via homebrew), and when I check the dynamic libraries associated with them, I see:

otool -L Test

Test: /usr/local/Cellar/gcc48/4.8.1/gcc/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.18.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0) /usr/local/Cellar/gcc48/4.8.1/gcc/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) 

However, if I compile this with the provided apple gcc, g ++ I get:

 Test: /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0) 

How can I get g ++ - 4.8 to link / compile with provided apple.dylib?

EDIT: Could I just distribute the program with / usr / local / Cellar / gcc 48 / 4.8.1 / gcc / lib / libstdc ++. 6.dylib and use install_name_tool to change the path for this?

+6
source share
1 answer

Perhaps you can try:

 export DYLD_LIBRARY_PATH=...:$DYLD_LIBRARY_PATH 

to prioritize apple dilibs.

0
source

Source: https://habr.com/ru/post/954857/


All Articles