[swift-users] swift redistributable without Xcode
Jordan Rose
jordan_rose at apple.com
Mon May 9 11:33:47 CDT 2016
Hi, Tim. The build directory contains symlinks and such and therefore isn’t really the best vehicle for distribution. There’s a build-toolchain script inside swift/utils/ that should give you a self-contained directory, and more generally there’s a notion of “install components” that can be used to build a self-contained directory tree as an output of build-script.
Hope that helps,
Jordan
> On May 8, 2016, at 09:33, Tim Prepscius via swift-users <swift-users at swift.org> wrote:
>
> Is there any way I can get "import Foundation" working on a machine
> other than the machine I compiled with?
>
> I notice that those "float.h" headers are within the llvm build,
> however when I try to do -I of that directory it fails. (I tried as an
> include as a framework as an include passed to the compiler)..
>
> -tim
>
> On 5/7/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>> Ok, so building is working
>> with the following script:
>>
>> more build-swift-script.sh
>> RELEASE=swift-2.2.1-RELEASE
>>
>> sudo port install cmake ninja
>>
>> mkdir apple-swift
>> cd apple-swift
>>
>> git clone https://github.com/apple/swift.git
>> (cd swift && utils/update-checkout --clone)
>>
>> for D in *; do
>> if [ -d "${D}" ]; then
>> echo "checkout $RELEASE of ${D}"
>> (cd ${D} && git checkout tags/$RELEASE)
>> fi
>> done
>>
>> cd swift
>> utils/build-script -R
>>
>> -----------------------
>>
>> however, running does not work.
>> I move the entire build directory to another computer,
>>
>> I go into:
>> build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin
>>
>> And run:
>> ./swift
>> *** You are running Swift's integrated REPL, ***
>> *** intended for testing purposes only. ***
>> *** The full REPL is built as part of LLDB. ***
>> *** Type ':help' for assistance. ***
>> (swift) import Foundation
>> /usr/include/module.map:36:14: error: header 'float.h' not found
>> header "float.h" // note: supplied by compiler
>> ^
>> /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:10:
>> note: submodule of top-level module 'Darwin' implicitly imported here
>> #include <sys/types.h>
>> ^
>> <module-includes>:1:9: note: in file included from <module-includes>:1:
>> #import "Headers/CoreFoundation.h"
>> ^
>> /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:12:10:
>> error: 'stdarg.h' file not found
>> #include <stdarg.h>
>> ^
>> <unknown>:0: error: could not build Objective-C module 'CoreFoundation'
>>
>> ---------------
>>
>> Any hints?
>>
>> -tim
>>
>> On 5/6/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>>> This might be a bug in your tagging system:
>>>
>>> compiler-rt
>>> llbuild
>>> swift-corelibs-foundation
>>> swift-corelibs-libdispatch
>>> swift-corelibs-xctest
>>> swiftpm
>>>
>>> are missing the tag
>>> error: pathspec 'tags/swift-2.2.1-RELEASE' did not match any file(s)
>>> known to git.
>>>
>>> although they do have tags such as:
>>> swiftpm tprepscius$ git tag -l
>>> 0.1.0
>>> 0.2.0
>>> 0.2.1
>>> 0.2.2
>>> swift-2.2-SNAPSHOT-2015-12-01-a
>>> swift-2.2-SNAPSHOT-2015-12-01-b
>>> swift-2.2-SNAPSHOT-2015-12-10-a
>>> swift-2.2-SNAPSHOT-2015-12-18-a
>>> swift-2.2-SNAPSHOT-2015-12-22-a
>>> swift-2.2-SNAPSHOT-2015-12-31-a
>>> swift-2.2-SNAPSHOT-2016-01-06-a
>>> swift-2.2-SNAPSHOT-2016-01-11-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-01-25-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-02-03-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-02-08
>>> swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-02-25-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-03-16-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-04-12-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a
>>> swift-DEVELOPMENT-SNAPSHOT-2016-05-03-a
>>>
>>> -tim
>>>
>>>
>>> On 5/6/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>>>> So far this seems to be working:
>>>>
>>>> build-swift-script.sh
>>>> RELEASE=swift-2.2.1-RELEASE
>>>>
>>>> mkdir apple-swift
>>>> cd apple-swift
>>>> git clone https://github.com/apple/swift.git
>>>> cd swift
>>>> utils/update-checkout --clone
>>>>
>>>> for D in *; do
>>>> if [ -d "${D}" ]; then
>>>> echo "checkout $RELEASE of ${D}"
>>>> (cd ${D} && git checkout tags/$RELEASE)
>>>> fi
>>>> done
>>>>
>>>> cd ../swift
>>>> utils/build-script -R
>>>>
>>>> ------
>>>>
>>>> will see if it completes a build
>>>>
>>>> -tim
>>>>
>>>> On 5/6/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>>>>> Ok download says it does not work
>>>>>
>>>>> silver:swift tprepscius$ utils/update-checkout --clone
>>>>> --- Cloning 'swift' ---
>>>>> fatal: destination path 'swift' already exists and is not an empty
>>>>> directory.
>>>>> utils/update-checkout: command terminated with a non-zero exit status
>>>>> 128, aborting
>>>>> silver:swift tprepscius$ utils/update-checkout
>>>>> --- Updating '/Users/tprepscius/Documents/Projects/llvm' ---
>>>>> Current branch stable is up to date.
>>>>> --- Updating '/Users/tprepscius/Documents/Projects/clang' ---
>>>>> Current branch stable is up to date.
>>>>> --- Updating '/Users/tprepscius/Documents/Projects/cmark' ---
>>>>> Current branch master is up to date.
>>>>> --- Updating '/Users/tprepscius/Documents/Projects/lldb' ---
>>>>> Current branch master is up to date.
>>>>> --- Updating
>>>>> '/Users/tprepscius/Documents/Projects/swift-integration-tests'
>>>>> ---
>>>>> Current branch master is up to date.
>>>>> --- Updating '/Users/tprepscius/Documents/Projects/swift' ---
>>>>> fatal: Not a git repository (or any of the parent directories): .git
>>>>> utils/update-checkout: command terminated with a non-zero exit status
>>>>> 128, aborting
>>>>>
>>>>> however I think, that it might build anyways. will check.
>>>>>
>>>>>
>>>>> I wonder if there is a command that I should be using instead of
>>>>> utils/update-checkout
>>>>>
>>>>>
>>>>> Btw, I'm not writing this to be annoying. I'm writing it so someone
>>>>> googling in the future can find the path I take to get things
>>>>> building.
>>>>> (I googled a *lot* trying to find Swift without Xcode on OS X)
>>>>>
>>>>> -tim
>>>>>
>>>>> On 5/6/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>>>>>> Hmm actually that doesn't work at all:
>>>>>>
>>>>>> --- Updating '/Users/tprepscius/Documents/Projects/swift' ---
>>>>>> First, rewinding head to replay your work on top of it...
>>>>>> Applying: [Build system] Add presets for Swift inside the LLDB tree.
>>>>>> Using index info to reconstruct a base tree...
>>>>>> M utils/build-presets.ini
>>>>>> Falling back to patching base and 3-way merge...
>>>>>> Auto-merging utils/build-presets.ini
>>>>>> CONFLICT (content): Merge conflict in utils/build-presets.ini
>>>>>> Failed to merge in the changes.
>>>>>> Patch failed at 0001 [Build system] Add presets for Swift inside the
>>>>>> LLDB
>>>>>> tree.
>>>>>>
>>>>>>
>>>>>> I will try using the download instead of the clone of swift
>>>>>>
>>>>>> On 5/6/16, Tim Prepscius <timprepscius at gmail.com> wrote:
>>>>>>> Cool.
>>>>>>>
>>>>>>> Working on this now.
>>>>>>>
>>>>>>> Out of curiosity:
>>>>>>> Let's say I clone and checkout the 2.2.1 release tag
>>>>>>> and then run the update-checkout util
>>>>>>>
>>>>>>> git clone https://github.com/apple/swift.git
>>>>>>> cd swift
>>>>>>> git checkout tags/swift-2.2.1-RELEASE
>>>>>>> ./utils/update-checkout --clone
>>>>>>>
>>>>>>>
>>>>>>> Will this update-checkout command clone the llvm & clang & etc
>>>>>>> and then move to the correct tag for 2.2.1? (if there even is one)
>>>>>>> or will it use HEAD all of the time?
>>>>>>>
>>>>>>> -tim
>>>>>>>
>>>>>>> On 5/6/16, Joe Groff <jgroff at apple.com> wrote:
>>>>>>>>
>>>>>>>>> On May 6, 2016, at 1:14 PM, Tim Prepscius via swift-users
>>>>>>>>> <swift-users at swift.org> wrote:
>>>>>>>>>
>>>>>>>>> Greetings,
>>>>>>>>>
>>>>>>>>> Is it possible to build swift using Xcode, and then distribute
>>>>>>>>> swift
>>>>>>>>> without Xcode?
>>>>>>>>> Or, does there already is exist some link to swift on OS X which is
>>>>>>>>> not contained in Xcode?
>>>>>>>>>
>>>>>>>>> I need a swift compiler/executable that will run on all versions of
>>>>>>>>> MacOSX, not just the latest.
>>>>>>>>
>>>>>>>> A Swift app built with Xcode is self-contained and can be
>>>>>>>> distributed
>>>>>>>> independent of Xcode. You can target back to OS X 10.9.
>>>>>>>>
>>>>>>>> -Joe
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
More information about the swift-users
mailing list