Building Static Binaries and Libs


(Joel Hughes) #1

Hello,

I hope that this is the right channel for this type of question?

I've previously asked in swift-users about building a static binary, on
Linux, using:

swift build -Xswiftc -static-stdlib

It works for simple programs but fails on those importing Foundation.

I was pointed at this bug/feature-request and was thinking of taking it on
but might not have the time/skills to complete it:
https://bugs.swift.org/browse/SR-648

I've pulled and built swift from master on the main repo and am going
through the steps to compile static lib (.a) files from the relevant
_corelibs_ and then adding them to my tool-chain.

Once I can do this I'll try and add them to the build process.

I'm getting there wit libFoundation but have been having more difficulty
with libDispatch.

Are there any docs or example projects I could look at for this?

Thanks

Joel


(Daniel Dunbar) #2

Hello,

I hope that this is the right channel for this type of question?

I've previously asked in swift-users about building a static binary, on Linux, using:

swift build -Xswiftc -static-stdlib

It works for simple programs but fails on those importing Foundation.

I was pointed at this bug/feature-request and was thinking of taking it on but might not have the time/skills to complete it: https://bugs.swift.org/browse/SR-648

I've pulled and built swift from master on the main repo and am going through the steps to compile static lib (.a) files from the relevant _corelibs_ and then adding them to my tool-chain.

Once I can do this I'll try and add them to the build process.

I'm getting there wit libFoundation but have been having more difficulty with libDispatch.

Are there any docs or example projects I could look at for this?

I'm not sure that we have any better docs than the source, unfortunately.

If you have specific questions you can always try asking those in the bug or on the appropriate mailing lists.

- Daniel

ยทยทยท

On Sep 5, 2016, at 4:13 AM, Joel Hughes via swift-dev <swift-dev@swift.org> wrote:

Thanks

Joel
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev