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

Quick is failing to compile with server side Swift (Vapor app) using Xcode #751

Closed
1 task done
alexvbush opened this issue Oct 7, 2017 · 3 comments
Closed
1 task done

Comments

@alexvbush
Copy link

alexvbush commented Oct 7, 2017

  • I have read CONTRIBUTING and have done my best to follow them.

What did you do?

I installed Quick & Nimble in my server side Swift Vapor project using the following Swift package manager file:

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "tw-music-app-api-vapor",
    products: [
        .library(name: "App", targets: ["App"]),
        .executable(name: "Run", targets: ["Run"])
    ],
    dependencies: [
        .package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "2.1.0")),
        .package(url: "https://github.com/vapor/fluent-provider.git", .upToNextMajor(from: "1.2.0")),
        .package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "1.2.0")),
        .package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "7.0.2")),
    ],
    targets: [
        .target(name: "App", dependencies: ["Vapor", "FluentProvider"],
                exclude: [
                    "Config",
                    "Database",
                    "Localization",
                    "Public",
                    "Resources",
                    ]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App", "Testing", "Quick", "Nimble"])
    ]
)

Then I created the following failing spec:

import Testing
import Quick
import Nimble

class TagsControllerSpec: QuickSpec {
    override func spec() {
        describe("something") {
            it("does somehting") {
                expect(true).toNot(beTrue())
            }
        }
    }
}

What did you expect to happen?

Upon building the app in Xcode I expected it to compile, launch the tests, and successfully fail the test.

What actually happened instead?

The app failed building with the following message:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_XCTestCase", referenced from:
      _OBJC_CLASS_$__QuickSpecBase in QuickSpecBase.o
  "_OBJC_METACLASS_$_XCTestCase", referenced from:
      _OBJC_METACLASS_$__QuickSpecBase in QuickSpecBase.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

screen shot 2017-10-06 at 5 03 02 pm

Environment

List the software versions you're using:

  • Quick: 1.2.0
  • Nimble: 7.0.2
  • Xcode Version: Version 9.0 (9A235)
  • Swift Version: Xcode Default

Please also mention which package manager you used and its version. Delete the
other package managers in this list:

  • Swift Package Manager Apple Swift Package Manager - Swift 4.0.0-dev (swiftpm-13126)

Project that demonstrates the issue

https://github.com/alexvbush/tw-music-app-api-vapor

Note:

running swift test successfully compiles and runs the tests, something is wrong with xcode setup.

@ikesyo
Copy link
Member

ikesyo commented Oct 10, 2017

Looks like that is related to swiftlang/swift-package-manager#955. Without CLANG_ENABLE_MODULES=YES we can't link to XCTest framework. So this would not be our fault unfortunately.

It would be great if you could file an issue on https://bugs.swift.org.

@ikesyo
Copy link
Member

ikesyo commented Oct 19, 2017

Closing this due to inactivity.

@sunshinejr
Copy link
Contributor

If someone is still experiencing the problem and want to use Quick/Nimble in a SPM-project, I have a tool called spm_utils that fixes that. Just install it and then run:

spm_utils quick

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

3 participants