surpher/PactSwift

Bug: Building mock server failing on cargo lipo

surpher opened this issue ยท 2 comments

๐ŸŒŽ Environment

  • Xcode: 12.4
  • Platform: iOS, macOS
  • Version/Release: rust nightly toolchain
  • Dependency manager: n/a

๐Ÿ’ฌ Description

When building the mock server as part of the build process, the cargo lipo command fails due to a bug in Rust.

๐Ÿฆถ Reproduction Steps

Steps to reproduce the behavior:

  1. Clone this repo
  2. Open Xcode
  3. Build project

๐Ÿค” Expected Results

Project builds

๐Ÿ˜ฒ Actual Results

Project build fails

๐ŸŒณ Logs

Compiling pact_verifier v0.10.3 (/Users/marko/Developer/pact-foundation/pact-reference/rust/pact_verifier)
warning: dropping unsupported crate type `cdylib` for target `aarch64-apple-ios`
warning: unused variable: `verification_context`
  --> pact_verifier/src/messages.rs:19:3
   |
19 |   verification_context: &HashMap<&str, Value>
   |   ^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_verification_context`
   |
   = note: `#[warn(unused_variables)]` on by default
warning: 2 warnings emitted
error: internal compiler error: failed to process buffered lint here
   --> pact_verifier/src/pact_broker.rs:864:20
    |
864 |           Ok(_) => debug!("Pushed tag {} for provider version {}", tag, version),
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/compiler/rustc_lint/src/early.rs:384:18
    = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: internal compiler error: failed to process buffered lint here
   --> pact_verifier/src/lib.rs:825:16
    |
825 |       Ok(_) => log::info!("Results published to Pact Broker"),
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/compiler/rustc_lint/src/early.rs:384:18
    = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: internal compiler error: failed to process buffered lint here
   --> pact_verifier/src/lib.rs:826:23
    |
826 |       Err(ref err) => log::error!("Publishing of verification results failed with an error: {}", err)
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at /rustc/04caa632dd10c2bf64b69524c7f9c4c30a436877/compiler/rustc_lint/src/early.rs:384:18
    = note: this error: internal compiler error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:974:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.51.0-nightly (04caa632d 2021-01-30) running on x86_64-apple-darwin
note: compiler flags: -C opt-level=3 -C embed-bitcode=no --crate-type cdylib --crate-type rlib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `pact_verifier`
To learn more, run the command again with --verbose.
[ERROR cargo_lipo] Failed to build "pact_verifier_ffi" for "aarch64-apple-ios": Executing "/Users/marko/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo" "--color" "auto" "build" "-p" "pact_verifier_ffi" "--target" "aarch64-apple-ios" "--release" "--lib" finished with error status: exit code: 101

๐Ÿ“„ Stack Traces

n/a

๐Ÿ‘€ Possible cause

Using cargo 1.51.0-nightly (c3abcfe8a 2021-01-25)

๐Ÿค Relationships

  • Related PRs or Issues: #xxx, #yyy

Using rustup stable toolchain works fine and builds successfully.

Should be fixed with PactSwift v0.3.6

Cause:
When using PactSwift using SPM a script is used to build and replace the bogus pact-mock-server.a text file with a pact-mock-server.a binary. With the desire to start supporting arm64-darwin architecture, the nightly Rust toolchain was used. This highly Rust toolchain is not stable and potentially buggy which was the cause for this issue.

Resolution:
Using a stable Rust toolchain.