[swift-corelibs-dev] [XCTest] Cannot build using XCode

Madhu Samuel madhusamuel at gmail.com
Fri Jul 1 17:29:39 CDT 2016


Hi Brian,

Thanks for you response.

Still I cannot compile corelibs-xctest with xcode-beta. It seems the error
is too generic to debug! If xctest is not yet configured against xcode 8
beta, probably, I will wait. At this point, I am lazy to create my own
toolchain, since my last attempt went bust!


The steps I followed

1. delete swift/build
2. utils/update-checkout
3. sudo  xcode-select -s
/Applications/Xcode-beta.app/Contents/Developer
4. utils/build-script -r -t   (success)
5. utils/build-script -R.    (success)
6.
$ cd swift-corelibs-xctest
$ ../swift/utils/build-script --preset corelibs-xctest


Environment

*Swift Version: Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24)*
Xcode Environment: Version 8.0 beta (8S128d)
Python Version: Python 2.7.10



The Error

CompileSwift normal x86_64
/Users/madhusamuel/dev/swift/swift-corelibs-xctest/Sources/XCTest/Public/XCTestExpectation.swift

.....
....


<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: compile command failed due to signal (use -v to see
invocation)
** BUILD FAILED **


The following build commands failed:
CompileSwift normal x86_64
/Users/madhusamuel/dev/swift/swift-corelibs-xctest/Sources/XCTest/Public/XCTestMain.swift
CompileSwift normal x86_64
/Users/madhusamuel/dev/swift/swift-corelibs-xctest/Sources/XCTest/Private/TestListing.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)
Traceback (most recent call last):
  File
"/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
445, in <module>
    main()
  File
"/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
441, in main
    parsed_args.func(parsed_args)
  File
"/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
64, in build
    source_dir=SOURCE_DIR))
  File
"/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
30, in run
    subprocess.check_call(command, shell=True)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'xcodebuild -workspace
/Users/madhusamuel/dev/swift/swift-corelibs-xctest/XCTest.xcworkspace
-scheme SwiftXCTest
SWIFT_EXEC="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc"
SWIFT_LINK_OBJC_RUNTIME=YES
SYMROOT="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/xctest-macosx-x86_64"
OBJROOT="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/xctest-macosx-x86_64"'
returned non-zero exit status 65
../swift/utils/build-script: fatal error: command terminated with a
non-zero exit status 1, aborting
../swift/utils/build-script: fatal error: command terminated with a
non-zero exit status 1, aborting


Regards,
Madhu

On Thu, Jun 30, 2016 at 11:38 PM, Brian Gesiak <modocache at gmail.com> wrote:

