[swift-dev] Building SwiftPM with Foundation
Daniel Dunbar
daniel_dunbar at apple.com
Thu May 5 04:17:17 CDT 2016
What you will need to do to make this work is to get the "fake toolchain" to look like how an actual toolchain looks on disk (e.g., libFoundation in the same relative position, in `<something>/../lib/swift/linux`), presumably using a symlink. The special rpath is what is causing the built swift-build (in this case the stage1 swift-build) to look in that directory for its libraries. If libFoundation.so is there, then that should suffice for it to be found and loaded.
- Daniel
> On May 5, 2016, at 2:04 AM, Bouke Haarsma via swift-dev <swift-dev at swift.org> wrote:
>
> 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 <https://github.com/apple/swift-package-manager/pulls/Bouke>
> [2]: https://github.com/apple/swift-package-manager/pull/292#issuecomment-216508823 <https://github.com/apple/swift-package-manager/pull/292#issuecomment-216508823>
> [3]: https://github.com/apple/swift/compare/master...Bouke:swiftpm-foundation <https://github.com/apple/swift/compare/master...Bouke:swiftpm-foundation>
> [4]: https://github.com/apple/swift-package-manager/compare/ef491db...Bouke:swiftpm-foundation <https://github.com/apple/swift-package-manager/compare/ef491db...Bouke:swiftpm-foundation>_______________________________________________
> swift-dev mailing list
> swift-dev at swift.org <mailto:swift-dev at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-dev <https://lists.swift.org/mailman/listinfo/swift-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160505/13310558/attachment.html>
More information about the swift-dev
mailing list