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

Build Failure: 'build //Pods/Zip' #913

Open
Jacky-LinPeng opened this issue Sep 9, 2024 · 2 comments
Open

Build Failure: 'build //Pods/Zip' #913

Jacky-LinPeng opened this issue Sep 9, 2024 · 2 comments

Comments

@Jacky-LinPeng
Copy link

Jacky-LinPeng commented Sep 9, 2024

Hi,

I'm encountering an issue where the build for 'build //Pods/Zip' fails, while all other third-party Pods compile without any problems. It's quite strange that only this library causes an error. I'd appreciate it if you could take a look when you have some time.

Here is the Bazel rule I’m using:

load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "Zip",
    srcs = glob([
        "Zip/*.swift",
        "Zip/*.h",
        "Zip/minizip/*.c",
        "Zip/minizip/include/*.h",
    ]),
    platforms = {"ios": "9.0"},
    public_headers = ["Zip/Zip.h"],
    sdk_dylibs = ["z"],
    swift_version = "5.3",
    visibility = ["//visibility:public"],
    xcconfig = {
        "SWIFT_INCLUDE_PATHS": ["Zip/Zip/minizip/**"],
        "LIBRARY_SEARCH_PATHS": ["Zip/Zip/"],
    },
)

1、Version info

bazel --version 
bazel 7.3.1


http_archive(
    name = "build_bazel_rules_ios",
    sha256 = "d1cc852aa9e989c12b802e04cb66dfe51418153c781d6073bb30e82284866865",
    url = "https://github.com/bazel-ios/rules_ios/releases/download/5.0.0/rules_ios.5.0.0.tar.gz",
)

2、Error Info

ERROR: /Users/mac/Documents/Test/forks/ios_bazel/Pods/Zip/BUILD.bazel:3:16: Compiling Swift module //Pods/Zip:Zip_swift failed: (Exit 1): worker failed: error executing SwiftCompile command (from target //Pods/Zip:Zip_swift)
  (cd /private/var/tmp/_bazel_mac/e3fb201ad4e26871038d858fb256cda1/execroot/_main && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=17.0 \
    PATH=/Users/mac/Library/Caches/bazelisk/downloads/bazelbuild/bazel-7.3.1-darwin-x86_64/bin:/Users/mac/.nvm/versions/node/v22.0.0/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/mac/.rvm/bin \
    SWIFT_AVOID_WARNING_USING_OLD_DRIVER=1 \
    XCODE_VERSION_OVERRIDE=15.0.1.15A507 \
  bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_swift~/tools/worker/worker swiftc @bazel-out/ios_x86_64-fastbuild-ios-x86_64-min9.0-applebin_ios-ST-7d3e9b1ca54f/bin/Pods/Zip/Zip.swiftmodule-0.params)
# Configuration: b36a9fff5ecdbf4626b97e122e7b3bd2e8fce492573b76727e70938cff690ab0
# Execution platform: @@platforms//host:host
error: emit-module command failed with exit code 1 (use -v to see invocation)
Pods/Zip/Zip/Zip.swift:10:29: error: no such module 'Minizip'
@_implementationOnly import Minizip
                            ^
Pods/Zip/Zip/Zip.swift:10:29: error: no such module 'Minizip'
@_implementationOnly import Minizip
                            ^
error: fatalError
Target //Pods/Zip:Zip failed to build
INFO: Elapsed time: 36.762s, Critical Path: 14.85s
INFO: 58 processes: 29 internal, 28 darwin-sandbox, 1 local.
ERROR: Build did NOT complete successfully

3、Zip
Zip Pod Click Here
@_implementationOnly import Minizip

I’d really appreciate your help. Thank you!

@luispadron
Copy link
Collaborator

Can you try with the latest master of this repository? We've merged some changes recently to fix some issues

Also, what rules_swift and rules_apple version are you using

@Jacky-LinPeng
Copy link
Author

Jacky-LinPeng commented Sep 10, 2024

Can you try with the latest master of this repository? We've merged some changes recently to fix some issues

Also, what rules_swift and rules_apple version are you using

1、WORKSPACE

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "build_bazel_rules_ios",
    url = "https://github.com/bazel-ios/rules_ios/archive/refs/heads/master.zip",
    strip_prefix = "rules_ios-master",
)

# protobuf
http_archive(
    name = "com_google_protobuf",
    urls = ["https://github.com/protocolbuffers/protobuf/archive/refs/tags/v28.0.zip"],
    strip_prefix = "protobuf-28.0",
)


load(
    "@build_bazel_rules_ios//rules:repositories.bzl",
    "rules_ios_dependencies"
)

rules_ios_dependencies()

load(
    "@build_bazel_rules_apple//apple:repositories.bzl",
    "apple_rules_dependencies",
)

apple_rules_dependencies()


load(
    "@build_bazel_rules_swift//swift:repositories.bzl",
    "swift_rules_dependencies",
)

swift_rules_dependencies()


load(
    "@build_bazel_apple_support//lib:repositories.bzl",
    "apple_support_dependencies",
)

apple_support_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load(
    "@com_google_protobuf//:protobuf_deps.bzl",
    "protobuf_deps",
)

protobuf_deps()

2、MODULE.bazel

###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
bazel_dep(name = "rules_apple", version = "3.8.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "2.1.1", repo_name = "build_bazel_rules_swift")

3、Error

ERROR: /Users/mac/Desktop/bazel/TestBazel/Pods/Zip/BUILD.bazel:3:16: Compiling Swift module //Pods/Zip:Zip_swift failed: (Exit 1): worker failed: error executing SwiftCompile command (from target //Pods/Zip:Zip_swift)
  (cd /private/var/tmp/_bazel_mac/bb5a831892807ac7f02caf3e5907793c/execroot/_main && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=17.0 \
    PATH=/Users/mac/Library/Caches/bazelisk/downloads/bazelbuild/bazel-7.3.1-darwin-x86_64/bin:/Users/mac/.nvm/versions/node/v22.0.0/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/mac/.rvm/bin \
    XCODE_VERSION_OVERRIDE=15.0.1.15A507 \
  bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_swift~/tools/worker/worker swiftc @bazel-out/ios_x86_64-fastbuild-ios-x86_64-min9.0-applebin_ios-ST-e9e99d26951a/bin/Pods/Zip/Zip.swiftmodule-0.params)
# Configuration: e163dbef7484137d52237dc1245ffcd24b16e2f1dfe6c70abd280142b1baa1b2
# Execution platform: @@platforms//host:host
error: emit-module command failed with exit code 1 (use -v to see invocation)
Pods/Zip/Zip/Zip.swift:10:29: error: no such module 'Minizip'
@_implementationOnly import Minizip
                            ^
Pods/Zip/Zip/Zip.swift:10:29: error: no such module 'Minizip'
@_implementationOnly import Minizip
                            ^
error: fatalError
Target //Pods/Zip:Zip failed to build

4、The Demo project

iOS_Bazel_Pods_Test

Compiling correctly

bazel clean --expunge                                                                             
bazel build //Pods/SocketRocket --verbose_failures --apple_platform_type=ios
bazel clean --expunge                                                                             
bazel build //Pods/Masonry--verbose_failures --apple_platform_type=ios

Compilation error

bazel clean --expunge                                                                             
bazel build //Pods/Zip--verbose_failures --apple_platform_type=ios

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

2 participants