sergeykhliustin/BazelPods

Unable to build RealmSwift

Opened this issue · 1 comments

Hi! First of all, thank you for your work, this set of rules are amazing!

I am trying to incorporate Bazel to my builds in a Swift project that I am currently working on. Right now, all Pods seem to be compiling, however, RealmSwift is not. As it is, I think, a widely used Pod, I thought I could ask here to see if there's anyone that might have had success trying to build it with BazelPods.

The version that I am using is 10.36.

I've had to add the following environment variable to my .bazelrc file so that the build could start:

build --define REALM_LD_CLASSIC=-Wl,-ld_classic

But, even with that piece of code, I was not able to compile the library, getting the following error:

INFO: Analyzed target //Pods/RealmSwift:RealmSwift (0 packages loaded, 7 targets configured).
INFO: Found 1 target...
ERROR: ..../Pods/RealmSwift/BUILD.bazel:12:16: Compiling Swift module //Pods/RealmSwift:RealmSwift_swift failed: (Exit 1): worker failed: error executing command (from target //Pods/RealmSwift:RealmSwift_swift) 
  (cd /private/var/tmp/_bazel_marcos/e1ee2a0ef3e4a24e12ead1b00066b423/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=17.0 \
    SWIFT_AVOID_WARNING_USING_OLD_DRIVER=1 \
    XCODE_VERSION_OVERRIDE=15.0.0.15A240d \
  bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-f38588c23081/bin/external/build_bazel_rules_swift/tools/worker/worker swiftc @bazel-out/ios-sim_arm64-min13.0-applebin_ios-ios_sim_arm64-fastbuild-ST-8cbc301e1c67/bin/Pods/RealmSwift/RealmSwift.swiftmodule-0.params)
# Configuration: bc2c0832c86f5796418d9146b26b6dbeaa9aa4da31cf55dccb2333263d62169d
# Execution platform: @local_config_platform//:host
error: emit-module command failed with exit code 1 (use -v to see invocation)
Pods/RealmSwift/RealmSwift/Aliases.swift:20:8: error: no such module 'Realm.Swift'
import Realm.Swift
       ^
Pods/RealmSwift/RealmSwift/Aliases.swift:20:8: error: no such module 'Realm.Swift'
import Realm.Swift
       ^
Pods/RealmSwift/RealmSwift/Aliases.swift:20:8: error: no such module 'Realm.Swift'
import Realm.Swift
       ^
Pods/RealmSwift/RealmSwift/Aliases.swift:20:8: error: no such module 'Realm.Swift'
import Realm.Swift
       ^
error: fatalError
Target //Pods/RealmSwift:RealmSwift failed to build
INFO: Elapsed time: 3.618s, Critical Path: 3.49s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Does anyone have a clue on what is going on exactly?

Thank you so much in advance!

@alvarezGarciaMarcos
I've fixed some env variables and cc_copts required to build C++ in the latest release (1.11.4)
But still unable to build it on the latest Xcode, something needs to be fixed with the C++ configuration.
Let me know if you find something.