onnela-lab / beiwe-ios

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe iOS app code. The Beiwe2 app is also available on the Apple app store to use with open source builds of the Beiwe backend.
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
21 stars 13 forks source link

Could not build Objective-C module 'ResearchKit'. Umbrella for module 'ResearchKit' already covers this directory. #55

Open reyvababtista opened 6 months ago

reyvababtista commented 6 months ago

Thank you for this open source project!

I have a build issue that I have not yet figured out. The build was done on M3 Max, Sonoma 14.3.1, Xcode 15.2, Swift 5.9.2. The device is still new, with Xcode newly installed, contained only the Beiwe project.

  1. Clone project, switch to branch 2.5.
  2. pod install
  3. Open Xcode, copy GoogleService-Info.plist file.
  4. Build.
  5. Error: Could not build Objective-C module 'ResearchKit'. Umbrella for module 'ResearchKit' already covers this directory
  6. Clean build folder.
  7. Close Xcode.
  8. pod install
  9. Open Xcode
  10. Build.
  11. Error: Could not build Objective-C module 'ResearchKit'. Umbrella for module 'ResearchKit' already covers this directory

I have attached the full build log and a screenshot into this message. Do you have any advice? @biblicabeebli

Build Beiwe2_2024-03-01T08-47-18.txt

Screenshot 2024-03-01 at 2 52 24 PM

Originally posted by @reyvababtista in https://github.com/onnela-lab/beiwe-ios/issues/27#issuecomment-1973338006

biblicabeebli commented 6 months ago

Unfortunately no. I've got the build working on an intel and an m2 mac. I'm no expert in pods if the error is in there.

When I got rid of PromiseKit in the 2.5 branch I got error message like this, but they were always random junk and a cleaning of the build folder and exit-reopen of Xcode fixed it.

Uh maybe you could try an Archive build in the product menu? That does some kind of cleaner build process (that's what you hit to make and publish a build to the app store) and has been my most recent action on the 2.4.14 build when I had to patch it.

(you will want the most recent work off of 2.5, it will be merged in hopefully soon. Many problems fixed.)

If you want to email me and set up a call I can try and help you with your build issues, I would be thrilled to get some iOS help. My time is a bit limited.

biblicabeebli commented 6 months ago

Either a dumb question or a smart question: which project file are you opening?

reyvababtista commented 6 months ago

Unfortunately no. I've got the build working on an intel and an m2 mac. I'm no expert in pods if the error is in there.

When I got rid of PromiseKit in the 2.5 branch I got error message like this, but they were always random junk and a cleaning of the build folder and exit-reopen of Xcode fixed it.

Uh maybe you could try an Archive build in the product menu? That does some kind of cleaner build process (that's what you hit to make and publish a build to the app store) and has been my most recent action on the 2.4.14 build when I had to patch it.

(you will want the most recent work off of 2.5, it will be merged in hopefully soon. Many problems fixed.)

If you want to email me and set up a call I can try and help you with your build issues, I would be thrilled to get some iOS help. My time is a bit limited.

I have not yet try the Archieve option as I was trying to running the simulator first. I will try that later after branch 2.5 is updated. I am not sure if I can find your email address from the repository. Can you give me the address?

Either a dumb question or a smart question: which project file are you opening?

I use the workspace file as prompted in the README.

biblicabeebli commented 6 months ago

my user name at gmail.

reyvababtista commented 6 months ago

my user name at gmail.

Just sent you an email.

reyvababtista commented 6 months ago

@biblicabeebli this is what you asked.

Screenshot 2024-03-07 at 12 42 43 PM
biblicabeebli commented 6 months ago

I worked with @reyvababtista but we have not been successful.

For some reason when Reyva runs the pod install command it doesn't install the same source. Running a clean build folder, quitting Xcode, deleting the Pods folder and running pod install, then reopenning and building results in the error in the initial screenshot. This error is resolvable by commenting out the second offending line, but doing so results in the error of screenshot 2. The second error can be resolved by inserting void into the parentheses - this is apparently a C++ vs C syntax difference, but the problem is that Reyva's pod-installed version of the code is different from my pod-installed version of the code.

Wut.

My copy of the module map file, in full, is:

framework module ResearchKit {
    umbrella header "ResearchKit.h"

    module Private {
        umbrella header "ResearchKit_Private.h"
        export *
    }

    export *
    module * { export * }
}

it differs from Reyva's in lacking the second 4-line module declaration.

My copy of GDTCORClock.h has the void parameters as declared above. (or at least that's all we noticed)

In terms of differences in our environments:

@reyvababtista could you line-by-line compare the output of my pod env command to yours? maybe we missed something when we did this live. (lol the output contains triple-` sequences that break monospace block formatting on github. I've replaced the back-ticks with single quotes)


### Stack

'''
   CocoaPods : 1.15.2
        Ruby : ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22]
    RubyGems : 3.5.4
        Host : macOS 13.6.4 (22G513)
       Xcode : 15.2 (15C500b)
         Git : git version 2.43.0
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.3.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
'''

### Installation Source

'''
Executable Path: /opt/homebrew/Cellar/cocoapods/1.15.2/libexec/bin/pod
'''

### Plugins

'''
cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0
'''

### Podfile

'''ruby
platform :ios, '12.0'

target 'Beiwe' do
  use_frameworks!
  pod 'Crashlytics', '~> 3.4'
  pod 'KeychainSwift', '~> 8.0'
  pod 'Alamofire', '~> 4.5'
  pod 'ObjectMapper', :git => 'https://github.com/Hearst-DD/ObjectMapper.git', :branch => 'master'
  pod 'Eureka'
  pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :branch => 'master'
  pod 'PKHUD', :git => 'https://github.com/pkluz/PKHUD.git', :branch => 'release/swift4'
  pod 'IDZSwiftCommonCrypto', '~> 0.13.0'
  pod 'couchbase-lite-ios'
  pod 'ResearchKit', :git => 'https://github.com/ResearchKit/ResearchKit.git', :commit => 'b50e1d7'
  pod 'ReachabilitySwift', '~>3'
  pod 'EmitterKit', '~> 5.1'
  pod 'Hakuba', :git => 'https://github.com/eskizyen/Hakuba.git', :branch => 'Swift3'
  pod 'XLActionController', '~>5.0.1'
  pod 'XCGLogger', '~> 7.0.0'
  pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '4.5.0'
  pod 'Firebase/Analytics'
  pod 'Firebase/Messaging', '~>6'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    next unless (target.name == 'ResearchKit')
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
    end
  end
  installer.pods_project.targets.each do |target|
    if target.name == 'Eureka' || target.name == 'XLActionController' || target.name == 'ResearchKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.2'
        config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    else
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.0'
        config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    end
  end
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
    end
  end
end
'''

I don't have enough knowledge of cocoapods to determine why it installed just-different versions of the code. I don't remember doing anything different when setting up my environment. We need someone who understands cocoapods.

biblicabeebli commented 6 months ago

(I cannot update my version of xcode due to my mac os version, which I cannot update due to employer IT/security policy. not that I want to.)

biblicabeebli commented 5 months ago

@reyvababtista Shot in the dark - are you running x86 homebrew running on rosetta, or ARM homebrew?