Building SwiftPM with (Swift)Foundation


#1

(Note: I’ve also posted this to swift-dev, as this mailing list didn’t show up on gmane.)

For SwiftPM, I'm looking to replace some POSIX calls with Foundation. NSTask
and NSFileManager amongst others. I've created a few PRs already for this, see
[1]. However before these can be merged, the build scripts need to be adjusted
to allow SwiftPM to build against Foundation.

There has already been some pointers posted in the comments on one of these PRs,
see [2]. I tried to implement those, see my changes to the swift build-script in
[3] and the "fake toolchain" in SwiftPM in [4]. However SwiftPM builds stage1;
stage2 is still failing. I don't know how to proceed; I've only scratched the
surface regarding build systems and the many tools used to build the various
swift parts. I would really love some help going forward.

    $ swift/utils/build-script -R --swiftpm
    (...)
    --- bootstrap: note: building self-hosted 'swift-build': env SWIFT_EXEC=/media/sf_Developer/apple/build/Ninja-ReleaseAssert/swiftpm-linux-x86_64/debug/swiftc SWIFT_BUILD_PATH=/media/sf_Developer/apple/build/Ninja-ReleaseAssert/swiftpm-linux-x86_64 /media/sf_Developer/apple/build/Ninja-ReleaseAssert/swiftpm-linux-x86_64/debug/swift-build-stage1 -Xlinker -rpath -Xlinker $ORIGIN/../lib/swift/linux -Xlinker -L -Xlinker /media/sf_Developer/apple/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation -Xlinker -rpath -Xlinker /media/sf_Developer/apple/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation -Xswiftc -I/media/sf_Developer/apple/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation -Xswiftc -I/media/sf_Developer/apple/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/usr/lib/swift
    /media/sf_Developer/apple/build/Ninja-ReleaseAssert/swiftpm-linux-x86_64/debug/swift-build-stage1: error while loading shared libraries: libFoundation.so: cannot open shared object file: No such file or directory
    --- bootstrap: error: build failed with exit status 127

- Bouke

[1]: https://github.com/apple/swift-package-manager/pulls/Bouke
[2]: https://github.com/apple/swift-package-manager/pull/292#issuecomment-216508823
[3]: https://github.com/apple/swift/compare/master...Bouke:swiftpm-foundation
[4]: https://github.com/apple/swift-package-manager/compare/ef491db...Bouke:swiftpm-foundation