I appreciate this article is regarding linux, but I assume this support was once available on macos, until M1 came along is that correct?
swift build -c release -Xswiftc -static-stdlib
error: -static-stdlib is no longer supported for Apple platforms
I would like to install a released product into a suitable bin folder. Something like:
install .build/release/<product> /usr/local/bin/<product>
I can build successfully by simply calling
swift build
...but the above install command doesn't work on the generated .product files found in
.build/arm64-apple-macosx/release/
Jon_Shier
(Jon Shier)
2
No, Apple platforms don't support static linking because the Swift runtime is included with the OS, so it must always be dynamically loaded.
I don't use install or do anything special, I simply copy my executable to the appropriate directory.
Thanks for the reply.
Where is the executable located?
The contents of .build/arm64-apple-macosx/release has a file named <name>.product.
Jon_Shier
(Jon Shier)
4
My executable product is in the release directory. I copy that wherever needed.
Jon_Shier
(Jon Shier)
5
I've found that if I make a universal binary it's put in .build/apple/Products/Release.
That directory doesn't exist on my machine 
Jon_Shier
(Jon Shier)
7
Universal binaries are only made if you explicitly pass both archs. swift build -c release --arch arm64 --arch x86_64
1 Like
jonprescott
(Jonathan Prescott)
8
I think it was turned into an error when MacOS started shipping the Swift libraries as part of the system as dynamic libraries which was MacOS 10.12. But, I'm not sure how this question relates to the install question. It looks like you have the wrong source path in the install command.