Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build with Swift 5.9.1 #768

Closed
tonka3000 opened this issue Oct 27, 2023 · 6 comments
Closed

Can not build with Swift 5.9.1 #768

tonka3000 opened this issue Oct 27, 2023 · 6 comments

Comments

@tonka3000
Copy link
Contributor

I tried to build the project with the 5.9.1 build from https://www.swift.org/download but I always get the same error with CoreAnimation.

Any idea what is wrong here? Static vs dynamic build?

[main] Building folder: swift-win32 
[build] Starting build
[proc] Executing command: C:\Users\tbam\Downloads\cmake-3.27.7-windows-x86_64\bin\cmake.EXE --build C:/sandbox/swift/swift-win32/build/x86_64-unknown-windows-msvc/Release --target all
[build] [1/6] Linking Swift static library lib\CoreAnimation.lib
[build] FAILED: lib/CoreAnimation.lib Sources/SwiftWin32/CMakeFiles/CoreAnimation.dir/CoreAnimation/Transform3D.swift.obj swift/CoreAnimation.swiftmodule 
[build] cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -j 6 -num-threads 6 -emit-library -static -o lib\CoreAnimation.lib -module-name CoreAnimation -module-link-name CoreAnimation -emit-module -emit-module-path swift\CoreAnimation.swiftmodule -emit-dependencies  -sdk C:/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk -O -wmo -libc MD -output-file-map Sources\SwiftWin32\CMakeFiles\CoreAnimation.dir\Release\output-file-map.json  C:\sandbox\swift\swift-win32\Sources\SwiftWin32\CoreAnimation\Transform3D.swift    && cd ."
[build] error: link command failed with exit code 1 (use -v to see invocation)
[build] /usr/bin/link: extra operand '/OUT:lib\\CoreAnimation.lib'
[build] Try '/usr/bin/link --help' for more information.
[build] error: fatalError
[build] [2/6] Linking Swift shared library bin\Collections.dll
[build] ninja: build stopped: subcommand failed.
[proc] The command: C:\Users\tbam\Downloads\cmake-3.27.7-windows-x86_64\bin\cmake.EXE --build C:/sandbox/swift/swift-win32/build/x86_64-unknown-windows-msvc/Release --target all exited with code: 1
[driver] Build completed: 00:00:00.574
[build] Build finished with exit code 1
@compnerd
Copy link
Owner

You are running in the wrong environment. As the instructions state, run from a VS developer cmd shell. /usr/bin/link would onky appear if you are using bash as the shell.

@compnerd compnerd closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2023
@tonka3000
Copy link
Contributor Author

Thanks, that worked. It is strange that cmake presets don't bootstrap the environment like it is possible with vscode in non cmake-preset cases, but this seems to be intentional from cmake.

I missing the instructions because they are in the swift package manager section. Would you accept a PR where I would update the README in that regard for the cmake section? Just in case somebody else have the same issue.

@compnerd
Copy link
Owner

@tonka3000 Absolutely!

@tonka3000
Copy link
Contributor Author

@compnerd I add #769 with the update in the Readme

One thing I hit with 5.9 when I used SPM to build.

It always throw an error

error: 'swift-win32': package '[email protected]' is using Swift tools version 3.1.0 which is no longer supported; consider using '// swift-tools-version: 5.9' to specify the current tools version

when I type swift build --product UICatalog.

I was only able to fix it by copy [email protected] to [email protected] and change the swift-tools-version to 5.9. I also need add build extra target for CoreAnimation back as it was done in Package.swift, otherwise I always get an error when it tried to import CoreAnimation. I have a full impl. in my fork here

Maybe there are better ways to do that, but I was my first time playing with swift and the redirect package.swift files seems not to allow the declaration of another swift-tools-version.

@compnerd
Copy link
Owner

Hmm, I think that something weird is going on. SPM should be using Package.swift, which does indicate swift-tools-version:5.7. The redirection is something very recent that I introduced so that I can start ripping out some of the complexity in the build rules.

The intent is to have a version for the older releases and have the latest release use Package.swift.

This does sound like a separate issue, perhaps we should create a new issue to track and discuss it?

@tonka3000
Copy link
Contributor Author

This does sound like a separate issue, perhaps we should create a new issue to track and discuss it?

See #771

compnerd added a commit that referenced this issue Dec 2, 2023
Add more information about compiling with cmake as mentioned in [#768](#768 (comment))

Co-authored-by: Saleem Abdulrasool <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants