gen_bridge_metadata does not work with recent Xcode versions

Originator:yan12125
Number:rdar://40649128 Date Originated:2018.05.30
Status:Open Resolved:
Product:Xcode Product Version:9.4
Classification:Bug Reproducible:Always
 
Summary:
I can't run the command line tool /usr/bin/gen_bridge_metadata when Xcode 9.4 installed.

Steps to Reproduce:
From the terminal, run `/usr/bin/gen_bridge_metadata --version`

Expected Results:
I got the version of /usr/bin/gen_bridge_metadata

Actual Results:
The program crashes

$ /usr/bin/gen_bridge_metadata --version
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/System/Library/BridgeSupport/ruby-2.3/bridgesupportparser.bundle, 9): Library not loaded: @rpath/libclang.dylib (LoadError)
  Referenced from: /System/Library/BridgeSupport/ruby-2.3/bridgesupportparser.bundle
  Reason: image not found - /System/Library/BridgeSupport/ruby-2.3/bridgesupportparser.bundle
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/BridgeSupport/ruby-2.3/bridgesupportparser.rb:6:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/bin/gen_bridge_metadata:65:in `<main>'

Version/Build:
macOS 10.13.4 17E202
Xcode 9.4 9F1027a

Configuration:
N/A

Comments

A workaround is:

cd /Applications/Xcode.app/Contents/Developer/Toolchains sudo ln -s XcodeDefault.xctoolchain OSX10.13.xctoolchain

Then the command runs fine:

$ /usr/bin/gen_bridge_metadata --version 1.0

By yan12125 at May 30, 2018, 2 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!