# File lib/phusion_passenger/platform_info/binary_compatibility.rb, line 103
        def self.passenger_binary_compatibility_id
                ruby_engine, ruby_ext_version, ruby_arch, os_name =
                        ruby_extension_binary_compatibility_ids
                
                if os_name == "macosx"
                        # RUBY_PLATFORM gives us the kernel version, but we want
                        # the OS X version.
                        os_version_string = `sw_vers -productVersion`.strip
                        # sw_vers returns something like "10.6.2". We're only
                        # interested in the first two digits (MAJOR.MINOR) since
                        # tiny releases tend to be binary compatible with each
                        # other.
                        components = os_version_string.split(".")
                        os_version = "#{components[0]}.#{components[1]}"
                        os_runtime = os_version
                        
                        os_arch = cpu_architectures[0]
                        if os_version >= "10.5" && os_arch =~ /^i.86$/
                                # On Snow Leopard, 'uname -m' returns i386 but
                                # we *know* that everything is x86_64 by default.
                                os_arch = "x86_64"
                        end
                else
                        os_arch = cpu_architectures[0]
                        
                        cpp = find_command('cpp')
                        if cpp
                                macros = `#{cpp} -dM < /dev/null`
                                
                                # Can be something like "4.3.2"
                                # or "4.2.1 20070719 (FreeBSD)"
                                macros =~ /__VERSION__ "(.+)"/
                                compiler_version = $1
                                compiler_version.gsub!(/ .*/, '') if compiler_version
                                
                                macros =~ /__GXX_ABI_VERSION (.+)$/
                                cxx_abi_version = $1
                        else
                                compiler_version = nil
                                cxx_abi_version = nil
                        end
                        
                        if compiler_version && cxx_abi_version
                                os_runtime = "gcc#{compiler_version}-#{cxx_abi_version}"
                        else
                                os_runtime = [compiler_version, cxx_abi_version].compact.join("-")
                                if os_runtime.empty?
                                        os_runtime = `uname -r`.strip
                                end
                        end
                end
                
                if ruby_engine == "jruby"
                        # For JRuby it's kinda useless to prepend "java" as extension
                        # architecture because JRuby doesn't allow any other extension
                        # architecture.
                        identifier = ""
                else
                        identifier = "#{ruby_arch}-"
                end
                identifier << "#{ruby_engine}#{ruby_ext_version}-"
                # If the extension architecture is the same as the OS architecture
                # then there's no need to specify it twice.
                if ruby_arch != os_arch
                        identifier << "#{os_arch}-"
                end
                identifier << "#{os_name}-#{os_runtime}"
                return identifier
        end