-
Notifications
You must be signed in to change notification settings - Fork 15
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
Build under Windows #13
Comments
This indicates that
This indicates that you are building in debug mode. Unfortunately, there is no current support for building with a debug C runtime as the Swift runtime requires the release mode C runtime. You can workaround this by always building in Release or RelWithDebInfo configurations. @etcwilde - should we perhaps set |
Thanks for your quick answer! If I start from
I have a 64-bit CPU and OS:
|
You need to use the Native Tools Developer Command Prompt. I believe that the command prompt you are using sets up the environment for 32-bit compilation, not 64-bit. The Windows toolchain defaults to 64-bit compilation, and 32-bit is known to still contain issues :(.
Does seem to match the hypothesis above. |
Yeah, I think that makes sense. Is there a drawback to that approach? |
The only drawback that I can think of is future robustness. If we do end up supporting a debug C runtime build of the Swift runtime, it would allow us to support a |
It works with the native command prompt using this command:
It was necessary to explicitly tell cmake to use clang as MSVC was used otherwise. The other use case I had in mind was compiling the project on a Mac and a Parallels Windows installation. Following your guidance, I came up with this configure command from the x64_Native_Prompt:
I suppose that's the logic in InitializeSwift.cmake? Does it make sense to document these details somewhere in this repo? I am sure it is just my inexperience developing for Windows but that could also be true for other people coming from macOS / Linux. It's honestly amazing that all these things now also work on Windows. Seems like it can really expand the scope of Swift for cross-platform development! |
Oh, right - if you want to use
I think it makes sense to document these details, but I'm not certain about the location to document it. Perhaps @etcwilde has some thoughts.
I'm happy that you are excited about this - looking forward to see what you build :) |
Is the "always Release" also true for macOS ? I ask because I have a branch where I fill arrays from the C++ side in order to create a sparse matrix and call a solver from the Accelerate library. It does build but crashes. |
No, the thing is that Microsoft does not have a stable ABI for the C runtime, and you must match that when you build the various components. For performance and redistribution reasons, we build the runtime with the release C runtime, which then requires that we build all client code with the same runtime model. |
Hi, I wanted to build the example projects under Windows 11, Swift 5.10, installation of the toolchain via WinGet following instructions on swift.org.
When I want to build
3_bidirectional_cxx_interop
usingI get:
and
I get similar errors for
2_executable_library
.Forcing building shared libraries (cmake -S . -B build -GNinja -DBUILD_SHARED_LIBS=TRUE) resolves the problem for
2_executable_library
but3_bidirectional_cxx_interop
fails with:Do you have any suggestions what could be the issue? I understand that these examples should all work under Windows so I am assuming something might be off with my dev setup.
Best,
Felix
The text was updated successfully, but these errors were encountered: