What is the meaning of the libstdc++6.dylib version number on mac os x?

4.7k views Asked by At

I try to determine which version of libstdc++ is running by the gcc5.1 port on Mac OS X (Yosemite 10.10.3).

The otool command gives the following information:

/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.21.0)

What is the meaning of version 7.21.0? libstdc++7 does really exist?

1

There are 1 answers

1
neverpanic On BEST ANSWER

If you want to find the corresponding GCC version number for the version of libstdc++, do this:

$> port provides /opt/local/lib/libgcc/libstdc++.6.dylib

That will tell you which port installed the given file. In my case, that's libgcc, I'll assume it's the same for you. To find out the currently installed version of libgcc, use port installed:

$> port installed libgcc

On my system, that's libgcc @5.1.0_1 (active), so the version of libstdc++ corresponds to the one shipped with GCC 5.1.

Note that the compatibility version on OS X is not the same version number as the one given in the file name of the library. It is more equivalent to a minor version number on Linux systems. See https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23 for more details on that, in specific this part applies:

In addition to the major version number, a library has a minor version number. The minor version number is an incremental number using the format X[.Y[.Z]] , where X is a number between 0 and 65535, and Y and Z are numbers between 0 and 255. For example, the minor version number for the first release of the Draw library could be 1.0. To set the minor version number of a dynamic library, use the clang -current_version option.

The compatibility version number is similar to the minor version number; it’s set through the compiler -compatibility_version command-line option. The compatibility version number of a library release specifies the earliest minor version of the clients linked with that release can use. For instance, the example in Defining Client Compatibility indicates that Client 1.1 cannot use versions of the Draw library earlier than 1.2 because they don’t export the draw_polygon function. To view a library’s current and compatibility versions, use the otool -L command.