SPMDestinations / homebrew-tap

Homebrew Formulas to install Swift Cross Compilers on macOS (e.g. targeting Ubuntu).
35 stars 2 forks source link

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

Open LebJe opened 3 years ago

LebJe commented 3 years ago

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>
helje5 commented 3 years ago

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

LebJe commented 3 years ago

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

benrosen78 commented 1 year ago

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