Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Undefined symbols for architecture x86_64 when using ios_unit_test #170

Open
mattdornfeld opened this issue Sep 9, 2022 · 2 comments
Open

Comments

@mattdornfeld
Copy link

I'm running XCode 13.3, Bazel 5.1.1, and rules_apple 1.0.0

I'm running into an issue where I'm building a swift_library that has an spm_pkg as a dep. I'm then specifying that swift library as a dep for an ios_unit_test. When I try to build that target I get this error. Seems like it's not finding the Foundation module?

bazelbuild/rules_apple#1656

@cgrindel
Copy link
Owner

cgrindel commented Sep 9, 2022

I am curious to know how your example differs from the ios_sim example. Can you post your BUILD file?

@mattdornfeld
Copy link
Author

Seems to be pretty similar

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_test")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

swift_library(
    name = "build_source",
    srcs = glob([
        "Project/**/*.swift",
    ]),
    deps = [
        "@swift_pkgs//SQLite.swift:SQLite",
        "@swift_pkgs//swift-composable-architecture:ComposableArchitecture",
        "@swift_pkgs//Bow:Bow",
        "@swift_pkgs//Bow:BowEffects",
        "@swift_pkgs//Cache:Cache",
        "//protos:grpc_swift",
        "//protos:grpc_stubs_swift"
    ],
    module_name = "ProjectApp"
)

swift_library(
    name = "build_tests",
    srcs = glob([
        "TestProject/**/*.swift",
    ]),
    deps = [
        ":build_source",
        "@swift_pkgs//Fakery:Fakery",
    ],
    module_name = "ProjectTests",
)

ios_unit_test(
    name = "test_unit",
    data = glob([
        "TestProject/**/*.swift",
    ]),
    deps = [
        ":build_tests",
    ],
    minimum_os_version = "15.0",
    visibility = ["//visibility:public"],
)

ios_application(
    name = "build_app",
    bundle_name = "project",
    bundle_id = "co.name.ProjectApp",
    families = [
        "iphone",
        "ipad",
    ],
    minimum_os_version = "15.0",
    infoplists = [":Project/Info.plist"],
    visibility = ["//visibility:public"],
    deps = [":build_source"],
)

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

No branches or pull requests

2 participants