microsoft / plcrashreporter

Reliable, open-source crash reporting for iOS, macOS and tvOS
Other
2.88k stars 537 forks source link

Compilation error when use library with Bazel & SPM #292

Closed PutkovDimi closed 5 months ago

PutkovDimi commented 10 months ago

Description

There is an error during compilation. It's described here https://github.com/cgrindel/rules_swift_package_manager/issues/761, possible reasons are attached

Repro Steps

  1. Use project with Bazel
  2. Inject App-center with SPM
  3. Try to build project

Details

  1. SDK Version: AppCenter 5.0.4, PLCCrashReporter: 1.11.1
  2. OS Ventura 13.5.2
  3. bazel 6.4.0; Xcode 15.0
  4. Any device, no matter emulator or physical device.
  5. What language are you using?
    • [ ] Objective C
    • [x] Swift
  6. There is AppCenter and it includes PLCCrashReporter
MikhailSuendukov commented 10 months ago

Hi @PutkovDimi and sorry for long delay. Thank you for reporting your issue. To help us identify the source of the problem, could you please provide a simple demo application that reproduces the error? A basic example would be very helpful for our troubleshooting process.

AnatolyPristensky commented 9 months ago

Hello @PutkovDimi, we haven't heard from you for a while, so I'm closing this issue. Please, feel free to reopen it in case of new information.

PutkovDimi commented 9 months ago

@AnatolyPristensky @MikhailSuendukov Sorry for delay, here you can find a demo app: https://github.com/PutkovDimi/AppCenter-Bazel-DemoApp

PutkovDimi commented 9 months ago

@AnatolyPristensky

feel free to reopen it in case of new information.

Sorry, couldn't find how to reopen, should I duplicate it as a new issue?

MikhailSuendukov commented 8 months ago

Hi @PutkovDimi, when I followed your instructions to launch the application the following error occurred.

 % ./build_and_run
ERROR: Skipping '//:tidy': error loading package '': Unable to find package for @bazel_skylib//rules:build_test.bzl: The repository '@bazel_skylib' could not be resolved: Repository '@bazel_skylib' is not defined.
WARNING: Target pattern parsing failed.
ERROR: error loading package '': Unable to find package for @bazel_skylib//rules:build_test.bzl: The repository '@bazel_skylib' could not be resolved: Repository '@bazel_skylib' is not defined.
INFO: Elapsed time: 0.156s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
    currently loading: 
ERROR: Build failed. Not running target
PutkovDimi commented 8 months ago

@MikhailSuendukov Hi, check it again please, I removed it as unnecessary :raised_hands:

MikhailSuendukov commented 8 months ago

Now for some reason I am getting a message

%./build_and_run
Starting local Bazel server and connecting to it...
ERROR: Skipping '//:tidy': error loading package '': Unable to find package for @rules_xcodeproj//xcodeproj:defs.bzl: The repository '@rules_xcodeproj' could not be resolved: Repository '@rules_xcodeproj' is not defined .
WARNING: Target pattern parsing failed.
ERROR: error loading package '': Unable to find package for @rules_xcodeproj//xcodeproj:defs.bzl: The repository '@rules_xcodeproj' could not be resolved: Repository '@rules_xcodeproj' is not defined.
INFO: Elapsed time: 2.133s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
     currently loading:
ERROR: Build failed. Not running target

If your result of calling the build_and_run script is different from mine, then it is possible that something in my environment is configured differently from yours. Could you please help me with this? Or if you have the same error, fix your demo application please?

PutkovDimi commented 8 months ago

@MikhailSuendukov I added some deps which could've been missing so now it's possible to build and run it. Check, please

MikhailSuendukov commented 8 months ago

Apparently, errors occurred due to an unconfigured WORSPACE file. But after I managed to configure it correctly, I was unable to load appcenter as a dependency into your application. I'm getting this error.

./build_and_run
[√] GO Lang already installed
[√] Buildifier already installed
[√] Bazel already installed
INFO: Analyzed target //:tidy (23 packages loaded, 235 targets configured).
INFO: Found 1 target...
Target //:tidy up-to-date:
  bazel-bin/tidy
INFO: Elapsed time: 0.239s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/tidy :swift_update_pkgs :update_build_files
INFO: Analyzed target //:swift_update_pkgs (61 packages loaded, 9408 targets configured).
INFO: Found 1 target...
Target //:swift_update_pkgs up-to-date:
  bazel-bin/swift_update_pkgs-runner.bash
  bazel-bin/swift_update_pkgs
INFO: Elapsed time: 0.453s, Critical Path: 0.04s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/swift_update_pkgs
INFO: Analyzed target //:update_build_files (0 packages loaded, 2 targets configured).
INFO: Found 1 target...
Target //:update_build_files up-to-date:
  bazel-bin/update_build_files-runner.bash
  bazel-bin/update_build_files
INFO: Elapsed time: 0.138s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/update_build_files
INFO: Analyzed target //:xcodeproj (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:xcodeproj up-to-date:
  bazel-bin/xcodeproj-runner.sh
INFO: Elapsed time: 0.143s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/xcodeproj-runner.sh

Generating "App.xcodeproj"
ERROR: /Users/mikhailsuendukov/Documents/xcodeProjects/AppCenter-Bazel-DemoApp/BUILD.bazel:60:14: no such package '@swiftpkg_appcenter_sdk_apple//': The repository '@swiftpkg_appcenter_sdk_apple' could not be resolved: Repository '@swiftpkg_appcenter_sdk_apple' is not defined and referenced by '//:ModuleExample'
ERROR: Analysis of target '@rules_xcodeproj_generated//generator/xcodeproj:xcodeproj' failed; build aborted: 
INFO: Elapsed time: 0.095s
INFO: 0 processes.
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully (2 packages loaded, 1 target configured)

Apparently, additional settings in WORSPACE are also needed here. Could you please help me with this?

DmitriyKirakosyan commented 5 months ago

As we do not have plans to fix this bug in the next year, I'm closing the issue.