Trying to get get a dev environment set up

Going through the steps in swift/GettingStarted.md at main · apple/swift · GitHub

building using Xcode:

utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping --test \
  --xcode

I get:

The following tests FAILED:
	  3 - spectest_library (Failed)
	  4 - pathological_tests_library (Failed)
	  5 - roundtriptest_library (Failed)
	  6 - entity_library (Failed)
	  7 - spectest_executable (Failed)
	  8 - smartpuncttest_executable (Failed)
	  9 - regressiontest_executable (Failed)

and I don't get the Xcode projects in the expected directories.

Went through the troubleshooting.

I feel like there are too many steps here and too much potential for breakage.

any help appreciated! Just let me know what other info you need :slight_smile:

Give this thread a look, seems like the same issue (you can skip the CMark tests with --skip-test-cmark as a workaround).

1 Like

Same result with --skip-test-cmark. I tried deleting ../build (because I don't know how to clean). I did:

utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --skip-test-cmark --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping --test \
  --Xcode

Got a lot further with ninja:

Failed Tests (1):
  Swift(macosx-x86_64) :: ModuleInterface/build-alternative-interface-framework.swift


Testing Time: 469.45s
  Unsupported      :  223
  Passed           : 7432
  Expectedly Failed:   24
  Failed           :    1

Just --clean should do it =]

1 Like

Still haven't gotten Xcode project generation to work. Also can't get build-toolchain to work, seems I'm getting link errors because it's expecting an arm64 version of python:

ld: warning: ignoring file /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_PyMemoryView_FromMemory", referenced from:
      (anonymous namespace)::BinaryPythonFile::Write(void const*, unsigned long&) in liblldbPluginScriptInterpreterPython.a(PythonDataObjects.cpp.o)
  "_PyErr_NormalizeException", referenced from:
      lldb_private::python::PythonException::PythonException(char const*) in liblldbPluginScriptInterpreterPython.a(PythonDataObjects.cpp.o)
  "_PyImport_ImportModule", referenced from:
      lldb_private::python::PythonModule::Import(llvm::Twine const&) in liblldbPluginScriptInterpreterPython.a(PythonDataObjects.cpp.o)

etc.

I don't recommend using build-toolchain as it's currently configured on macOS, because it always tries to cross-compile the toolchain for arm64 too. You can comment out that line in the preset for now, should fix it, but I think that should be properly fixed.

1 Like

Ok now I'm getting:

** Generating gyb Files **
/Users/holliday/opt/anaconda3/bin/python /Users/holliday/swift-project/swift/utils/gyb /Users/holliday/swift-project/swift-syntax/Sources/SwiftSyntax/SyntaxFactory.swift.gyb -o /var/folders/kj/6xq_02p15hn3_88kwl7s38p00000gn/T/SyntaxFactory.swift --line-directive=
rsync --checksum /var/folders/kj/6xq_02p15hn3_88kwl7s38p00000gn/T/SyntaxFactory.swift /var/folders/kj/6xq_02p15hn3_88kwl7s38p00000gn/T/tmp6am4hrq9/SyntaxFactory.swift
/Users/holliday/opt/anaconda3/bin/python /Users/holliday/swift-project/swift/utils/gyb /Users/holliday/swift-project/swift-syntax/Sources/SwiftSyntax/SyntaxEnum.swift.gyb -o /var/folders/kj/6xq_02p15hn3_88kwl7s38p00000gn/T/SyntaxEnum.swift --line-directive=
Traceback (most recent call last):
  File "/Users/holliday/swift-project/swift/utils/gyb", line 3, in <module>
    gyb.main()
  File "/Users/holliday/swift-project/swift/utils/gyb.py", line 1267, in main
    f.write(execute_template(ast, args.line_directive, **bindings))
  File "/Users/holliday/swift-project/swift/utils/gyb.py", line 1137, in execute_template
    ast.execute(execution_context)
  File "/Users/holliday/swift-project/swift/utils/gyb.py", line 639, in execute
    x.execute(context)
  File "/Users/holliday/swift-project/swift/utils/gyb.py", line 725, in execute
    result = eval(self.code, context.local_bindings)
  File "/Users/holliday/swift-project/swift-syntax/Sources/SwiftSyntax/SyntaxEnum.swift.gyb", line 4, in <module>
    from gyb_syntax_support.Traits import TRAITS
  File "/Users/holliday/swift-project/swift/utils/gyb_syntax_support/Traits.py", line 1, in <module>
    from Child import Child
ModuleNotFoundError: No module named 'Child'
FAIL: Gyb-generated files committed to repository do not match generated ones. Please re-generate the gyb-files and recommit them.

I added GitHub CI to my fork, mostly to show the various issues I'm having trying to get things to build. Here's the output from the ninja build: Update build.yml · audulus/swift@3ff0613 · GitHub

Anyone know how to fix those test failures?

Fixed this issue by using the default python (oops).

But now for build-toolchain I'm getting:

--- Running tests for benchmarks ---
+ /Users/holliday/swift-project/build/buildbot_osx/benchmarks-macosx-x86_64/bin/Benchmark_Onone --num-iters=1 XorLoop
dyld: Symbol not found: _SayxSicig16_Differentiation14DifferentiableRzlWJrUSpSr
  Referenced from: /Users/holliday/swift-project/build/buildbot_osx/benchmarks-macosx-x86_64/bin/Benchmark_Onone
  Expected in: /usr/lib/swift/libswift_Differentiation.dylib
 in /Users/holliday/swift-project/build/buildbot_osx/benchmarks-macosx-x86_64/bin/Benchmark_Onone

You commented out that arm64 cross-compile from the preset? You could comment out this benchmark build too and then circle back at the end to fix whatever is failing.

Also, what commit have you checked out of the Swift repos, just latest main? I don't recommend that, best is to check out the latest source snapshot, currently June 1st. That way, you know you have a set of commits that passed the CI together (if you're using update-checkout, it has a flag to checkout all Swift repos to one tag).

1 Like

Btw @mishal_shah, I noticed that a handful of Swift repos were not tagged with the trunk June 1 snapshot tag, like libdispatch. Never seen that before, something slipped through the cracks?

Same thing happened to me. Filed SR-14724 yesterday.

Terms of Service

Privacy Policy

Cookie Policy