I'm trying to compile swift, and I keep getting the same error no matter which flags I give the compiler. I installed python via homebrew, which now installs python 3 as
python and python 2 as
python2. I ran a find & replace of
#!/usr/bin/env python with
#!/usr/bin/env python2 on all the files in the project, but I wonder if there's anything more to do to make the project compile.
As an aside, it seems that using the default macOS python is not encouraged any more, and I would guess that most people install their python with homebrew. I'm surprised that more people aren't hitting this issue, as I'm not finding any fixes by googling for this error.
I know that there are a couple of pull requests to update the python code in the project to python 3, but it's not entirely clear what the schedule/priority is for those to get merged, so any short term fixes would be appreciated, I was hoping to play with the standard library over this long weekend
In case this helps, here's the error output:
FAILED: lib/Syntax/8/SyntaxFactory.cpp cd /Users/sasha/Develop/swift/lib/Syntax && /usr/local/Cellar/cmake/3.16.2/bin/cmake -E make_directory /Users/sasha/Develop/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Syntax/8 && /usr/local/bin/python /Users/sasha/Develop/swift/utils/gyb --line-directive '#line %(line)d "%(file)s"' -DCMAKE_SIZEOF_VOID_P=8 -o /Users/sasha/Develop/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Syntax/8/SyntaxFactory.cpp.tmp SyntaxFactory.cpp.gyb && /usr/local/Cellar/cmake/3.16.2/bin/cmake -E copy_if_different /Users/sasha/Develop/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Syntax/8/SyntaxFactory.cpp.tmp /Users/sasha/Develop/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Syntax/8/SyntaxFactory.cpp && /usr/local/Cellar/cmake/3.16.2/bin/cmake -E remove /Users/sasha/Develop/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Syntax/8/SyntaxFactory.cpp.tmp Traceback (most recent call last): File "/Users/sasha/Develop/swift/utils/gyb", line 3, in <module> gyb.main() File "/Users/sasha/Develop/swift/utils/gyb.py", line 1266, in main args.target.write(execute_template(ast, args.line_directive, **bindings)) File "/Users/sasha/Develop/swift/utils/gyb.py", line 1134, in execute_template ast.execute(execution_context) File "/Users/sasha/Develop/swift/utils/gyb.py", line 638, in execute x.execute(context) File "/Users/sasha/Develop/swift/utils/gyb.py", line 724, in execute result = eval(self.code, context.local_bindings) File "/Users/sasha/Develop/swift/lib/Syntax/SyntaxFactory.cpp.gyb", line 2, in <module> from gyb_syntax_support import * File "/Users/sasha/Develop/swift/utils/gyb_syntax_support/__init__.py", line 2, in <module> from AttributeNodes import ATTRIBUTE_NODES # noqa: I201 ModuleNotFoundError: No module named 'AttributeNodes' [24/1754][ 1%][0.508s] Generating UnicodeExtendedGr...deExtendedGraphemeClusters.cpp.gyb with ptr size = ninja: build stopped: subcommand failed. utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting