Minimal clang to support swift?


(William Dillon) #1

HI all,

I'm working on a resource-constrained embedded system, and I'd like to reduce the size of my swift install as much as possible. In deployment, I'll need to figure out what a non-compiling swift support install looks like, but that's not the question for today. Currently, I'd like to have a functioning swift compiler on our hardware for rapid iteration, testing and debug.

So, my question is about the support that the swift compiler requires. Based upon the instructions at swift.org, I know that I need at least Clang. So, I followed the instructions at llvm.org and built it. It seems to work, but it's 'uuge; around 700 MB with MinSizeRel and -Os. Add Swift to it, and we're at about 1.1GB. As a point of reference, I noticed that the Clang binary I built is 45Mb relative to the 13Mb clang in Debian.

How much of llvm and clang do I really need to support Swift?

Is there any way built into llvm/clang's build system to strip the binaries, or otherwise make them smaller?

Thanks!
- Will


(Karl) #2

The swift compiler delegates to clang for linking executables on non-Darwin platforms.
I believe that’s the only reason we need it - other things from libclang, such as stuff for the importer, seem to get statically-linked.

- Karl

···

On 3 Nov 2016, at 18:48, William Dillon via swift-dev <swift-dev@swift.org> wrote:

HI all,

I'm working on a resource-constrained embedded system, and I'd like to reduce the size of my swift install as much as possible. In deployment, I'll need to figure out what a non-compiling swift support install looks like, but that's not the question for today. Currently, I'd like to have a functioning swift compiler on our hardware for rapid iteration, testing and debug.

So, my question is about the support that the swift compiler requires. Based upon the instructions at swift.org <http://swift.org/>, I know that I need at least Clang. So, I followed the instructions at llvm.org <http://llvm.org/> and built it. It seems to work, but it's 'uuge; around 700 MB with MinSizeRel and -Os. Add Swift to it, and we're at about 1.1GB. As a point of reference, I noticed that the Clang binary I built is 45Mb relative to the 13Mb clang in Debian.

How much of llvm and clang do I really need to support Swift?

Is there any way built into llvm/clang's build system to strip the binaries, or otherwise make them smaller?

Thanks!
- Will

_______________________________________________
swift-dev mailing list
swift-dev@swift.org <mailto:swift-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-dev