Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swiftenv install 3.0 fails with "version `3.0' is not installed" on TravisCi's xcode7.2 image #68

Closed
dgholz opened this issue Oct 11, 2016 · 9 comments

Comments

@dgholz
Copy link

dgholz commented Oct 11, 2016

I've set up a Travis CI build to install swift 3.0 on their xcode7.2 image. When I configure it to install 3.0, I see:

$ swiftenv install --verbose 3.0
Checking for a URL for the 3.0 on osx.
Installing 3.0 from https://swift.org/builds/swift-3.0-release/xcode/swift-3.0-RELEASE/swift-3.0-RELEASE-osx.pkg on osx.
Downloading https://swift.org/builds/swift-3.0-release/xcode/swift-3.0-RELEASE/swift-3.0-RELEASE-osx.pkg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  254M  100  254M    0     0  11.1M      0  0:00:22  0:00:22 --:--:-- 12.5M
installer: Package name is Swift Open Source Xcode Toolchain
installer: Installing at base path /
installer: The install was successful.
3.0 has been installed.
swiftenv: version `3.0' is not installed

I think this is because https://github.com/kylef/swiftenv/blob/master/share/swiftenv-install/3.0#L11 will use https://swift.org/builds/swift-3.0-release/xcode/swift-3.0-RELEASE/swift-3.0-RELEASE-osx.pkg to install version 3.0. That package installs to /Library/Developer/Toolchains/swift-3.0-RELEASE.xctoolchain, but https://github.com/kylef/swiftenv/blob/master/libexec/swiftenv-prefix#L29 instead checks for /Library/Developer/Toolchains/swift-3.0.xctoolchain (without the -RELEASE).

I can't replicated it locally, as I've installed Xcode 8 & swiftenv-prefix finds /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift, and its version is

Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
Target: x86_64-apple-macosx10.9

which is recognised by https://github.com/kylef/swiftenv/blob/master/libexec/swiftenv-prefix#L47

@dgholz
Copy link
Author

dgholz commented Oct 11, 2016

Here's my Travis CI osx job with xtrace enabled, if you want to see what swiftenv did.

@dgholz dgholz changed the title swiftenv install 3.0 fails with "version `3.0' is not installed" swiftenv install 3.0 fails with "version `3.0' is not installed" on TravisCi's xcode7.2 image Oct 11, 2016
@sauliusgrigaitis
Copy link

I get same error on my Ubuntu 16.04:

$ swiftenv install 3.0
3.0 has been installed.
swiftenv: version `3.0' is not installed

@kylef kylef closed this as completed in 331843b Oct 11, 2016
@kylef
Copy link
Owner

kylef commented Oct 11, 2016

@dgholz I've made some changes to check for -RELEASE versions in master to solve this problem. Please give it a try again.

I would note that Xcode 8 is a dependency of Swift 3.0. I don't think you will be able to run Swift 3.0 on macOS without Xcode 8. You can see this mentioned on Swift.org https://swift.org/download/#releases

screen shot 2016-10-11 at 12 52 38


@sauliusgrigaitis your issue doesn't seem to be the same one as this thread. Can you please file another issue including the version of swiftenv you are using and we can debug this problem you are facing.

@kylef
Copy link
Owner

kylef commented Oct 11, 2016

@sauliusgrigaitis I think 041ac8a will solve your problem, can you try updating swiftenv from git and test.

@dgholz
Copy link
Author

dgholz commented Oct 12, 2016

@kylef thanks, I now see 3.0 installing & my build proceeds, and that my test fail to run due to Swift 3.0 requiring Xcode8… exactly as you thought.

I switched the osx_image to xcode8, and I see that swiftenv install 3.0 short-circuits, but returns non-zero:

2.15s$ swiftenv install --verbose 3.0

3.0 is already installed.

The command "swiftenv install --verbose 3.0" failed and exited with 1 during .

My expectation is that it should return zero, since 3.0 was installed. Shall I make a separate issue?

@kylef
Copy link
Owner

kylef commented Oct 12, 2016

@dgholz Since you've explicitly tried to install swift it would provide an error if it's already installed. I've added an argument (-s or --skip-existing) which can be used to exit 0 instead (useful for things like CI).

$ swiftenv install --skip-existing 3.0
$ swiftenv install -s 3.0

If you're using the Travis CI integration, the latest version of it will use -s so it won't fail when the Swift version is already installed.

https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh

Does that work for you?

@wongzigii
Copy link

wongzigii commented Oct 12, 2016

@kylef I just try your script in my fork. https://github.com/wongzigii/Quick/pull/5 But seems the CI is still in error.

@kylef
Copy link
Owner

kylef commented Oct 12, 2016

@wongzigii Please see the Travis CI integration guide: https://swiftenv.fuller.li/en/latest/integrations/travis-ci.html. The way you have configured swiftenv is with a different/unsupported way by piping it into bash. You will also need to switch to the Travis CI trusty image as mentioned in the guide.

@dgholz
Copy link
Author

dgholz commented Oct 13, 2016

@kylef works like a charm, thanks for all your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants