Support for arm-linux cross-compilation

Hi there,

I'm interested in getting Swift cross-compiling to arm(v7)-linux. (For my specific use case, I actually need to be able to cross-compile for arm-linux from a *Darwin* host. A little strange, I know.)

In digging through the build scripts and CMake listfiles, I discovered that cross-compilation is not supported in a way that is sufficiently generic to support my use case; it's all pretty special-cased around Darwin => iOS (or derivative) cross-compilation.

I can't imagine more than, like, three people want to do Darwin => arm-linux cross-compilation, so adding support for that specific combination upstream seems pretty useless—but if the build scripts supported cross-compilation in a fairly generic fashion, I imagine that's something that more people would be happy to see.

Given that it seems like a non-trivial amount of build script/CMake work is needed to support cross-compilation in a generic way, I'm curious if there is even a remote desire to see that land in the tree. If so, I'd be more than happy to spearhead or otherwise assist with that effort.

Cheers,
Cody

1 Like

Hi Cody,

I think making our cross-compilation more general is a very good
direction. That will involve more complexity in the build scripts,
true, but I think that is necessary complexity for a successful
compiler project.

I don't think cross-compiling to arm-linux from OS X would be a rare
thing in Swift community, if it was supported "out of the box".

However, build-script-impl as a shell script has surpassed a
comfortable size a long time ago -- it is over 2K lines now. If
someone would take on porting it to a language that scales better for
larger programs and is easily available on our targets (python?), it
would be really awesome.

Dmitri

···

On Fri, Dec 4, 2015 at 1:04 PM, Cody Krieger <cody@krieger.io> wrote:

Hi there,

I'm interested in getting Swift cross-compiling to arm(v7)-linux. (For my specific use case, I actually need to be able to cross-compile for arm-linux from a *Darwin* host. A little strange, I know.)

In digging through the build scripts and CMake listfiles, I discovered that cross-compilation is not supported in a way that is sufficiently generic to support my use case; it's all pretty special-cased around Darwin => iOS (or derivative) cross-compilation.

I can't imagine more than, like, three people want to do Darwin => arm-linux cross-compilation, so adding support for that specific combination upstream seems pretty useless—but if the build scripts supported cross-compilation in a fairly generic fashion, I imagine that's something that more people would be happy to see.

Given that it seems like a non-trivial amount of build script/CMake work is needed to support cross-compilation in a generic way, I'm curious if there is even a remote desire to see that land in the tree. If so, I'd be more than happy to spearhead or otherwise assist with that effort.

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/

Excellent! I'll start poking at this ASAP—my team and I can't wait to have Swift on our embedded Linux box.

Thanks!
Cody

···

On Dec 4, 2015, at 1:27 PM, Dmitri Gribenko <gribozavr@gmail.com> wrote:

On Fri, Dec 4, 2015 at 1:04 PM, Cody Krieger <cody@krieger.io> wrote:

Hi there,

I'm interested in getting Swift cross-compiling to arm(v7)-linux. (For my specific use case, I actually need to be able to cross-compile for arm-linux from a *Darwin* host. A little strange, I know.)

In digging through the build scripts and CMake listfiles, I discovered that cross-compilation is not supported in a way that is sufficiently generic to support my use case; it's all pretty special-cased around Darwin => iOS (or derivative) cross-compilation.

I can't imagine more than, like, three people want to do Darwin => arm-linux cross-compilation, so adding support for that specific combination upstream seems pretty useless—but if the build scripts supported cross-compilation in a fairly generic fashion, I imagine that's something that more people would be happy to see.

Given that it seems like a non-trivial amount of build script/CMake work is needed to support cross-compilation in a generic way, I'm curious if there is even a remote desire to see that land in the tree. If so, I'd be more than happy to spearhead or otherwise assist with that effort.

Hi Cody,

I think making our cross-compilation more general is a very good
direction. That will involve more complexity in the build scripts,
true, but I think that is necessary complexity for a successful
compiler project.

I don't think cross-compiling to arm-linux from OS X would be a rare
thing in Swift community, if it was supported "out of the box".

However, build-script-impl as a shell script has surpassed a
comfortable size a long time ago -- it is over 2K lines now. If
someone would take on porting it to a language that scales better for
larger programs and is easily available on our targets (python?), it
would be really awesome.

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/