Can't build swiftpm (SPM) Project after installing new swift-2.2-SNAPSHOT-2015-12-10-a


(Kostiantyn Koval) #1

Hi,

I've just installed new Swift Toolchain. After installation I'v tried to build swiftpm project from Xcode and it failed.
Here is the build log.

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Any idea what could go wring and how to fix that?
I'm still able to compile the project using "./Utilities/bootstrap"

Best Regards,
Kostiantyn


(Daniel Dunbar) #2

+Greg, any idea what is going on here?

Can we get a bug for this please, to track?

- Daniel

···

On Dec 12, 2015, at 7:29 AM, Kostiantyn Koval via swift-build-dev <swift-build-dev@swift.org> wrote:

Hi,

I've just installed new Swift Toolchain. After installation I'v tried to build swiftpm project from Xcode and it failed.
Here is the build log.

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Any idea what could go wring and how to fix that?
I'm still able to compile the project using "./Utilities/bootstrap"

Best Regards,
Kostiantyn

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev


(Kostiantyn Koval) #3

Done.
https://bugs.swift.org/browse/SR-205

Kostiantyn

···

On 12 Dec 2015, at 18:03, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

+Greg, any idea what is going on here?

Can we get a bug for this please, to track?

- Daniel

On Dec 12, 2015, at 7:29 AM, Kostiantyn Koval via swift-build-dev <swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>> wrote:

Hi,

I've just installed new Swift Toolchain. After installation I'v tried to build swiftpm project from Xcode and it failed.
Here is the build log.

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Any idea what could go wring and how to fix that?
I'm still able to compile the project using "./Utilities/bootstrap"

Best Regards,
Kostiantyn

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-build-dev


(Greg Parker) #4

The source for the script that it's running is swift/utils/swift-stdlib-tool-substitute. That script finds the real swift-stdlib-tool from a built-in toolchain and runs it. Looks like the shell doesn't like the script's syntax.

Kostiantyn, what is the output of these two terminal commands?

which bash
bash --version

···

On Dec 12, 2015, at 9:54 AM, Kostiantyn Koval <konstantin.koval1@gmail.com> wrote:

Done.
https://bugs.swift.org/browse/SR-205

Kostiantyn

On 12 Dec 2015, at 18:03, Daniel Dunbar <daniel_dunbar@apple.com> wrote:

+Greg, any idea what is going on here?

Can we get a bug for this please, to track?

- Daniel

On Dec 12, 2015, at 7:29 AM, Kostiantyn Koval via swift-build-dev <swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>> wrote:

Hi,

I've just installed new Swift Toolchain. After installation I'v tried to build swiftpm project from Xcode and it failed.
Here is the build log.

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Any idea what could go wring and how to fix that?
I'm still able to compile the project using "./Utilities/bootstrap"

Best Regards,
Kostiantyn

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-build-dev


(Kostiantyn Koval) #5

Thanks for answer. it helped a lot.

There was one more issue at line 70. Fixed in the same way.
- if [[ ! -dx "$source_libraries" ]]; then
+ if [ ! -d "$source_libraries" -o ! -x "$source_libraries" ]]; then

Here is some other things I've tried :

When I run "./utils/swift-stdlib-tool-substitute" I get
./utils/swift-stdlib-tool-substitute: error: couldn't find swift-stdlib-tool at /Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool

If I edit swift-stdlib-tool and fix the code there than when launching Xcode it don't pass signature verification and not laughed.
edit "/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool"
run "xcrun launch-with-toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain"

It works when:
I launch Xcode first, and then I edit swift-sodlib-tool.
In that case swiftpm Xcode project is building fine. But I need to keep Xcode open or restore and edit swift-sodlib-tool every time.
Is there anyway I can build and sign swift-sodlib-tool?

Best Regards,
Kostiantyn

···

On 13 Dec 2015, at 12:08, Greg Parker <gparker@apple.com> wrote:

Thanks. That is much newer than the bash that ships with OS X. Presumably there was a syntax change in the meantime.

Please try this change in your toolchain's swift-stdlib-tool:

-if [[ ! -fx "$tool" ]]; then
+if [ ! -f "$tool" -o ! -x "$tool" ]; then

I expect that to get farther but then fail again later in the script.

On Dec 13, 2015, at 2:51 AM, Kostiantyn Koval <konstantin.koval1@gmail.com <mailto:konstantin.koval1@gmail.com>> wrote:

I haven't updated the swift repo. Will try to do it now.

Yes, when I run `swift-stdlib-tool-substitute` it shows that error
Here is the bash info:

bash --version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin14.5.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

which bash
/usr/local/bin/bash

I also use http://ohmyz.sh <http://ohmyz.sh/> if that has any impact

zsh --version
zsh 5.0.8 (x86_64-apple-darwin15.0)

Kostiantyn

On 12 Dec 2015, at 22:04, Greg Parker <gparker@apple.com <mailto:gparker@apple.com>> wrote:

The source for the script that it's running is swift/utils/swift-stdlib-tool-substitute. That script finds the real swift-stdlib-tool from a built-in toolchain and runs it. Looks like the shell doesn't like the script's syntax.

Kostiantyn, what is the output of these two terminal commands?

which bash
bash --version

On Dec 12, 2015, at 9:54 AM, Kostiantyn Koval <konstantin.koval1@gmail.com <mailto:konstantin.koval1@gmail.com>> wrote:

Done.
https://bugs.swift.org/browse/SR-205

Kostiantyn

On 12 Dec 2015, at 18:03, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:

+Greg, any idea what is going on here?

Can we get a bug for this please, to track?

- Daniel

On Dec 12, 2015, at 7:29 AM, Kostiantyn Koval via swift-build-dev <swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>> wrote:

Hi,

I've just installed new Swift Toolchain. After installation I'v tried to build swiftpm project from Xcode and it failed.
Here is the build log.

CopySwiftLibs DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest
    cd /Users/konstantin/Work/apple/swiftpm/Support
    export CODESIGN_ALLOCATE=/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --sign - --scan-executable /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/MacOS/PackageDescription-tests --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --scan-folder /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/PlugIns --platform macosx --destination /Users/konstantin/Work/apple/swiftpm/Support/DerivedData/swiftpm/Build/Products/Debug/PackageDescription-tests.xctest/Contents/Frameworks --strip-bitcode

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: conditional binary operator expected
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: syntax error near `"$tool"'
/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool: line 23: `if [[ ! -fx "$tool" ]]; then'
Command /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 2

Any idea what could go wring and how to fix that?
I'm still able to compile the project using "./Utilities/bootstrap"

Best Regards,
Kostiantyn

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org <mailto:swift-build-dev@swift.org>
https://lists.swift.org/mailman/listinfo/swift-build-dev