homebrew-tap icon indicating copy to clipboard operation
homebrew-tap copied to clipboard

Can't load `Dispatch` when statically compiling `Foundation`

Open LebJe opened this issue 5 years ago • 3 comments

When statically compiling a package that imports Foundation, the build fails since Dispatch can't be loaded/found.

To reproduce, run:

$ swift package init --type executable

then add import Foundation to main.swift.

$ swift build \                                                                                                                                                        
--destination /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/destination.json \
--static-swift-stdlib \
-Xswiftc "-static-executable"
<unknown>:0: error: cannot load underlying module for 'Dispatch'
<module-includes>:5:10: note: in file included from<module-includes>:5:
#include "private_includes/utmp.h"
		 ^
/usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/x86_64-ubuntu16.04.sdk/usr/lib/swift/linux/x86_64/private_includes/utmp.h:1:10: note: in file included from /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/x86_64-ubuntu16.04.sdk/usr/lib/swift/linux/x86_64/private_includes/utmp.h:1:
#include <utmp.h>
		 ^
/usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/x86_64-ubuntu16.04.sdk/usr/include/utmp.h:23:10: note: in file included from /usr/local/lib/swift/dst/x86_64-unknown-linux/swift-5.3-ubuntu16.04.xtoolchain/x86_64-ubuntu16.04.sdk/usr/include/utmp.h:23:
#include <sys/types.h>

LebJe avatar Feb 17 '21 01:02 LebJe

I think this mirrors https://github.com/SwiftXcode/swift-lambda/issues/3

helje5 avatar Feb 17 '21 12:02 helje5

Do you mind if I keep this issue open so it points to the issue you mentioned?

LebJe avatar Mar 02 '21 01:03 LebJe

Hi there, has there been any new success with getting Foundation to compile statically for AWS lambdas?

benrosen78 avatar Jan 12 '23 14:01 benrosen78