> Madhu,
>
> Sorry for the late reply to this -- I obviously need to update my email
> settings! :(
>
> Could you pull down the latest changes to Swift, and let me know if you're
> still experiencing difficulties compiling corelibs-xctest?
>
> - Brian Gesiak
>
>
> On Tue, Jun 21, 2016 at 12:03 AM, Madhu Samuel <madhusamuel at gmail.com>
> wrote:
>
>> Wow, the swift build is a success. Though there are a few warnings at the
>> end. I guess the issue was with cached values in the build directory.
>>
>> But, in the next step to build xctest using "/utils/build-script --preset
>> corelibs-xctest", the build fails. The build error log is given below.
>>
>> ------------------------
>>
>> CompileSwift normal x86_64
>> /Users/madhusamuel/dev/swift/swift-corelibs-xctest/Sources/XCTest/Public/XCTestExpectation.swift
>> ....
>> ....
>>
>> <unknown>:0: error: unable to execute command: Illegal instruction: 4
>> <unknown>:0: error: compile command failed due to signal (use -v to see
>> invocation)
>> ** BUILD FAILED **
>>
>>
>> The following build commands failed:
>> CompileSwift normal x86_64
>> /Users/madhusamuel/dev/swift/swift-corelibs-xctest/Sources/XCTest/Private/TestListing.swift
>> CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
>> (2 failures)
>> Traceback (most recent call last):
>>   File
>> "/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
>> 445, in <module>
>>     main()
>>   File
>> "/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
>> 441, in main
>>     parsed_args.func(parsed_args)
>>   File
>> "/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
>> 64, in build
>>     source_dir=SOURCE_DIR))
>>   File
>> "/Users/madhusamuel/dev/swift/swift-corelibs-xctest/build_script.py", line
>> 30, in run
>>     subprocess.check_call(command, shell=True)
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
>> line 540, in check_call
>>     raise CalledProcessError(retcode, cmd)
>> subprocess.CalledProcessError: Command 'xcodebuild -workspace
>> /Users/madhusamuel/dev/swift/swift-corelibs-xctest/XCTest.xcworkspace
>> -scheme SwiftXCTest
>> SWIFT_EXEC="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swiftc"
>> SWIFT_LINK_OBJC_RUNTIME=YES
>> SYMROOT="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/xctest-macosx-x86_64"
>> OBJROOT="/Users/madhusamuel/dev/swift/build/Ninja-ReleaseAssert/xctest-macosx-x86_64"'
>> returned non-zero exit status 65
>> ../swift/utils/build-script: fatal error: command terminated with a
>> non-zero exit status 1, aborting
>> ../swift/utils/build-script: fatal error: command terminated with a
>> non-zero exit status 1, aborting
>>
>>
>>
>> On Tue, Jun 21, 2016 at 12:35 PM, Madhu Samuel <madhusamuel at gmail.com>
>> wrote:
>>
>>> Hi Brian Croom,
>>>
>>> Thanks for the quick response. I deleted the entire build directory now.
>>> Initiated a new build. Fingers crossed...
>>>
>>> Will update the status as soon as the build finishes.
>>>
>>> On Tue, Jun 21, 2016 at 12:31 PM, Brian Croom <brian.s.croom at gmail.com>
>>> wrote:
>>>
>>>> Hmm, have you tried deleting your `build/swift-macosx-x86_64/`
>>>> directory? I wonder if cached CMake values could cause that issue.
>>>>
>>>> (By the way, I can confirm that getting the build going for the first
>>>> time is the most challenging! I hope we can get things going for you soon.)
>>>>
>>>> 2016-06-20 22:22 GMT-04:00 Madhu Samuel <madhusamuel at gmail.com>:
>>>>
>>>>> So after spending almost a week trying to build swift and core
>>>>> libraries (mainly xctest) during the end of May un-successfully, I made up
>>>>> my mind to give another attempt today.
>>>>>
>>>>> I checkout the latest code from swift repo. Since the xctest
>>>>> documentation says, "Confirm you're able to build the Swift project using
>>>>> utils/build-script -R", that's where I started.
>>>>>
>>>>> Unfortunately, build-script -R gives the below error.
>>>>>
>>>>> <unknown>:0: error: Swift does not support the SDK 'MacOSX10.11.sdk'
>>>>>
>>>>>
>>>>> My active developer directory is
>>>>> '/Applications/Xcode-beta.app/Contents/Developer'.
>>>>> The toolchain is 'Xode 8.0'
>>>>>
>>>>> The build is taken in Mac OSX El Capitan 10.11.4
>>>>>
>>>>> Let me know whether I miss anything? I assume getting the build
>>>>> working for the first time is the hardest, but there I am!
>>>>>
>>>>> Any help is appreciated!
>>>>>
>>>>> Regards,
>>>>> Madhu
>>>>>
>>>>> On Mon, May 30, 2016 at 8:32 AM, Madhu Samuel <madhusamuel at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Wow, that was a quick response. Thanks Brian Gesiak and Brian Croom.
>>>>>>
>>>>>> My first quick attempt using build-toolchain script to build my own
>>>>>> tool chain failed. Anyway I will give it another try and let you know the
>>>>>> status.
>>>>>>
>>>>>> On Mon, May 30, 2016 at 1:52 AM, Brian Croom <brian.s.croom at gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> That's right, breaking changes have been made to Swift since
>>>>>>> the latest toolchain snapshot was released, and Corelibs Foundation has
>>>>>>> been updated accordingly.
>>>>>>>
>>>>>>> Until the next snapshot, an alternative to building your own
>>>>>>> toolchain would be to check out an older commit of Foundation which still
>>>>>>> builds with the compiler in the snapshot toolchain, since XCTest
>>>>>>> doesn't depend on any of the more recent Foundation changes. I've had
>>>>>>> success using this commit:
>>>>>>> https://github.com/apple/swift-corelibs-foundation/commit/04d4f92870652160388f1c69de3fd7bb0656860c
>>>>>>>
>>>>>>>
>>>>>>> --Brian
>>>>>>>
>>>>>>>
>>>>>>> söndag 29 maj 2016 skrev Brian Gesiak via swift-corelibs-dev <
>>>>>>> swift-corelibs-dev at swift.org>:
>>>>>>>
>>>>>>>> Madhu,
>>>>>>>>
>>>>>>>> Oy, my bad -- I only just noticed you put the toolchain version at
>>>>>>>> the bottom of your original email.
>>>>>>>>
>>>>>>>> It's possible the May 9th toolchain is already too old to build
>>>>>>>> XCTest. I'll double-check myself. In the meantime, you may want to try
>>>>>>>> building your own toolchain and using that.
>>>>>>>>
>>>>>>>> - Brian Gesiak
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, May 29, 2016 at 7:23 AM -0700, "Brian Gesiak" <
>>>>>>>> modocache at gmail.com> wrote:
>>>>>>>>
>>>>>>>> Madhu,
>>>>>>>>>
>>>>>>>>> Thanks for the report!
>>>>>>>>>
>>>>>>>>> The main difference between the build scripts (which use
>>>>>>>>> xcodebuild) and using Xcode itself is the version of Swift that is used.
>>>>>>>>> The build scripts build a Swift 3.0 compiler, then use that to build
>>>>>>>>> XCTest. When using Xcode directly, you need to select a recent Swift
>>>>>>>>> toolchain yourself.
>>>>>>>>>
>>>>>>>>> Which Swift toolchain are you using to compile XCTest in Xcode?
>>>>>>>>>
>>>>>>>>> Our tests only make sure apple/swift master works. If the latest
>>>>>>>>> Swift toolchain from http://swift.org doesn't work, you may have
>>>>>>>>> to built your own toolchain. You can do so using the
>>>>>>>>> `utils/build-toolchain` script in the Swift repository.
>>>>>>>>>
>>>>>>>>> Once you figure out your Swift toolchain version, let us know! You
>>>>>>>>> should be able to find out in the preferences pane in Xcode.
>>>>>>>>>
>>>>>>>>> - Brian Gesiak
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, May 29, 2016 at 1:24 AM -0700, "Madhu Samuel via
>>>>>>>>> swift-corelibs-dev" <swift-corelibs-dev at swift.org> wrote:
>>>>>>>>>
>>>>>>>>> Hi All,
>>>>>>>>>>
>>>>>>>>>> I am new to this forum.
>>>>>>>>>>
>>>>>>>>>> I am trying to build the xctest project. I followed the
>>>>>>>>>> instructions at https://github.com/apple/swift-corelibs-xctest
>>>>>>>>>>
>>>>>>>>>> I am able to successfully build via the build scripts. But, if I
>>>>>>>>>> build XCTest using xcode using the SwiftXCTest scheme I am getting a few
>>>>>>>>>> errors.
>>>>>>>>>>
>>>>>>>>>> 1.
>>>>>>>>>> swift-corelibs-foundation/Foundation/NSXMLDTDNode.swift:242:64: error:
>>>>>>>>>> cannot convert value of type 'UnsafeMutablePointer<Void>' (aka
>>>>>>>>>> 'UnsafeMutablePointer<()>') to expected argument type 'OpaquePointer'
>>>>>>>>>>             let unmanaged =
>>>>>>>>>> Unmanaged<NSXMLDTDNode>.fromOpaque(privateData)
>>>>>>>>>>
>>>>>>>>>> 2. swift-corelibs-foundation/Foundation/NSTimer.swift:14:47:
>>>>>>>>>> error: cannot convert value of type 'UnsafeMutablePointer<Void>' (aka
>>>>>>>>>> 'UnsafeMutablePointer<()>') to expected argument type 'OpaquePointer'
>>>>>>>>>>     let t =
>>>>>>>>>> Unmanaged<NSTimer>.fromOpaque(info!).takeUnretainedValue()
>>>>>>>>>>
>>>>>>>>>> etc.
>>>>>>>>>>
>>>>>>>>>> My dev environment,
>>>>>>>>>> OS: Mac OSX El Capitan 10.11.4 (15E65).
>>>>>>>>>> Xcode Version: Version 7.3.1 (7D1014)
>>>>>>>>>> XCode Toolchain: Swift Development Snapshot 2016-05-09 (a)
>>>>>>>>>>
>>>>>>>>>> Any help is appreciated.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Madhu
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160702/77d425e7/attachment.html>


More information about the swift-corelibs-dev mailing list