[swift-build-dev] Build Linux app on Mac Os X (Daniel Dunbar), Jason Kristian

Jason Kristian jasonk at apps4u.com.au
Tue Aug 16 06:56:24 CDT 2016

On 2016-08-16 21:54, Jason Kristian wrote:
> I agree there are tool's out there now to run linux and maybe adding
> to package manager is not the way to go I was just giving example on
> one method to configure. The main Idea is to be able to test and build
> on os x. Now using a vm that is not run on top or docker or vmware ,
> virtual box etc gives a more seamless usage experience.
> The way I see it working is via a XCP process that can startup a vm
> using HyperVisor framework and when running the current folder can be
> mounted to the VM. this would let you build / run / test .
> Now going a bit off topic Xcode developer could build on top of this
> to integrate  with Xcode (i know that not a swift-build-dev product or
> concern).
> Im happy to start a proof of concept that this could work only if the
> community would be interested in a feature like this.
> What I'm trying to overcome is the time taken daily where I'm creating
> docker images starting all the time and not able to run test with out
> setting up a vm.
> I might be given a project to look at only to see they have different
> Docker image so Im then having to download that image to run the
> project.
> Option 2 - is a quicker option like you said but that is not the issue
> I was trying to overcome , not just cross compiling but to be able
> have a project that I can just build and run while at the same time I
> have a IOS target that is running and calling code in the Linux target
> while being able test.
> Now maybe I'm under estimating the work that is required to archive
> this but what I see this working like will be much loved feature.
> So please comment. The more opinion's the better.
> On 2016-08-16 03:00, swift-build-dev-request at swift.org wrote:
>> Send swift-build-dev mailing list submissions to
>> 	swift-build-dev at swift.org
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	https://lists.swift.org/mailman/listinfo/swift-build-dev
>> or, via email, send a message with subject or body 'help' to
>> 	swift-build-dev-request at swift.org
>> You can reach the person managing the list at
>> 	swift-build-dev-owner at swift.org
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of swift-build-dev digest..."
>> Today's Topics:
>>    1. Re: Build Linux app on Mac Os X (Daniel Dunbar)
>> ----------------------------------------------------------------------
>> Message: 1
>> Date: Sun, 14 Aug 2016 20:09:26 -0700
>> From: Daniel Dunbar <daniel_dunbar at apple.com>
>> To: jasonk at apps4u.com.au
>> Cc: "swift-build-dev at swift.org" <swift-build-dev at swift.org>
>> Subject: Re: [swift-build-dev] Build Linux app on Mac Os X
>> Message-ID: <06EF389C-408D-4CD4-85E8-1D78DA5ECA04 at apple.com>
>> Content-Type: text/plain; charset="utf-8"
>> I think this proposal is a little more complicated than necessary.
>> Using Hypervisor directly doesn't really seem in the realm of the
>> package manager to do, especially when there are nicely packaged tools
>> like Docker for Mac which basically handle all of that.
>> I can imagine an interesting feature where the package manager had the
>> ability to compile for Linux in one of two ways:
>> 1. The approach described, using some kind of virtualization to be
>> able to actually execute the build on Linux. This would have the
>> advantage that the tests and executables could also be run. However,
>> this would also be rather complicated and I'm not sure it is
>> ultimately the right place to solve this problem.
>> 2. We could support cross-compiling to Linux. This would fit clearly
>> in our feature set, and would also be a lot easier to make robust and
>> with a good user experience. However, this wouldn't help with the
>> ability to run tests...
>> In either case, I don't know of anyone actively trying to tackle
>> features in these areas...
>>  - Daniel
>>> On Aug 13, 2016, at 5:46 PM, apps4u via swift-build-dev 
>>> <swift-build-dev at swift.org> wrote:
>>> HI I submited a proposal to the Swift Mailing list when it a build 
>>> feature. So Ive inclued the original message but Im going to rewrite 
>>> so I could be a bit more clear.
>>> I have a propoal of using the new Hypervisor.framework to enable 
>>> Swift Linux build's on Os X. So at the monment there is a need to use 
>>> 3rd party tools (VM, Docker) to run a linux kernel on Os x to build 
>>> Swift Liunx server app's. Now I was thinking that with the release of 
>>> Hypervisor.framework that this could now be achive in a clean and 
>>> transparent way.
>>> So the main idea is to have the abilty to create a linux target but 
>>> when building and running instead of running on the Mac kernel a 
>>> small liunx kernel can be started as a headless background process 
>>> and the app would build and run within that vm.  So the folder to the 
>>> project could be mounted with in the Linux vm. Hypervisor.framework 
>>> is perfect for this sort of enbeding. It could be inbeded as a XPC 
>>> proecess so that  Linux VM would be used for all project's.
>>>  The target should be able to be configured by user to pick if it 
>>> runs on OS X or Linux.
>>> This could Also be tied into the Package Manager where there could be 
>>> a option to set the packages target runtime.
>>> Also to start with I don't think this would need to be under full 
>>> user control, What I mean by that I would not let the user pick the 
>>> Linux OS or packages that are installed etc. I think the Linux os 
>>> should include a common set of software eg: CURL, OpenSSL , etc. just 
>>> the common set of software.
>>> or if people think otherwise that it could have full user control of 
>>> Linux OS and installed Software.
>>> But My thought is to keep it simple and small so its as fast as 
>>> possiable and at the end of the Day user should always Test on the 
>>> Production OS which can be done using the current method's of running 
>>> Linux on a VM or Cloud provider or Container.
>>> I think that this would make the developer experance even better and 
>>> add a valuable feature to Swift Package Manager.
>>> Now Where I made the mistake in the other post to bring up XCode how 
>>> this could then enable Builld/Run/Debug of a Linux target. I only 
>>> brought that up to explain the current process which requires docker 
>>> or some vm software to be setup and some build scripts to get it to 
>>> work which is a bit of effort for each project.
>>> -------------------------------------------------------------------------------------------------------
>>> -------------------------------------------------------------------------------------------------------
>>> -------------------------------------------------------------------------------------------------------
>>> -------------------------------------------------------------------------------------------------------
>>> Sorry I just noticed the Swift Build mailing list . would that be a 
>>> better place . Now Xcode would not need to be inclued as that's a 
>>> apple product so Im was just using a example on how it could be use 
>>> the Main feature request is to have Swift build use 
>>> Hypervisor.Framework to work with Swift build to be able to build a 
>>> Linux project on Os X with out having to create your own VM or 
>>> container to run a linux kernel.
>>> So Im going to send this to the Swift Build Mailing list.
>>> August 14 2016 10:17 AM, "Félix Cloutier" <felixcca at yahoo.ca 
>>> <mailto:%22F%C3%A9lix%20Cloutier%22%20<felixcca at yahoo.ca>>> wrote:
>>> The swift-evolution mailing list is about the language itself, Xcode 
>>> is independent. I don't know where you could try to push that 
>>> suggestion.
>>> Félix
>>>> Le 13 août 2016 à 16:40:42, apps4u via swift-evolution 
>>>> <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> a 
>>>> écrit :
>>>> I have a Proposal but I'm not sure if Its the right place to propose 
>>>> but as it has to do with building Swift So I'm going to submit here. 
>>>> So Please let me know if that is not the place to propose this 
>>>> feature. As it includes Xcode.
>>>> Ok So this is a proposal for being able to build swift for linux on 
>>>> Mac Os X in Xcode just like a native target.
>>>> With the release of Hypervisor.framework It would be good if from 
>>>> within Xcode I can create a project with a Linux Target and when 
>>>> clicking Build and run it create a VM running a small linux Kernel 
>>>> using Hypervisor.framework.
>>>> By using Hypervisor.framework it would be better integrated into the 
>>>> tools as it has a small foot print. The idea would be to have the VM 
>>>> downloaded before a build. The linux VM should be small and only 
>>>> have the required software to test a server and using the 
>>>> hypervisor.framework the project build folder can be attached to the 
>>>> vm at build time so the working with different projects at the same 
>>>> time would not require lots of VM.
>>>> Now I know that this would be best if integrated into Xcode and this 
>>>> is the Swift Language mailing list but Swift build is part of the 
>>>> Language.
>>>> This could also be used to debugging. Now Its possible now to use 
>>>> Docker to run a linux vm and have a shared folder for your project 
>>>> and some scripts to kick off the build. But it take time to setup 
>>>> per project and is not the Experience i would expect in Xcode.
>>>> Now My first thought when I found out about Hypervisor.framework 
>>>> that the reason it was created was to add linux targets to Xcode.
>>>> _______________________________________________
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution 
>>>> <https://lists.swift.org/mailman/listinfo/swift-evolution>_______________________________________________
>>> swift-build-dev mailing list
>>> swift-build-dev at swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-build-dev
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160814/aaadc163/attachment-0001.html>
>> ------------------------------
>> _______________________________________________
>> swift-build-dev mailing list
>> swift-build-dev at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-build-dev
>> End of swift-build-dev Digest, Vol 9, Issue 5
>> *********************************************

Jason Kristian | Director | APPS 4 U PTY LTD.
ph: +61 075699 8109
mob: +61 0411 389 392
e: Jason Kristian

More information about the swift-build-dev mailing list