[swift-dev] Cross-compile for Android armv7 from OSX

Dmitri Gribenko gribozavr at gmail.com
Fri Jan 22 12:03:51 CST 2016


On Fri, Jan 22, 2016 at 9:50 AM, Chris Bieneman <beanz at apple.com> wrote:
>
>> On Jan 22, 2016, at 9:30 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>
>> On Fri, Jan 22, 2016 at 9:26 AM, ChrisBieneman <beanz at apple.com> wrote:
>>> Can I provide an alternate suggestion?
>>>
>>> Clang can be cross-compiled for alternate platforms with seemingly a single CMake invocation. This is accomplished by having a model where the user configures the cross-build, and LLVM's CMake detects that you are cross compiling and it handles configuring the host tools and hooking the dependencies up.
>>>
>>> This does lead to some pretty gnarly CMake scripting, but I think it provides a very good user experience.
>>>
>>> As an example instructions for cross-compiling LLVM are here: http://llvm.org/docs/GettingStarted.html#cross-compiling-llvm
>>>
>>> That simple configuration command handles everything, all a user has to do is run ninja once.
>>
>> Does that ninja command invoke multiple sub-ninja commands?
>
> Yes. The top-level ninja will put them in the console job pool which results in their output being directly piped to the parent, and only one will execute at a time which allows them to not conflict with each other.

Well, that's bad, here's why.

Building the Swift standard library has two phases: a very parallel
one, and a strictly serial one.  If you run all ninja invocations
serially, you will be increasing the compilation time by about 8x for
a full build for Apple operating systems (approx. 1 hour in total,
unacceptable).  If you run them all in parallel, you will
oversubscribe the machine during the parallel phase, and it will start
swapping.

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 at gmail.com>*/


More information about the swift-dev mailing list