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

Cannot use Crashlytics #425

Closed
pswaminathan opened this issue Jun 23, 2023 · 5 comments · Fixed by #435
Closed

Cannot use Crashlytics #425

pswaminathan opened this issue Jun 23, 2023 · 5 comments · Fixed by #435

Comments

@pswaminathan
Copy link

pswaminathan commented Jun 23, 2023

Including Firebase Crashlytics fails with the following:

ERROR: /private/var/tmp/_bazel_p/5462d161dadab65df3f9fb5a8ecf08b9/external/swiftpkg_firebase_ios_sdk/BUILD.bazel:811:13: Compiling Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m failed: (Exit 1): wrapped_clang failed: error executing command (from target @swiftpkg_firebase_ios_sdk//:Crashlytics_FirebaseCrashlytics) external/local_config_cc/wrapped_clang -target arm64-apple-ios15.0-simulator '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 ... (remaining 138 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m:195:18: error: expected a platform name here
  if (@available(iOS 15, *)) {
                 ^
<command line>:12:13: note: expanded from macro 'iOS'
#define iOS 1
            ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m:241:18: error: expected a platform name here
  if (@available(iOS 15, *)) {
                 ^
<command line>:12:13: note: expanded from macro 'iOS'
#define iOS 1
            ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Controllers/FIRCLSReportManager.m:303:18: error: expected a platform name here
  if (@available(iOS 15, *)) {
                 ^
<command line>:12:13: note: expanded from macro 'iOS'
#define iOS 1
            ^
3 errors generated.
Error in child process '/usr/bin/xcrun'. 1
ERROR: /private/var/tmp/_bazel_p/5462d161dadab65df3f9fb5a8ecf08b9/external/swiftpkg_firebase_ios_sdk/BUILD.bazel:811:13: Compiling Crashlytics/Crashlytics/Helpers/FIRCLSLogger.m failed: (Exit 1): wrapped_clang failed: error executing command (from target @swiftpkg_firebase_ios_sdk//:Crashlytics_FirebaseCrashlytics) external/local_config_cc/wrapped_clang -target arm64-apple-ios15.0-simulator '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 ... (remaining 138 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Helpers/FIRCLSLogger.m:26:15: error: use of undeclared identifier 'FIRLoggerLevelDebug'
  FIRLogBasic(FIRLoggerLevelDebug, kFIRLoggerCrashlytics, CrashlyticsMessageCode, message,
              ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Helpers/FIRCLSLogger.m:34:15: error: use of undeclared identifier 'FIRLoggerLevelInfo'
  FIRLogBasic(FIRLoggerLevelInfo, kFIRLoggerCrashlytics, CrashlyticsMessageCode, message, args_ptr);
              ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Helpers/FIRCLSLogger.m:41:15: error: use of undeclared identifier 'FIRLoggerLevelWarning'
  FIRLogBasic(FIRLoggerLevelWarning, kFIRLoggerCrashlytics, CrashlyticsMessageCode, message,
              ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/Helpers/FIRCLSLogger.m:49:15: error: use of undeclared identifier 'FIRLoggerLevelError'
  FIRLogBasic(FIRLoggerLevelError, kFIRLoggerCrashlytics, CrashlyticsMessageCode, message,
              ^
4 errors generated.
Error in child process '/usr/bin/xcrun'. 1
ERROR: /private/var/tmp/_bazel_p/5462d161dadab65df3f9fb5a8ecf08b9/external/swiftpkg_firebase_ios_sdk/BUILD.bazel:811:13: Compiling Crashlytics/Crashlytics/FIRCrashlytics.m failed: (Exit 1): wrapped_clang failed: error executing command (from target @swiftpkg_firebase_ios_sdk//:Crashlytics_FirebaseCrashlytics) external/local_config_cc/wrapped_clang -target arm64-apple-ios15.0-simulator '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 ... (remaining 138 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/swiftpkg_firebase_ios_sdk/Crashlytics/Crashlytics/FIRCrashlytics.m:130:32: error: definition of 'FIROptions' must be imported from module 'FirebaseCore' before it is required
    _googleAppID = app.options.googleAppID;
                               ^
bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4da10c1b88c0/bin/external/swiftpkg_firebase_ios_sdk/FirebaseCore/../../../../../../external/swiftpkg_firebase_ios_sdk/FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h:25:12: note: definition here is not reachable
@interface FIROptions : NSObject <NSCopying>
           ^
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
ERROR: /private/var/tmp/_bazel_p/5462d161dadab65df3f9fb5a8ecf08b9/external/swiftpkg_firebase_ios_sdk/BUILD.bazel:811:13: Compiling Crashlytics/Shared/FIRCLSConstants.m failed: (Exit 1): wrapped_clang failed: error executing command (from target @swiftpkg_firebase_ios_sdk//:Crashlytics_FirebaseCrashlytics) external/local_config_cc/wrapped_clang -target arm64-apple-ios15.0-simulator '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 ... (remaining 138 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/swiftpkg_firebase_ios_sdk/Crashlytics/Shared/FIRCLSConstants.m:55:10: error: call to undeclared function 'FIRFirebaseVersion'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  return FIRFirebaseVersion();
         ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Shared/FIRCLSConstants.m:55:10: error: declaration of 'FIRFirebaseVersion' must be imported from module 'FirebaseCore' before it is required
bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4da10c1b88c0/bin/external/swiftpkg_firebase_ios_sdk/FirebaseCore/../../../../../../external/swiftpkg_firebase_ios_sdk/FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h:23:11: note: declaration here is not visible
NSString* FIRFirebaseVersion(void);
          ^
external/swiftpkg_firebase_ios_sdk/Crashlytics/Shared/FIRCLSConstants.m:55:10: error: conflicting types for 'FIRFirebaseVersion'
  return FIRFirebaseVersion();
         ^
bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4da10c1b88c0/bin/external/swiftpkg_firebase_ios_sdk/FirebaseCore/../../../../../../external/swiftpkg_firebase_ios_sdk/FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h:23:11: note: previous declaration is here
NSString* FIRFirebaseVersion(void);
          ^
3 errors generated.
Error in child process '/usr/bin/xcrun'. 1

Package.swift:

let package = Package(
    dependencies: [
        .package(url: "https://github.com/firebase/firebase-ios-sdk", .exact("10.11.0")),
    ]
)

BUILD.bazel:

    deps = [
...
        "@swiftpkg_firebase_ios_sdk//:Crashlytics_FirebaseCrashlytics",
    ],

If I add --apple_platform_type=ios to the build flags (which AFAIK I shouldn't need to do, because my build target is an ios_application), I only get the LoggerLevel errors:

@cgrindel
Copy link
Owner

Just to confirm do you have these bazelrc flags set?

@pswaminathan
Copy link
Author

We're using C++17 standard because it is needed for other projects we have, but otherwise yes. I also tried just now with C++14, and still get the same errors.

@cgrindel
Copy link
Owner

I am adding this Crashlytics example to try and reproduce your error.

@pswaminathan
Copy link
Author

Thanks @cgrindel ! I can clone a branch and test too if/when you have one up.

Also amending my original issue, I actually am now receiving the same errors whether or not I specify --apple_platform_type. Not sure if I forgot to add --keep_going before...

@cgrindel
Copy link
Owner

Quick update. I found one issue where a modulemap target is being added as a dep though one is unnecessary. To fix this, I need to refactor some source inspection code to occur earlier in the repository processing. I plan to put up a 2-3 pull requests. The first 1-2 will be the refactor. The final one will be the fix for the modulemap dep logic.

cgrindel added a commit that referenced this issue Jun 26, 2023
- Add `label` to target.
- Add `pkginfo_targets.get_by_label()`.
- Pass `repository_ctx` to `pkginfos.new_from_parsed_json()`.
- Add `swift_src_info` with `has_objv_directive`.
- Add `testutils` module.
- Update tests to use mangled repository name when retrieve
`repository_ctx.name`.

Related to #425.
cgrindel added a commit that referenced this issue Jun 27, 2023
- Add `clang_src_info` and `objc_src_info` to target. They contain the
source file analysis results.
- Add `imports_xctest` to `swift_src_info`.

Related to #425.
cgrindel added a commit that referenced this issue Jun 28, 2023
- Move `swift.FileInfo` to `swiftpkg.SwiftFileInfo`.
- Update `swiftpkg.SwiftFileInfo` to check for `@objc` directive.
- Add `ModulemapLabel` to `swift.Module`. For Swift source modules, this
field is populated if a modulemap target is required (e.g., has `@objc`
directives).
- Add `modulemap_label` to `deps_indexes.new_module`.
- Update `deps_indexes.labels_for_module` to check for `modulemap_label`
on the module instead of assuming that all Swift targets that are a
dependency for an Objc target should have one.

Related to #425.
cgrindel added a commit that referenced this issue Jul 1, 2023
- Treat `maccatalyst` like `ios` instead of `macos`.
- Add `crashlytics` example to `firebase_example`.
- Ensure that `defines` values that contain spaces are escaped properly.
If not escaped, each space-separated part becomes its own define value.
- Do not trust the package manifests! Check that directories exist
before attempting to list their contents.
- Include `.mm` files (Objective-C++) as valid sources.

Closes #425.
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

Successfully merging a pull request may close this issue.

2 participants