I have found the solution. This is hook, but it works.
You should do this as root.
Go to default toolchain bin directory
cd $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin
Rename current libtool to old_libtool
mv libtool old_libtool
Create new libtool
touch libtool && chmod +x libtool
Insert current script as content of new libtool
#!/usr/bin/python
import os
import subprocess
import sys
args=[]
for arg in sys.argv[1:]:
if arg != '-Xlinker' and arg != '-add_ast_path' and not arg.endswith('swiftmodule'):
args.append(arg)
args.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'old_libtool'))
subprocess.check_call(args)
Compile.